![JAR search and dependency download from the Maven repository](/logo.png)
net.sansa_stack.rdf.spark.utils.NodeUtils.scala Maven / Gradle / Ivy
package net.sansa_stack.rdf.spark.utils
import org.apache.jena.graph.Node
object NodeUtils {
/**
* Return node value based on its type
* @param node the Node to be check
* @return node value (case when node is URI:: URI, when node is Blank ::Its blank node ID, when node is literal:: its Literal).
*/
def getNodeValue(node: Node): String = node match {
case uri if node.isURI => node.getURI
case blank if node.isBlank => node.getBlankNodeLabel
case literal if node.isLiteral => node.getLiteral.toString
case _ => throw new IllegalArgumentException(s"${node.getLiteralLexicalForm} is not valid!")
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy