Interface JsonLdContext
- All Known Implementing Classes:
DummyJsonLdContext
,MappingJsonLdContext
,SerializationContext
public interface JsonLdContext
Represents the @context JSON-LD attribute.
-
Method Summary
Modifier and TypeMethodDescriptionReturns 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).default 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.
-
Method Details
-
registerTermMapping
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.- Parameters:
term
- Mapped termiri
- IRI to which the term is mapped
-
registerTermMapping
Registers the specified term mapping in this context.Compared to
registerTermMapping(String, String)
, this method allows registering more complex mapping like language containers or typed literals.- Parameters:
term
- Mapped termmappedNode
- Node to which the term is mapped
-
getTermMapping
Gets the mapping for the specified term (if it exists).- Parameters:
term
- Term to get mapping for- Returns:
- Optional mapping node
-
hasTermMapping
Checks whether this JSON-LD context contains mapping for the specified term.- Parameters:
term
- Term to search mapping for- Returns:
true
if a mapping is already defined for the term,false
otherwise
-
getMappedTerm
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.
- Parameters:
iri
- Identifier the term is mapped to- Returns:
- Optional mapped term, empty optional if there is no such term mapping
-
isCurrentEmpty
boolean isCurrentEmpty()Checks whether this particular JSON-LD context is empty.Term mapping inherited from any parent contexts is not considered.
- Returns:
true
if this context is empty,false
otherwise
-
getContextNode
ObjectNode getContextNode()Returns anObjectNode
representing this context.The result can thus be added to serialization output.
- Returns:
JsonNode
with registered mappings
-