@@ -31,7 +31,7 @@ public class RoCrateMetadataContext implements CrateMetadataContext {
3131 protected static final String DEFAULT_CONTEXT_LOCATION = "default_context/version1.1.json" ;
3232 protected static JsonNode defaultContext = null ;
3333
34- protected final Set <String > url = new HashSet <>();
34+ protected final Set <String > urls = new HashSet <>();
3535 protected final HashMap <String , String > contextMap = new HashMap <>();
3636 // we need to keep the ones that are no coming from url
3737 // for the final representation
@@ -89,7 +89,7 @@ public ObjectNode getContextJsonEntity() {
8989 ArrayNode array = objectMapper .createArrayNode ();
9090 ObjectNode jsonNode = objectMapper .createObjectNode ();
9191 ObjectNode finalNode = objectMapper .createObjectNode ();
92- for (String e : url ) {
92+ for (String e : urls ) {
9393 array .add (e );
9494 }
9595 for (Map .Entry <String , String > s : other .entrySet ()) {
@@ -156,7 +156,7 @@ public boolean checkEntity(AbstractEntity entity) {
156156
157157 @ Override
158158 public void addToContextFromUrl (String url ) {
159- this .url .add (url );
159+ this .urls .add (url );
160160
161161 ObjectMapper objectMapper = MyObjectMapper .getMapper ();
162162
@@ -200,6 +200,29 @@ public void addToContext(String key, String value) {
200200 this .other .put (key , value );
201201 }
202202
203+ @ Override
204+ public String getValueOf (String key ) {
205+ return Optional .ofNullable (this .contextMap .get (key ))
206+ .orElseGet (() -> this .other .get (key ));
207+ }
208+
209+ @ Override
210+ public Set <String > getKeys () {
211+ List <String > merged = new ArrayList <>();
212+ merged .addAll (this .contextMap .keySet ());
213+ merged .addAll (this .other .keySet ());
214+ return Set .copyOf (merged );
215+ }
216+
217+ @ Override
218+ public Map <String , String > getPairs () {
219+ Map <String , String > merged = new HashMap <>();
220+ merged .putAll (this .contextMap );
221+ merged .putAll (this .other );
222+ return Map .copyOf (merged );
223+ }
224+
225+
203226 @ Override
204227 public void deleteValuePairFromContext (String key ) {
205228 this .contextMap .remove (key );
@@ -208,7 +231,7 @@ public void deleteValuePairFromContext(String key) {
208231
209232 @ Override
210233 public void deleteUrlFromContext (String url ) {
211- this .url .remove (url );
234+ this .urls .remove (url );
212235 }
213236
214237}
0 commit comments