Class LdContextCache

java.lang.Object
org.fiware.mintaka.context.LdContextCache

@Context @CacheConfig("contexts") public class LdContextCache extends Object
Cache for ld context. Provides additional functionality to work with the context.
  • Constructor Details

    • LdContextCache

      public LdContextCache()
  • Method Details

    • initDefaultContext

      @PostConstruct public void initDefaultContext()
    • getContextFromURL

      @Cacheable public Object getContextFromURL(URL url)
      Get context from the given url. Will be cached.
      Parameters:
      url - - url to get the context from
      Returns:
      the context
    • expandStrings

      public List<String> expandStrings(List<String> stringsToExpand, List<URL> contextUrls)
      Expand all given attributes with the given contexts.
      Parameters:
      stringsToExpand - - strings to be expanded
      contextUrls - - urls of contexts to be used for expansion
      Returns:
      list of expanded attribute-ids
    • expandString

      public String expandString(String stringToExpand, List<URL> contextUrls)
      Expand the given string with the provided contexts.
      Parameters:
      stringToExpand - - string to be expanded
      contextUrls - - urls of contexts to be used for expansion
      Returns:
      the expanded attribute-id
    • getContextDocument

      public com.apicatalog.jsonld.document.Document getContextDocument(Object contextURLs)
      Retrieve the context as a JsonDocument
      Parameters:
      contextURLs - - either be a (URL)String, a URL or a list of urls/urlstrings.
      Returns:
      the context
    • getContextURLsFromLinkHeader

      public List<URL> getContextURLsFromLinkHeader(String headerString)
      Extract the context urls from the link header. CORE_CONTEXT will be automatically added.
      Parameters:
      headerString - - content of the link header
      Returns:
      list of context urls, will either be only the core context or the core-context + the header context