Class NodeUtils

java.lang.Object
org.apache.jena.sparql.util.NodeUtils

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

    Fields
    Modifier and Type
    Field
    Description
    Both null or same node : Node.equals
    Term comparison.
    sameValue by SPARQL rules
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.apache.jena.graph.Node
    IRI string to Node
    static List<org.apache.jena.graph.Node>
    convertToListNodes(String... namedGraphs)
    Convert strings to a List of Nodes.
    static List<org.apache.jena.graph.Node>
    Convert strings to a List of Nodes.
    static Set<org.apache.jena.graph.Node>
    convertToSetNodes(String... namedGraphs)
    Convert a collection of strings to a set of Nodes.
    static Set<org.apache.jena.graph.Node>
    Convert a collection of strings to a set of Nodes.
    static boolean
    hasLang(org.apache.jena.graph.Node node)
    Return true if the node is a literal and has a language tag
    static boolean
    isLangString(org.apache.jena.graph.Node n)
    A Node is a language string if it has a language tag.
    static boolean
    isSimpleString(org.apache.jena.graph.Node n)
    A Node is a simple string if: (RDF 1.0) No datatype and no language tag (RDF 1.1) xsd:string
    static boolean
    isXSDNumeric(org.apache.jena.graph.Node node)
    Return true if the node is a literal and has an XSD numeric datatype.
    nodesToURIs(Iterator<org.apache.jena.graph.Node> iter)
    Convert IRI Nodes to strings.
    static org.apache.jena.graph.Node
    nullToAny(org.apache.jena.graph.Node n)
     
    static String
    stringLiteral(org.apache.jena.graph.Node literal)
    Get lexical form 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 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 org.apache.jena.graph.Node asNode(String iri)
      IRI string to Node
    • hasLang

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

      public static String stringLiteral(org.apache.jena.graph.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 org.apache.jena.graph.Node nullToAny(org.apache.jena.graph.Node n)
    • nodesToURIs

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

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

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

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

      public static List<org.apache.jena.graph.Node> convertToListNodes(List<String> namedGraphs)
      Convert strings to a List of Nodes.
    • isXSDNumeric

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

      public static boolean isSimpleString(org.apache.jena.graph.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(org.apache.jena.graph.Node n)
      A Node is a language string if it has a language tag. (RDF 1.0 and RDF 1.1)