Package org.fiware.mintaka.context
Class LdContextCache
java.lang.Object
org.fiware.mintaka.context.LdContextCache
Cache for ld context. Provides additional functionality to work with the context.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionexpandString
(String stringToExpand, List<URL> contextUrls) Expand the given string with the provided contexts.expandStrings
(List<String> stringsToExpand, List<URL> contextUrls) Expand all given attributes with the given contexts.com.apicatalog.jsonld.document.Document
getContextDocument
(Object contextURLs) Retrieve the context as a JsonDocumentgetContextFromURL
(URL url) Get context from the given url.getContextURLsFromLinkHeader
(String headerString) Extract the context urls from the link header.void
-
Constructor Details
-
LdContextCache
public LdContextCache()
-
-
Method Details
-
initDefaultContext
@PostConstruct public void initDefaultContext() -
getContextFromURL
Get context from the given url. Will be cached.- Parameters:
url
- - url to get the context from- Returns:
- the context
-
expandStrings
Expand all given attributes with the given contexts.- Parameters:
stringsToExpand
- - strings to be expandedcontextUrls
- - urls of contexts to be used for expansion- Returns:
- list of expanded attribute-ids
-
expandString
Expand the given string with the provided contexts.- Parameters:
stringToExpand
- - string to be expandedcontextUrls
- - urls of contexts to be used for expansion- Returns:
- the expanded attribute-id
-
getContextDocument
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
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
-