|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectinfo.sswap.http.rest.DefinitionFactoryBase
info.sswap.http.rest.TypeFactory
public class TypeFactory
A factory for complex types based on their JSON representation
Field Summary | |
---|---|
private static TypeFactory |
instance
The single instance of this class. |
private static java.util.Set<java.lang.String> |
NON_RESTRICTION_PROPERTIES
A set of URIs (as Strings) that represent all supported properties -- any other property occurrence, which not mentioned here is, will be treated as a restriction on that property. |
private static java.util.Set<java.lang.String> |
OWL_TYPES
|
Constructor Summary | |
---|---|
private |
TypeFactory()
A private constructor (singleton implementation) |
Method Summary | |
---|---|
void |
checkReservedVocabulary(java.lang.String typeURI)
|
void |
checkReservedVocabularyRef(java.lang.String typeURI)
|
private boolean |
containsOnlyRestrictions(Entity entity)
Checks whether the given JSON object contains only properties that encode restrictions. |
private java.util.Collection<info.sswap.api.model.SSWAPType> |
createRestrictions(info.sswap.api.model.SSWAPDocument document,
Entity jsonEntity)
Creates owl:Restrictions from a JSON object |
private void |
createRestrictions(info.sswap.api.model.SSWAPDocument document,
Entity jsonEntity,
java.util.List<info.sswap.api.model.SSWAPType> regularRestrictions,
java.util.List<info.sswap.api.model.SSWAPType> markerRestrictions)
|
private void |
createRestrictions(info.sswap.api.model.SSWAPDocument document,
info.sswap.api.model.SSWAPPredicate predicate,
Entity jsonEntity,
java.util.List<info.sswap.api.model.SSWAPType> regularRestrictions,
java.util.List<info.sswap.api.model.SSWAPType> markerRestrictions)
Creates restriction(s) for a single property, e.g., encoded as: "property" : { "owl:minCardinality" : 1^^"xsd:integer", "owl:allValuesFrom" : "map:Map", } (The example above will generate two restrictions) |
java.util.Collection<info.sswap.api.model.SSWAPType> |
createSubTypes(info.sswap.api.model.SSWAPDocument document,
Value value)
Creates types based on the JSON value description. |
info.sswap.api.model.SSWAPType |
createType(info.sswap.api.model.SSWAPDocument document,
Entity jsonType)
Creates a SSWAP type based on its JSON description |
info.sswap.api.model.SSWAPType |
createType(info.sswap.api.model.SSWAPDocument document,
Value value)
Creates a type based on its JSON value description. |
static TypeFactory |
get()
The getter for the singleton instance |
private void |
initializeAnonymousType(info.sswap.api.model.SSWAPType type,
Entity jsonType)
Initializes an anonymous type (that is not a restriction). |
private void |
initializeNamedType(info.sswap.api.model.SSWAPType type,
Entity jsonType)
Initializes a named type. |
private boolean |
isAnnotationPredicate(java.lang.String propertyName,
info.sswap.api.model.SSWAPDocument document)
|
Methods inherited from class info.sswap.http.rest.DefinitionFactoryBase |
---|
createURICollection, getString, getValuesAsLiteralCollection, getValuesAsPropertyValues, getValuesAsStringCollection |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final java.util.Set<java.lang.String> NON_RESTRICTION_PROPERTIES
private static final java.util.Set<java.lang.String> OWL_TYPES
private static TypeFactory instance
Constructor Detail |
---|
private TypeFactory()
Method Detail |
---|
public static TypeFactory get()
public info.sswap.api.model.SSWAPType createType(info.sswap.api.model.SSWAPDocument document, Entity jsonType) throws java.lang.IllegalArgumentException
document
- the SSWAPModel where the type should be createdjsonType
- the JSON description of the type
java.lang.IllegalArgumentException
private void initializeNamedType(info.sswap.api.model.SSWAPType type, Entity jsonType) throws java.lang.IllegalArgumentException
type
- the type to be initializedjsonType
- the JSON structure describing the named type
java.lang.IllegalArgumentException
private void initializeAnonymousType(info.sswap.api.model.SSWAPType type, Entity jsonType) throws java.lang.IllegalArgumentException
type
- the anonymous type being initializedjsonType
- JSON describing the type
java.lang.IllegalArgumentException
private java.util.Collection<info.sswap.api.model.SSWAPType> createRestrictions(info.sswap.api.model.SSWAPDocument document, Entity jsonEntity) throws java.lang.IllegalArgumentException
document
- the SSWAPDocument which will hold the created restrictionsjsonEntity
- the JSON object
java.lang.IllegalArgumentException
private void createRestrictions(info.sswap.api.model.SSWAPDocument document, Entity jsonEntity, java.util.List<info.sswap.api.model.SSWAPType> regularRestrictions, java.util.List<info.sswap.api.model.SSWAPType> markerRestrictions) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
private void createRestrictions(info.sswap.api.model.SSWAPDocument document, info.sswap.api.model.SSWAPPredicate predicate, Entity jsonEntity, java.util.List<info.sswap.api.model.SSWAPType> regularRestrictions, java.util.List<info.sswap.api.model.SSWAPType> markerRestrictions) throws java.lang.IllegalArgumentException
document
- the model where the restrictions will be storedpredicate
- the property for which the restrictions are to be encodedjsonEntity
- the JSON object for that propertyregularRestrictions
- a list to which the regular restrictions will be added (i.e., the restrictions that actually restrict the type)markerRestrictions
- a list to which marker restrictions will be added (i.e., the restrictions that are essentially equivalent to owl:Thing,
and therefore do not restrict the type at all; yet they mark certain properties as being optional.)
java.lang.IllegalArgumentException
public info.sswap.api.model.SSWAPType createType(info.sswap.api.model.SSWAPDocument document, Value value) throws java.lang.IllegalArgumentException
document
- the SSWAPDocument where the type should be createdvalue
- a JSON value encoding a (hopefully) single type
java.lang.IllegalArgumentException
- if either 0 or more than 1 result is foundpublic java.util.Collection<info.sswap.api.model.SSWAPType> createSubTypes(info.sswap.api.model.SSWAPDocument document, Value value) throws java.lang.IllegalArgumentException
document
- the SSWAPDocument where the types should be createdvalue
- the value describing the types
java.lang.IllegalArgumentException
- on an invalid URIprivate boolean containsOnlyRestrictions(Entity entity)
entity
- the entity to be checked
public void checkReservedVocabularyRef(java.lang.String typeURI) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
public void checkReservedVocabulary(java.lang.String typeURI) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
private boolean isAnnotationPredicate(java.lang.String propertyName, info.sswap.api.model.SSWAPDocument document)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |