Package org.apache.jena.graph
Class NodeFactory
- java.lang.Object
-
- org.apache.jena.graph.NodeFactory
-
public class NodeFactory extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description NodeFactory()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Node
createBlankNode()
Make a fresh blank nodestatic Node
createBlankNode(java.lang.String string)
make a blank node with the specified labelstatic Node
createBlankNode(BlankNodeId id)
make a blank node with the specified labelstatic Node
createExt(java.lang.String name)
make an extension node based on a string.static Node
createGraphNode(Graph graph)
Create a graph node.static Node
createLiteral(java.lang.String value)
static Node
createLiteral(java.lang.String lex, java.lang.String lang)
Make a literal with specified language.static Node
createLiteral(java.lang.String lex, java.lang.String lang, boolean isXml)
make a literal with specified language and XMLishness.static Node
createLiteral(java.lang.String lex, java.lang.String lang, RDFDatatype dtype)
Build a literal node from its lexical form.static Node
createLiteral(java.lang.String lex, RDFDatatype dtype)
Build a typed literal node from its lexical form.static Node
createLiteral(LiteralLabel lit)
make a literal node with the specified literal valuestatic Node
createLiteralByValue(java.lang.Object value, java.lang.String lang, RDFDatatype dtype)
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.static Node
createLiteralByValue(java.lang.Object value, RDFDatatype dtype)
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.static Node
createTripleNode(Node s, Node p, Node o)
Create a triple node (RDF-star)static Node
createTripleNode(Triple triple)
Create a triple node (RDF-star)static Node
createURI(java.lang.String uri)
make a URI node with the specified URIref stringstatic Node
createVariable(java.lang.String name)
make a variable node with a given namestatic RDFDatatype
getType(java.lang.String s)
-
-
-
Method Detail
-
getType
public static RDFDatatype getType(java.lang.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(java.lang.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(java.lang.String uri)
make a URI node with the specified URIref string
-
createVariable
public static Node createVariable(java.lang.String name)
make a variable node with a given name
-
createExt
public static Node createExt(java.lang.String name)
make an extension node based on a string.
-
createLiteral
public static Node createLiteral(java.lang.String value)
-
createLiteral
public static Node createLiteral(java.lang.String lex, java.lang.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(java.lang.String lex, java.lang.String lang)
Make a literal with specified language. lexical form must not be null.- Parameters:
lex
- the lexical form of the literallang
- the optional language tag
-
createLiteral
public static Node createLiteral(java.lang.String lex, java.lang.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 literallang
- the optional language tagdtype
- the type of the literal- Throws:
DatatypeFormatException
- if lex is not a legal form of dtype
-
createLiteral
public static Node createLiteral(java.lang.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 literaldtype
- the type of the literal- Throws:
DatatypeFormatException
- if lex is not a legal form of dtype
-
createLiteralByValue
public static Node createLiteralByValue(java.lang.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(java.lang.Object value, java.lang.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)
-
-