Package com.github.jsonldjava.core
Class RDFDataset
- All Implemented Interfaces:
Serializable
,Cloneable
,Map<String,
,Object> SequencedMap<String,
Object>
Starting to migrate away from using plain java Maps as the internal RDF
dataset store. Currently each item just wraps a Map based on the old format
so everything doesn't break. Will phase this out once everything is using the
new format.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
static class
static class
static class
static class
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,
V>, AbstractMap.SimpleImmutableEntry<K, V> -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate JsonLdApi
private static final RDFDataset.Node
private static final RDFDataset.Node
private static final Pattern
private static final Pattern
private static final RDFDataset.Node
private static final long
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a triple to the specified graph of this datasetvoid
Adds a triple to the specified graph of this datasetvoid
Adds a triple to the default graph of this datasetvoid
Adds a triple to the @default graph of this datasetvoid
clears all the namespaces in this datasetReturns a valid context containing any namespaces setgetNamespace
(String ns) (package private) void
graphToRDF
(String graphName, Map<String, Object> graph) Creates an array of RDF triples for the given graph.private RDFDataset.Node
objectToRDF
(Object item) Converts a JSON-LD value object to an RDF literal or a JSON-LD string or node object to an RDF resource.void
parseContext
(Object contextLike) parses a context object and sets any namespaces found within itvoid
setNamespace
(String ns, String prefix) Methods inherited from class java.util.LinkedHashMap
clear, containsValue, entrySet, forEach, get, getOrDefault, keySet, newLinkedHashMap, putFirst, putLast, removeEldestEntry, replaceAll, reversed, sequencedEntrySet, sequencedKeySet, sequencedValues, values
Methods inherited from class java.util.HashMap
clone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, newHashMap, put, putAll, putIfAbsent, remove, remove, replace, replace, size
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, containsKey, equals, hashCode, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, size
Methods inherited from interface java.util.SequencedMap
firstEntry, lastEntry, pollFirstEntry, pollLastEntry
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
PATTERN_INTEGER
-
PATTERN_DOUBLE
-
first
-
rest
-
nil
-
context
-
api
-
-
Constructor Details
-
RDFDataset
public RDFDataset() -
RDFDataset
-
-
Method Details
-
setNamespace
-
getNamespace
-
clearNamespaces
public void clearNamespaces()clears all the namespaces in this dataset -
getNamespaces
-
getContext
Returns a valid context containing any namespaces set- Returns:
- The context map
-
parseContext
parses a context object and sets any namespaces found within it- Parameters:
contextLike
- The context to parse- Throws:
JsonLdError
- If the context can't be parsed
-
addTriple
public void addTriple(String subject, String predicate, String value, String datatype, String language) Adds a triple to the @default graph of this dataset- Parameters:
subject
- the subject for the triplepredicate
- the predicate for the triplevalue
- the value of the literal object for the tripledatatype
- the datatype of the literal object for the triple (null values will default to xsd:string)language
- the language of the literal object for the triple (or null)
-
addQuad
public void addQuad(String s, String p, String value, String datatype, String language, String graph) Adds a triple to the specified graph of this dataset- Parameters:
s
- the subject for the triplep
- the predicate for the triplevalue
- the value of the literal object for the tripledatatype
- the datatype of the literal object for the triple (null values will default to xsd:string)language
- the language of the literal object for the triple (or null)graph
- the graph to add this triple to
-
addTriple
Adds a triple to the default graph of this dataset- Parameters:
subject
- the subject for the triplepredicate
- the predicate for the tripleobject
- the object for the triple
-
addQuad
Adds a triple to the specified graph of this dataset- Parameters:
subject
- the subject for the triplepredicate
- the predicate for the tripleobject
- the object for the triplegraph
- the graph to add this triple to
-
graphToRDF
Creates an array of RDF triples for the given graph.- Parameters:
graphName
- The graph URIgraph
- the graph to create RDF triples for.
-
objectToRDF
Converts a JSON-LD value object to an RDF literal or a JSON-LD string or node object to an RDF resource.- Parameters:
item
- the JSON-LD value or node object.- Returns:
- the RDF literal or RDF resource.
-
graphNames
-
getQuads
-