Class NodeUtils


  • public class NodeUtils
    extends java.lang.Object
    Node utilities
    • Constructor Summary

      Constructors 
      Constructor Description
      NodeUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static Node asNode​(java.lang.String iri)
      IRI string to Node
      static Node asNode​(org.apache.jena.iri.IRI iri)
      IRI to Node
      static int compareRDFTerms​(Node node1, Node node2)
      Compare two Nodes, based on their RDF terms forms, not value
      static java.util.List<Node> convertToListNodes​(java.lang.String... namedGraphs)
      Convert strings to a List of Nodes.
      static java.util.List<Node> convertToListNodes​(java.util.List<java.lang.String> namedGraphs)
      Convert strings to a List of Nodes.
      static java.util.Set<Node> convertToSetNodes​(java.lang.String... namedGraphs)
      Convert a collection of strings to a set of Nodes.
      static java.util.Set<Node> convertToSetNodes​(java.util.Collection<java.lang.String> namedGraphs)
      Convert a collection of strings to a set of Nodes.
      static boolean hasLang​(Node node)
      Return true if the node is a literal and has a language tag
      static boolean isLangString​(Node n)
      A Node is a language string if it has a language tag.
      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
      static java.util.Iterator<java.lang.String> nodesToURIs​(java.util.Iterator<Node> iter)
      Convert IRI Nodes to strings.
      static java.lang.String stringLiteral​(Node literal)
      Get lexical for of anything that looks like a string literal.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • 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 Detail

      • NodeUtils

        public NodeUtils()
    • Method Detail

      • asNode

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

        public static Node asNode​(java.lang.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 java.lang.String stringLiteral​(Node literal)
        Get lexical for of anything that looks like a string literal. Returns the string value of plain literal (simple literal or lang string) or XSD string.
      • nodesToURIs

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

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

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

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

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

        public static int compareRDFTerms​(Node node1,
                                          Node node2)
        Compare two Nodes, based on their RDF terms forms, not value
      • 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