Class NodeUtils


public class NodeUtils extends Object
Node utilities. See NodeCmp for node comparison operations.
  • Field Details

    • sameNode

      public static EqualityTest sameNode
      Both null or same node : Node.equals
    • sameRdfTerm

      public static EqualityTest sameRdfTerm
      Term comparison. Node.equals or lang tags are case insensitive
    • sameValue

      public static EqualityTest sameValue
      sameValue by SPARQL rules
  • Constructor Details

    • NodeUtils

      public NodeUtils()
  • Method Details

    • asNode

      public static Node asNode(org.apache.jena.iri.IRI iri)
      IRI to Node
    • asNode

      public static Node asNode(String iri)
      IRI string to Node
    • hasLang

      public static boolean hasLang(Node node)
      Return true if the node is a literal and has a language tag
    • stringLiteral

      public static String stringLiteral(Node literal)
      Get lexical form of anything that looks like a string literal. Returns the string value of plain literal (simple literal or lang string) or XSD string.
    • nullToAny

      public static Node nullToAny(Node n)
    • nodesToURIs

      public static Iterator<String> nodesToURIs(Iterator<Node> iter)
      Convert IRI Nodes to strings. Skip other kinds of Node
    • convertToSetNodes

      public static Set<Node> convertToSetNodes(Collection<String> namedGraphs)
      Convert a collection of strings to a set of Nodes.
    • convertToSetNodes

      public static Set<Node> convertToSetNodes(String... namedGraphs)
      Convert a collection of strings to a set of Nodes.
    • convertToListNodes

      public static List<Node> convertToListNodes(String... namedGraphs)
      Convert strings to a List of Nodes.
    • convertToListNodes

      public static List<Node> convertToListNodes(List<String> namedGraphs)
      Convert strings to a List of Nodes.
    • compareRDFTerms

      @Deprecated public static int compareRDFTerms(Node node1, Node node2)
    • isXSDNumeric

      public static boolean isXSDNumeric(Node node)
      Return true if the node is a literal and has an XSD numeric datatype.
    • isSimpleString

      public static boolean isSimpleString(Node n)
      A Node is a simple string if:
      • (RDF 1.0) No datatype and no language tag
      • (RDF 1.1) xsd:string
    • isLangString

      public static boolean isLangString(Node n)
      A Node is a language string if it has a language tag. (RDF 1.0 and RDF 1.1)