Class Context

All Implemented Interfaces:
Serializable, Cloneable, Map<String,Object>, SequencedMap<String,Object>

public class Context extends LinkedHashMap<String,Object>
A helper class which still stores all the values in a map but gives member variables easily access certain keys
Author:
tristan
See Also:
  • Field Details

  • Constructor Details

  • Method Details

    • compactValue

      public Object compactValue(String activeProperty, Map<String,Object> value)
      Value Compaction Algorithm http://json-ld.org/spec/latest/json-ld-api/#value-compaction
      Parameters:
      activeProperty - The Active Property
      value - The value to compact
      Returns:
      The compacted value
    • parse

      public Context parse(Object localContext, List<String> remoteContexts) throws JsonLdError
      Context Processing Algorithm http://json-ld.org/spec/latest/json-ld-api/#context-processing-algorithms
      Parameters:
      localContext - The Local Context object.
      remoteContexts - The list of Strings denoting the remote Context URLs.
      Returns:
      The parsed and merged Context.
      Throws:
      JsonLdError - If there is an error parsing the contexts.
    • parse

      public Context parse(Object localContext) throws JsonLdError
      Throws:
      JsonLdError
    • _iriCompactionStep5point4

      public static String _iriCompactionStep5point4(String iri, Object value, String compactIRI, String candidate, Map<String,Object> termDefinitions)
    • getPrefixes

      public Map<String,String> getPrefixes(boolean onlyCommonPrefixes)
      Return a map of potential RDF prefixes based on the JSON-LD Term Definitions in this context.

      No guarantees of the prefixes are given, beyond that it will not contain ":".

      Parameters:
      onlyCommonPrefixes - If true, the result will not include "not so useful" prefixes, such as "term1": "http://example.com/term1", e.g. all IRIs will end with "/" or "#". If false, all potential prefixes are returned.
      Returns:
      A map from prefix string to IRI string
    • clone

      public Context clone()
      Overrides:
      clone in class HashMap<String,Object>
    • getInverse

      public Map<String,Object> getInverse()
      Inverse Context Creation http://json-ld.org/spec/latest/json-ld-api/#inverse-context-creation Generates an inverse context for use in the compaction algorithm, if not already generated for the given active context.
      Returns:
      the inverse context.
    • getContainer

      public String getContainer(String property)
      Retrieve container mapping.
      Parameters:
      property - The Property to get a container mapping for.
      Returns:
      The container mapping if any, else null
    • isReverseProperty

      public Boolean isReverseProperty(String property)
    • getTypeMapping

      public String getTypeMapping(String property)
    • getLanguageMapping

      public String getLanguageMapping(String property)
    • expandValue

      public Object expandValue(String activeProperty, Object value) throws JsonLdError
      Throws:
      JsonLdError
    • serialize

      @Deprecated public Map<String,Object> serialize()
      Deprecated.