public abstract class ManagedIndividual extends FinalizedResource
Conventions to be followed by all subclasses in the class hierarchy rooted at
ManagedIndividual
are:
public static final
field of type
String
with the name MY_URI
initialized by the
URI of the ontology class they represent.
getClassURI()
which usually just
returns MY_URI
.
Ontology
and registering this at the OntologyManagement
.
Resource.isClosedCollection(String)
and setProperty(String, Object)
.
Please read the comments below on these methods as well as comments provided
within Resource
.
Modifier and Type | Field and Description |
---|---|
static String |
MY_URI
The URI of the ontology class.
|
static String |
OWL_NAMESPACE
URI namespace for OWL.
|
static String |
TYPE_OWL_INDIVIDUAL
Definition of owl:Individual.
|
static String |
TYPE_OWL_THING
Definition of owl:Thing.
|
ANON_URI_PREFIX, blockAddingTypes, isXMLLiteral, NAMESPACE_PREFIX, ns_delim_index, PROP_INVOLVED_HUMAN_USER, PROP_RDF_FIRST, PROP_RDF_REST, PROP_RDF_TYPE, PROP_RDFS_COMMENT, PROP_RDFS_LABEL, PROP_SERIALIZATION_FULL, PROP_SERIALIZATION_OPTIONAL, PROP_SERIALIZATION_REDUCED, PROP_SERIALIZATION_UNDEFINED, props, RDF_EMPTY_LIST, RDF_NAMESPACE, RDFS_NAMESPACE, SERVICE_NAMESPACE, TYPE_RDF_LIST, TYPE_RDFS_CLASS, uri, VOCABULARY_NAMESPACE
Modifier | Constructor and Description |
---|---|
protected |
ManagedIndividual()
The constructor for (de-)serializers.
|
protected |
ManagedIndividual(String uri)
Creates an instance of ManagedIndividual with a given URI.
|
protected |
ManagedIndividual(String uriPrefix,
int numProps)
Creates an instance of ManagedIndividual with a URI that is created by
appending a unique ID to the given 'uriPrefix'.
|
Modifier and Type | Method and Description |
---|---|
static boolean |
checkCompatibility(String supertypeURI,
String subtypeURI)
Assuming that the given parameters are the URIs of two registered classes
or datatypes, checks if the second type is derived from the first one.
|
static boolean |
checkMembership(String typeURI,
Object value)
Checks if the given value object is an instance of the type with the
given URI.
|
Resource |
copy(boolean isXMLLiteral)
Create a copy of this resource.
|
Resource |
deepCopy()
Create a deep copy of this ManagedIndividual, i.e.
|
static MergedRestriction |
getClassRestrictionsOnProperty(String classURI,
String propURI)
Returns the restrictions that apply to the given property in the context
of the class with the given URI.
|
String |
getClassURI()
Get the class URI for this ManagedIndividual.
|
static ManagedIndividual |
getInstance(String classURI,
String instanceURI)
Returns an instance of a registered subclass selected by the given class
URI.
|
static Vector |
getNonAbstractSuperClasses(ManagedIndividual indi)
Deprecated.
|
static String[] |
getNonabstractSuperClasses(String classURI)
For a given class URI get the set of URIs for all super classes which are
instanceable (which are not abstract)
|
OntClassInfo |
getOntClassInfo()
Get the ontological information for this individual.
|
abstract int |
getPropSerializationType(String propURI)
Answers if the given property has to be considered when serializing this
individual in a minimized way, and if not ignore-able, whether its value
should be presented in its full form or can be reduced.
|
static String |
getTypeURI(Object o)
Get the class URI for a given object.
|
static boolean |
isRegisteredClassURI(String classURI)
Checks if a registered class with the given URI can be found.
|
boolean |
isWellFormed()
Returns true, if the state of the resource is valid, otherwise false.
|
boolean |
setProperty(String propURI,
Object value)
The default implementation that will set a property if it was not set
before and the given value complies with the restrictions defined by this
class of managed individuals for the given propURI.
|
boolean |
setPropertyPathFromOffset(String[] propPath,
int fromIndex,
Object value,
boolean force)
Change or add the Resource at the end of the given property path to the
given value.
|
static Resource |
toManagedIndividual(String classURI,
Resource pr)
For a given
Resource , create a new
instance of ManagedIndividual with the given class URI and copy all
properties from the Resource object to this new ManagedIndividual. |
addType, getLocalName, getNamespace, getProperty, getPropertyURIs, getType, getTypes, getURI, hasQualifiedName, isAnon, numberOfProperties
addMultiLangProp, asList, asList, asRDFList, changeProperty, equals, generateAnonURI, getDefaultLang, getFilename, getMultiLangProp, getOrConstructLabel, getOrConstructLabel, getResource, getResourceComment, getResourceLabel, getResourceLabel, getStaticFieldValue, hashCode, hasProperty, isAnon, isBlockingAddingTypes, isClosedCollection, isQualifiedName, literal, representsQualifiedURI, serializesAsXMLLiteral, setPropertyPath, setPropertyPath, setResourceComment, setResourceLabel, toString, toStringRecursive, toStringRecursive, unliteral
public static final String OWL_NAMESPACE
public static final String TYPE_OWL_INDIVIDUAL
public static final String TYPE_OWL_THING
public static final String MY_URI
protected ManagedIndividual()
protected ManagedIndividual(String uri)
uri
- The URI.protected ManagedIndividual(String uriPrefix, int numProps)
uriPrefix
- Prefix of the URI.numProps
- Not used.Resource.Resource(String, int)
public static final boolean checkCompatibility(String supertypeURI, String subtypeURI)
supertypeURI
- The URI of the class that is assumed to be the super class of
the second parameter.subtypeURI
- The URI of the class that needs to be checked whether it is
derived from the first parameter.public static final boolean checkMembership(String typeURI, Object value)
typeURI
- The URI of the class that is assumed to be the super class of
the second parameter.value
- An instance of the class that needs to be checked whether it
is derived from the first parameter.public static final MergedRestriction getClassRestrictionsOnProperty(String classURI, String propURI)
classURI
- URI of the class for which the restrictions apply.propURI
- URI of the property.public static final ManagedIndividual getInstance(String classURI, String instanceURI)
@Deprecated public static Vector getNonAbstractSuperClasses(ManagedIndividual indi)
public static final String[] getNonabstractSuperClasses(String classURI)
classURI
- The URI for which to get the super classes.public static final String getTypeURI(Object o)
List
, the class URI for the first object from this list
is returned.o
- The object for which to return the class URI.public static final boolean isRegisteredClassURI(String classURI)
public static Resource toManagedIndividual(String classURI, Resource pr)
Resource
, create a new
instance of ManagedIndividual with the given class URI and copy all
properties from the Resource object to this new ManagedIndividual.classURI
- The class URI of the ManagedIndividual.pr
- The Resource which needs to be copied.public Resource copy(boolean isXMLLiteral)
copy
in class Resource
ManagedIndividual
, i.e. a subclass of it.Resource.copy(boolean)
public Resource deepCopy()
public String getClassURI()
public abstract int getPropSerializationType(String propURI)
Resource.PROP_SERIALIZATION_OPTIONAL
,
Resource.PROP_SERIALIZATION_REDUCED
, or Resource.PROP_SERIALIZATION_FULL
.
It can be assumed that the given property is one of those returned by
FinalizedResource.getPropertyURIs()
. Decision criterion should be if the value of
this property is absolutely necessary when this resource is being sent to
a remote node. If the subclass rates it as unlikely that the receiver
side would need this info, the answer should be
PROP_SERIALIZATION_OPTIONAL
in favor of lower communication
traffic and higher performance even at risk of a possible additional
query on the receiver side for fetching this info. With the same
rationale, if a property should be included in the process of
serialization, it is preferable to include it in a reduced form; in this
case the return value should be PROP_SERIALIZATION_REDUCED
,
otherwise PROP_SERIALIZATION_FULL
can be returned.getPropSerializationType
in class Resource
public boolean isWellFormed()
Resource
Subclasses should overwrite this methods as the default implementation returns always true.
isWellFormed
in class Resource
public boolean setProperty(String propURI, Object value)
setProperty
in class Resource
public boolean setPropertyPathFromOffset(String[] propPath, int fromIndex, Object value, boolean force)
Resource
setPropertyPathFromOffset
in class Resource
propPath
- The set of properties defining the path through the RDF graph.fromIndex
- The property path is evaluated from this index on; if
'fromIndex' is greater than zero, then some entries at the
beginning are just ignored.value
- The value to set at the end of the property pathforce
- Determines if setting the value has to be forced. If true,
Resource.changeProperty(String, Object)
is called, otherwise
Resource.setProperty(String, Object)
is called.public OntClassInfo getOntClassInfo()
Copyright © 2018 universAAL Consortium. All rights reserved.