Class NodeFactory

java.lang.Object
org.apache.jena.graph.NodeFactory

public class NodeFactory extends Object
  • Constructor Details

    • NodeFactory

      public NodeFactory()
  • Method Details

    • getType

      public static RDFDatatype getType(String s)
    • createBlankNode

      public static Node createBlankNode()
      Make a fresh blank node
    • createBlankNode

      public static Node createBlankNode(BlankNodeId id)
      make a blank node with the specified label
    • createBlankNode

      public static Node createBlankNode(String string)
      make a blank node with the specified label
    • createLiteral

      public static Node createLiteral(LiteralLabel lit)
      make a literal node with the specified literal value
    • createURI

      public static Node createURI(String uri)
      make a URI node with the specified URIref string
    • createVariable

      public static Node createVariable(String name)
      make a variable node with a given name
    • createExt

      public static Node createExt(String name)
      make an extension node based on a string.
    • createLiteral

      public static Node createLiteral(String value)
    • createLiteral

      public static Node createLiteral(String lex, String lang, boolean isXml)
      make a literal with specified language and XMLishness. lexical form must not be null.
      Parameters:
      lex -
      lang -
      isXml - If true then lit is exclusive canonical XML of type rdf:XMLLiteral, and no checking will be invoked.
    • createLiteral

      public static Node createLiteral(String lex, String lang)
      Make a literal with specified language. lexical form must not be null.
      Parameters:
      lex - the lexical form of the literal
      lang - the optional language tag
    • createLiteral

      public static Node createLiteral(String lex, String lang, RDFDatatype dtype) throws DatatypeFormatException
      Build a literal node from its lexical form. The lexical form will be parsed now and the value stored. If the form is not legal this will throw an exception.
      Parameters:
      lex - the lexical form of the literal
      lang - the optional language tag
      dtype - the type of the literal
      Throws:
      DatatypeFormatException - if lex is not a legal form of dtype
    • createLiteral

      public static Node createLiteral(String lex, RDFDatatype dtype) throws DatatypeFormatException
      Build a typed literal node from its lexical form. The lexical form will be parsed now and the value stored. If the form is not legal this will throw an exception.
      Parameters:
      lex - the lexical form of the literal
      dtype - the type of the literal
      Throws:
      DatatypeFormatException - if lex is not a legal form of dtype
    • createLiteralByValue

      public static Node createLiteralByValue(Object value, RDFDatatype dtype) throws DatatypeFormatException
      Create a Node based on the value If the value is a string we assume this is intended to be a lexical form after all.
      Parameters:
      value - The value, mapped according to registered types.
      dtype - RDF Datatype.
      Returns:
      Node
      Throws:
      DatatypeFormatException
    • createLiteralByValue

      public static Node createLiteralByValue(Object value, String lang, RDFDatatype dtype) throws DatatypeFormatException
      Create a Node based on the value If the value is a string we assume this is intended to be a lexical form after all.
      Parameters:
      value - The value, mapped according to registered types.
      lang - (optional) Language tag, if a string.
      dtype - RDF Datatype.
      Returns:
      Node
      Throws:
      DatatypeFormatException
    • createTripleNode

      public static Node createTripleNode(Node s, Node p, Node o)
      Create a triple node (RDF-star)
    • createTripleNode

      public static Node createTripleNode(Triple triple)
      Create a triple node (RDF-star)
    • createGraphNode

      public static Node createGraphNode(Graph graph)
      Create a graph node. This is an N3-formula; it is not a named graph (see "quad")