Skip to content

Method: registerTermMapping(String, String)

1: package cz.cvut.kbss.jsonld.serialization.context;
2:
3: import cz.cvut.kbss.jsonld.JsonLd;
4: import cz.cvut.kbss.jsonld.serialization.model.JsonNode;
5: import cz.cvut.kbss.jsonld.serialization.model.ObjectNode;
6:
7: import java.util.Optional;
8:
9: /**
10: * JSON-LD that does nothing.
11: * <p>
12: * It can be used in serialization that does not create a JSON-LD context (e.g., expanded, context-less compacted).
13: */
14: public class DummyJsonLdContext implements JsonLdContext, JsonLdContextFactory {
15:
16: public static final DummyJsonLdContext INSTANCE = new DummyJsonLdContext();
17:
18: @Override
19: public void registerTermMapping(String term, String iri) {
20: // Do nothing
21: }
22:
23: @Override
24: public void registerTermMapping(String term, ObjectNode mappedNode) {
25: // Do nothing
26: }
27:
28: @Override
29: public Optional<JsonNode> getTermMapping(String term) {
30: return Optional.empty();
31: }
32:
33: @Override
34: public boolean hasTermMapping(String term) {
35: return false;
36: }
37:
38: @Override
39: public Optional<String> getMappedTerm(String iri) {
40: return Optional.empty();
41: }
42:
43: @Override
44: public boolean isCurrentEmpty() {
45: return true;
46: }
47:
48: @Override
49: public ObjectNode getContextNode() {
50: return new ObjectNode(JsonLd.CONTEXT);
51: }
52:
53: @Override
54: public JsonLdContext createJsonLdContext() {
55: return INSTANCE;
56: }
57:
58: @Override
59: public JsonLdContext createJsonLdContext(JsonLdContext parent) {
60: return INSTANCE;
61: }
62: }