Package com.inrupt.rdf.wrapping.jena
Class NodeMappings
- java.lang.Object
-
- com.inrupt.rdf.wrapping.jena.NodeMappings
-
public final class NodeMappings extends Object
Common mappings from various values to RDF terms. For use in wrapping classes.- Author:
- Samu Lang
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.apache.jena.rdf.model.Resource
asIri(String value, org.apache.jena.rdf.model.Model model)
Maps an IRI string to an IRI term.static org.apache.jena.rdf.model.Resource
asIri(URI value, org.apache.jena.rdf.model.Model model)
Maps a URI to an IRI term.static org.apache.jena.rdf.model.Literal
asStringLiteral(String value, org.apache.jena.rdf.model.Model model)
Maps a string to a literal term.static org.apache.jena.rdf.model.Literal
asTypedLiteral(Boolean value, org.apache.jena.rdf.model.Model model)
Maps a boolean value to a literal node.static org.apache.jena.rdf.model.Literal
asTypedLiteral(Integer value, org.apache.jena.rdf.model.Model model)
Maps a integer value to a literal node.static org.apache.jena.rdf.model.Literal
asTypedLiteral(Instant value, org.apache.jena.rdf.model.Model model)
Maps a point in time to a literal term.static org.apache.jena.rdf.model.RDFNode
identity(org.apache.jena.rdf.model.RDFNode value, org.apache.jena.rdf.model.Model model)
Maps a term to itself.
-
-
-
Method Detail
-
asStringLiteral
public static org.apache.jena.rdf.model.Literal asStringLiteral(String value, org.apache.jena.rdf.model.Model model)
Maps a string to a literal term.- Parameters:
value
- the value to mapmodel
- the graph that serves as the context for creating the term- Returns:
- an xsd:string typed literal with the string as its lexical form
- Throws:
NullPointerException
- if the value is nullNullPointerException
- if the model is null
-
asIri
public static org.apache.jena.rdf.model.Resource asIri(String value, org.apache.jena.rdf.model.Model model)
Maps an IRI string to an IRI term.- Parameters:
value
- the value to mapmodel
- ignored- Returns:
- an IRI term with the string as its identifier
- Throws:
NullPointerException
- if the value is nullNullPointerException
- if the model is null
-
asIri
public static org.apache.jena.rdf.model.Resource asIri(URI value, org.apache.jena.rdf.model.Model model)
Maps a URI to an IRI term.- Parameters:
value
- the value to mapmodel
- ignored- Returns:
- an IRI term with the URI as its identifier
- Throws:
NullPointerException
- if the value is nullNullPointerException
- if the model is null
-
asTypedLiteral
public static org.apache.jena.rdf.model.Literal asTypedLiteral(Instant value, org.apache.jena.rdf.model.Model model)
Maps a point in time to a literal term.- Parameters:
value
- the value to mapmodel
- ignored- Returns:
- an xsd:dateTime typed literal term with the point in time as its lexical value
- Throws:
NullPointerException
- if the value is nullNullPointerException
- if the model is null
-
asTypedLiteral
public static org.apache.jena.rdf.model.Literal asTypedLiteral(Boolean value, org.apache.jena.rdf.model.Model model)
Maps a boolean value to a literal node.- Parameters:
value
- the value to mapmodel
- the graph used to create the node- Returns:
- an xsd:boolean typed literal node with the boolean value as its lexical value
- Throws:
NullPointerException
- if the value is nullNullPointerException
- if the model is null
-
asTypedLiteral
public static org.apache.jena.rdf.model.Literal asTypedLiteral(Integer value, org.apache.jena.rdf.model.Model model)
Maps a integer value to a literal node.- Parameters:
value
- the value to mapmodel
- the graph used to create the node- Returns:
- an xsd:int typed literal node with the integer value as its lexical value
- Throws:
NullPointerException
- if the value is nullNullPointerException
- if the model is null
-
identity
public static org.apache.jena.rdf.model.RDFNode identity(org.apache.jena.rdf.model.RDFNode value, org.apache.jena.rdf.model.Model model)
Maps a term to itself.- Parameters:
value
- the value to mapmodel
- ignored- Returns:
- the same term
- Throws:
NullPointerException
- if the value is nullNullPointerException
- if the model is null
-
-