public interface ShortnameService
A ShortnameService maps shortnames to full URIs so that classes and properties in web APIs can refer to them compactly and legally. A shortname should always be both a legal NCName and a legal Javascript variable name.
The shortname to URI mapping is unique but the URI to shortname is not, there is a preferred shortname for each URI but can also have non-preferred shortnames (e.g. with prefixes).
The shortnames are defined via annotations (api:label, rdfs:label) in either the API specification or a referenced vocabulary file. Where such labels are not available we fall back on local names, or prefixed-local names.
Derived from the original ShortnameService (which is now an implementation class, StandardShortnameService).
Modifier and Type | Interface and Description |
---|---|
static class |
ShortnameService.Util
Utilities on ShortnameService's.
|
Modifier and Type | Method and Description |
---|---|
Context |
asContext()
Answer a context object suitable for driving a JSON encoding.
|
com.hp.hpl.jena.rdf.model.Resource |
asResource(com.hp.hpl.jena.rdf.model.RDFNode r)
If r is a resource, answer r; if it is a literal with lexical form l,
answer normaliseResource(l); otherwise throw an API exception.
|
com.hp.hpl.jena.rdf.model.Resource |
asResource(String s)
Answer a resource with uri = expand(s).
|
Map<String,String> |
constructURItoShortnameMap(com.hp.hpl.jena.rdf.model.Model m,
com.hp.hpl.jena.shared.PrefixMapping pm)
Answer a freshly-constructed map from URIs to shortnames, based on
the shortnames declared to this ShortnameService.
|
String |
expand(String s)
Answer the full name (URI) corresponding to the short name s.
|
com.hp.hpl.jena.shared.PrefixMapping |
getPrefixes()
Return the prefix mapping that this shortname service is managing
|
ContextPropertyInfo |
getPropertyByName(String shortName)
Answer the property info record for the property with this shortname.
|
boolean |
isDatatype(String type)
Answer true iff the named type has been declared (or is by default)
to be a datatype (rather than an object type).
|
Context asContext()
Map<String,String> constructURItoShortnameMap(com.hp.hpl.jena.rdf.model.Model m, com.hp.hpl.jena.shared.PrefixMapping pm)
ContextPropertyInfo getPropertyByName(String shortName)
boolean isDatatype(String type)
com.hp.hpl.jena.rdf.model.Resource asResource(com.hp.hpl.jena.rdf.model.RDFNode r)
com.hp.hpl.jena.rdf.model.Resource asResource(String s)
com.hp.hpl.jena.shared.PrefixMapping getPrefixes()
Copyright © 2014. All Rights Reserved.