Class DummyJsonLdContext
java.lang.Object
cz.cvut.kbss.jsonld.serialization.context.DummyJsonLdContext
- All Implemented Interfaces:
JsonLdContext
,JsonLdContextFactory
JSON-LD that does nothing.
It can be used in serialization that does not create a JSON-LD context (e.g., expanded, context-less compacted).
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCreates a root JSON-LD context.createJsonLdContext
(JsonLdContext parent) Creates a JSON-LD context with the specified parent context.Returns anObjectNode
representing this context.getMappedTerm
(String iri) Gets the term mapped to the specified identifier (if it exists).getTermMapping
(String term) Gets the mapping for the specified term (if it exists).boolean
hasTermMapping
(String term) Checks whether this JSON-LD context contains mapping for the specified term.boolean
Checks whether this particular JSON-LD context is empty.void
registerTermMapping
(String term, ObjectNode mappedNode) Registers the specified term mapping in this context.void
registerTermMapping
(String term, String iri) Registers the specified term mapping in this context.
-
Field Details
-
INSTANCE
-
-
Constructor Details
-
DummyJsonLdContext
public DummyJsonLdContext()
-
-
Method Details
-
registerTermMapping
Description copied from interface:JsonLdContext
Registers the specified term mapping in this context.Typically, the
term
would be Java attribute (field) name andiri
would be the IRI to which this field is mapped.- Specified by:
registerTermMapping
in interfaceJsonLdContext
- Parameters:
term
- Mapped termiri
- IRI to which the term is mapped
-
registerTermMapping
Description copied from interface:JsonLdContext
Registers the specified term mapping in this context.Compared to
JsonLdContext.registerTermMapping(String, String)
, this method allows registering more complex mapping like language containers or typed literals.- Specified by:
registerTermMapping
in interfaceJsonLdContext
- Parameters:
term
- Mapped termmappedNode
- Node to which the term is mapped
-
getTermMapping
Description copied from interface:JsonLdContext
Gets the mapping for the specified term (if it exists).- Specified by:
getTermMapping
in interfaceJsonLdContext
- Parameters:
term
- Term to get mapping for- Returns:
- Optional mapping node
-
hasTermMapping
Description copied from interface:JsonLdContext
Checks whether this JSON-LD context contains mapping for the specified term.- Specified by:
hasTermMapping
in interfaceJsonLdContext
- Parameters:
term
- Term to search mapping for- Returns:
true
if a mapping is already defined for the term,false
otherwise
-
getMappedTerm
Description copied from interface:JsonLdContext
Gets the term mapped to the specified identifier (if it exists).This method checks term mapping in this context and finds a term that is mapped to the specified identifier.
- Specified by:
getMappedTerm
in interfaceJsonLdContext
- Parameters:
iri
- Identifier the term is mapped to- Returns:
- Optional mapped term, empty optional if there is no such term mapping
-
isCurrentEmpty
public boolean isCurrentEmpty()Description copied from interface:JsonLdContext
Checks whether this particular JSON-LD context is empty.Term mapping inherited from any parent contexts is not considered.
- Specified by:
isCurrentEmpty
in interfaceJsonLdContext
- Returns:
true
if this context is empty,false
otherwise
-
getContextNode
Description copied from interface:JsonLdContext
Returns anObjectNode
representing this context.The result can thus be added to serialization output.
- Specified by:
getContextNode
in interfaceJsonLdContext
- Returns:
JsonNode
with registered mappings
-
createJsonLdContext
Description copied from interface:JsonLdContextFactory
Creates a root JSON-LD context.- Specified by:
createJsonLdContext
in interfaceJsonLdContextFactory
- Returns:
- New JSON-LD context
-
createJsonLdContext
Description copied from interface:JsonLdContextFactory
Creates a JSON-LD context with the specified parent context.- Specified by:
createJsonLdContext
in interfaceJsonLdContextFactory
- Parameters:
parent
- Parent JSON-LD context from which term mapping in inherited- Returns:
- New JSON-LD context
-