org.universAAL.middleware.rdf
Class RDFClassInfo

Package class diagram package RDFClassInfo
java.lang.Object
  extended by org.universAAL.middleware.rdf.Resource
      extended by org.universAAL.middleware.rdf.FinalizedResource
          extended by org.universAAL.middleware.rdf.RDFClassInfo
Direct Known Subclasses:
OntClassInfo

public class RDFClassInfo
extends FinalizedResource

Definition of an RDF class. The creation is separated from the usage; for every RDFClassInfo there is exactly one RDFClassInfoSetup where all the characteristics of this class are defined. To create a new RDFClassInfo, define a subclass of Ontology and overwrite the Ontology.create() method.

Author:
Carsten Stockloew
See Also:
RDFClassInfoSetup, OntClassInfo, OntClassInfoSetup

Nested Class Summary
protected  class RDFClassInfo.PrivateRDFSetup
          Implementation of the setup interface.
 
Field Summary
protected  ArrayList combinedSuperClasses
          The combined list of all super classes as set in the RDF graph (contains named super classes and restrictions).
protected  ResourceFactory factory
          The factory to create new instances of this class.
protected  int factoryIndex
          Factory index to be given to the ResourceFactory to create new instances of this class.
protected  HashMap instances
          Repository of all known (non-anonymous) instances.
protected  boolean locked
          Determines whether this class is locked.
protected  HashSet namedSuperClasses
          The set of URIs of all super classes.
protected  Ontology ont
          The Ontology which defines or extends this class.
protected  RDFClassInfo.PrivateRDFSetup rdfsetup
          The setup interface.
protected  ArrayList superClasses
          The set of super classes.
 
Fields inherited from class org.universAAL.middleware.rdf.Resource
ANON_URI_PREFIX, blockAddingTypes, isXMLLiteral, ns_delim_index, 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, PROP_uAAL_INVOLVED_HUMAN_USER, props, RDF_EMPTY_LIST, RDF_NAMESPACE, RDFS_NAMESPACE, TYPE_RDF_LIST, TYPE_RDFS_CLASS, uAAL_NAMESPACE_PREFIX, uAAL_SERVICE_NAMESPACE, uAAL_VOCABULARY_NAMESPACE, uri
 
Constructor Summary
protected RDFClassInfo(String classURI, Ontology ont, ResourceFactory factory, int factoryIndex)
          Create a new RDF Class.
 
Method Summary
static RDFClassInfoSetup create(String classURI, Ontology ont, ResourceFactory factory, int factoryIndex)
          Create a new RDF Class.
 ResourceFactory getFactory()
          Get the factory.
 int getFactoryIndex()
          Get the factory index.
 Resource getInstanceByURI(String uri)
          Get a specific registered instance of this class.
 Resource[] getInstances()
          Get the set of all registered instances of this class.
 String[] getNamedSuperClasses(boolean inherited, boolean includeAbstractClasses)
          Get the set of URIs of all named super classes.
 TypeExpression[] getSuperClasses()
          Get the set of all non-named super classes.
 boolean hasSuperClass(String classURI, boolean inherited)
          Determines whether the given class is a super class of this class.
 boolean isAbstract()
          Determines whether this class is an abstract class.
 boolean isClosedCollection(String propURI)
          Returns true if the value of the given property should be treated as an rdf:List.
 void lock()
          Lock this instance.
 
Methods inherited from class org.universAAL.middleware.rdf.FinalizedResource
addType, getLocalName, getNamespace, getProperty, getPropertyURIs, getType, getTypes, getURI, hasQualifiedName, isAnon, numberOfProperties
 
Methods inherited from class org.universAAL.middleware.rdf.Resource
addMultiLangProp, asList, asList, asRDFList, changeProperty, copy, deepCopy, equals, generateAnonURI, getDefaultLang, getFilename, getMultiLangProp, getOrConstructLabel, getPropSerializationType, getResource, getResourceComment, getResourceLabel, getStaticFieldValue, hashCode, hasProperty, isAnon, isBlockingAddingTypes, isQualifiedName, isWellFormed, literal, representsQualifiedURI, serializesAsXMLLiteral, setProperty, setPropertyPath, setPropertyPath, setPropertyPathFromOffset, setResourceComment, setResourceLabel, toString, toStringRecursive, toStringRecursive, unliteral
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

namedSuperClasses

protected volatile HashSet namedSuperClasses
The set of URIs of all super classes.


instances

protected HashMap instances
Repository of all known (non-anonymous) instances. It maps the URI of the instance to the instance itself.


combinedSuperClasses

protected volatile ArrayList combinedSuperClasses
The combined list of all super classes as set in the RDF graph (contains named super classes and restrictions).


superClasses

protected ArrayList superClasses
The set of super classes. Members are instances of TypeExpression .


factory

protected ResourceFactory factory
The factory to create new instances of this class.


factoryIndex

protected int factoryIndex
Factory index to be given to the ResourceFactory to create new instances of this class.


ont

protected Ontology ont
The Ontology which defines or extends this class.


locked

protected boolean locked
Determines whether this class is locked. If it is locked, no new information can be stored here.


rdfsetup

protected RDFClassInfo.PrivateRDFSetup rdfsetup
The setup interface.

Constructor Detail

RDFClassInfo

protected RDFClassInfo(String classURI,
                       Ontology ont,
                       ResourceFactory factory,
                       int factoryIndex)
Create a new RDF Class.

Parameters:
classURI - The URI of the class.
ont - The Ontology that creates this instance.
factory - A factory to create new instances; it is null iff the class is abstract.
factoryIndex - An index to be given to the factory. If the factory is null, this parameter is ignored.
Method Detail

create

public static RDFClassInfoSetup create(String classURI,
                                       Ontology ont,
                                       ResourceFactory factory,
                                       int factoryIndex)
Create a new RDF Class. This method can only be called from an Ontology.

Parameters:
classURI - The URI of the class.
ont - The Ontology that creates this instance.
factory - A factory to create new instances; it is null iff the class is abstract.
factoryIndex - An index to be given to the factory. If the factory is null, this parameter is ignored.
Returns:
The setup interface to set all information of this class.

isAbstract

public boolean isAbstract()
Determines whether this class is an abstract class. It is an abstract class iff the factory is not set.

Returns:
true, if this is an abstract class.

getFactory

public ResourceFactory getFactory()
Get the factory.

See Also:
ResourceFactory

getFactoryIndex

public int getFactoryIndex()
Get the factory index.

See Also:
ResourceFactory

hasSuperClass

public boolean hasSuperClass(String classURI,
                             boolean inherited)
Determines whether the given class is a super class of this class. If inherited is false, then only direct super classes are considered.

Parameters:
classURI - The URI of the super class.
inherited - false, iff only direct super classes should be considered.
Returns:
true, if the given class is a super class of this class.

getNamedSuperClasses

public String[] getNamedSuperClasses(boolean inherited,
                                     boolean includeAbstractClasses)
Get the set of URIs of all named super classes.

Parameters:
inherited - false, iff only direct super classes should be returned.
includeAbstractClasses - true, iff abstract classes should be returned.
Returns:
The set of URIs of all named super classes.

getSuperClasses

public TypeExpression[] getSuperClasses()
Get the set of all non-named super classes.


getInstances

public Resource[] getInstances()
Get the set of all registered instances of this class. To add new instances, call RDFClassInfoSetup.addInstance(Resource)


getInstanceByURI

public Resource getInstanceByURI(String uri)
Get a specific registered instance of this class. To add new instances, call RDFClassInfoSetup.addInstance(Resource)

Parameters:
uri - The URI of the instance.
Returns:
The instance, if registered.

lock

public void lock()
Lock this instance. After it is locked, no changes can be made. The class is automatically locked when the Ontology that defines the class is registered at the OntologyManagement.


isClosedCollection

public boolean isClosedCollection(String propURI)
Description copied from class: Resource
Returns true if the value of the given property should be treated as an rdf:List. Serializers can use this to determine if a multi-valued property should be serialized using the concept of rdf:List or the property should appear as often as the number of values assigned to the property. The default behavior is that a property associated with an instance of List is assumed to be a closed collection (unless it is specifically an instance of OpenCollection). Subclasses can change this, if needed.

Overrides:
isClosedCollection in class Resource
See Also:
Resource.isClosedCollection(String)


Copyright © 2014 universAAL Consortium. All Rights Reserved.