org.meta2project.storage
Class DBOntology

java.lang.Object
  extended by org.meta2project.storage.DBOntology
All Implemented Interfaces:
AnnotatedEntity, Ontology

public class DBOntology
extends java.lang.Object
implements Ontology

Author:
Aleksey Yakunin

Field Summary
 
Fields inherited from interface org.meta2project.model.AnnotatedEntity
CASCADE, CASCADE_DELETE_VALUE, COMMENT, MAX_CARD, MIN_CARD, MODEL_URI, TITLE
 
Constructor Summary
DBOntology(DBConnection dbCon, CachedOntology cachedOntology)
           
 
Method Summary
 OntClass createOntClass(java.lang.String name, OntClass... parentClasses)
          Create ontology class with specified short name.
 OntObject createOntObject(java.lang.Object... initParams)
          Create ontology object with an unique surrogate name.
 OntObject createOntObject(java.lang.String name, java.lang.Object... initParams)
          Create ontology object with the specified short name.
 OProperty createOProperty(java.lang.String name, OntClass domain, OntClass range, java.lang.Integer minCard, java.lang.Integer maxCard)
          Create ontology oproperty
 TProperty createTProperty(java.lang.String name, OntClass domain, java.lang.String rangeTypeURI, int minCard, int maxCard)
          Create ontology tproperty
 TProperty createTProperty(java.lang.String name, OntClass domain, java.lang.String rangeTypeURI, int minCard, java.lang.Integer maxCard)
          Create ontology tproperty
 TProperty createTProperty(java.lang.String name, OntClass domain, Type range, java.lang.Integer minCard, java.lang.Integer maxCard)
          Create ontology tproperty
 Type createType(java.lang.String name)
          Create ontology data type with specified short name.
 void delete()
          Удалить онтологию.
 boolean equals(java.lang.Object obj)
           
 java.util.Collection<OntObject> find(FindOption option, java.lang.String... query)
          Find all objects, which tproperty values contains the text.
 java.util.Collection<OntObject> getAllOntObjects()
          Get all object of the ontology
 java.util.Collection<OProperty> getAllOProperties()
          Get all oproperties of the ontology
 java.util.Collection<TProperty> getAllTProperties()
          Get all tproperties of the ontology
 java.util.Collection<Type> getAllTypes()
          Get all data types from the ontology.
 java.lang.String getAnnotation(java.lang.String name)
          Get annotation value by this name.
 java.util.List<java.lang.String> getAnnotationNames()
          Get annotation names for this entity.
 java.util.Collection<OntClass> getBasicOntClasses()
          Get a collections of the ontology classes, which has no super classes.
 OntClass getOntClass(java.lang.String name)
          Get the class by the short name for the ontology
 java.util.Collection<OntClass> getOntClasses()
          Get all classes from the ontology.
 OntObject getOntObject(java.lang.String name)
          Get ontology object by the short name.
 OProperty getOProperty(java.lang.String name)
          Get the ontology tproperty by the short name.
 TProperty getTProperty(java.lang.String name)
          Get ontology tproperty by short name
 Type getType(java.lang.String name)
          Get the data type by the short name for the ontology.
 java.lang.String getURI()
          Get ontology URI
 java.lang.String getURL()
           
 void putAnnotation(java.lang.String name, java.lang.String value)
          Put annotation value.
 void setURI(java.lang.String uri)
          Set new ontology URI
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DBOntology

public DBOntology(DBConnection dbCon,
                  CachedOntology cachedOntology)
Method Detail

getURL

public java.lang.String getURL()

getURI

public java.lang.String getURI()
Description copied from interface: Ontology
Get ontology URI

Specified by:
getURI in interface Ontology
Returns:
ontology URI

setURI

public void setURI(java.lang.String uri)
Description copied from interface: Ontology
Set new ontology URI

Specified by:
setURI in interface Ontology
Parameters:
uri - new URI

getType

public Type getType(java.lang.String name)
Description copied from interface: Ontology
Get the data type by the short name for the ontology.

Specified by:
getType in interface Ontology
Parameters:
name - short name
Returns:
type

getAllTypes

public java.util.Collection<Type> getAllTypes()
Description copied from interface: Ontology
Get all data types from the ontology.

Specified by:
getAllTypes in interface Ontology
Returns:
collection of class Type objects

getOntClass

public OntClass getOntClass(java.lang.String name)
Description copied from interface: Ontology
Get the class by the short name for the ontology

Specified by:
getOntClass in interface Ontology
Parameters:
name - short name
Returns:
class

getOntClasses

public java.util.Collection<OntClass> getOntClasses()
Description copied from interface: Ontology
Get all classes from the ontology.

Specified by:
getOntClasses in interface Ontology
Returns:
collection of class OntClass objects;

getBasicOntClasses

public java.util.Collection<OntClass> getBasicOntClasses()
Description copied from interface: Ontology
Get a collections of the ontology classes, which has no super classes.

Specified by:
getBasicOntClasses in interface Ontology
Returns:
collection of class OntClass objects

getOProperty

public OProperty getOProperty(java.lang.String name)
Description copied from interface: Ontology
Get the ontology tproperty by the short name.

Specified by:
getOProperty in interface Ontology
Parameters:
name - short name
Returns:
оntology oproperty

getAllOProperties

public java.util.Collection<OProperty> getAllOProperties()
Description copied from interface: Ontology
Get all oproperties of the ontology

Specified by:
getAllOProperties in interface Ontology
Returns:
collection class OProperty objects

getTProperty

public TProperty getTProperty(java.lang.String name)
Description copied from interface: Ontology
Get ontology tproperty by short name

Specified by:
getTProperty in interface Ontology
Parameters:
name - short name
Returns:
tproperty

getAllTProperties

public java.util.Collection<TProperty> getAllTProperties()
Description copied from interface: Ontology
Get all tproperties of the ontology

Specified by:
getAllTProperties in interface Ontology
Returns:
collection class TProperty objects

getOntObject

public OntObject getOntObject(java.lang.String name)
Description copied from interface: Ontology
Get ontology object by the short name.

Specified by:
getOntObject in interface Ontology
Parameters:
name - short name
Returns:
ontology object

getAllOntObjects

public java.util.Collection<OntObject> getAllOntObjects()
Description copied from interface: Ontology
Get all object of the ontology

Specified by:
getAllOntObjects in interface Ontology
Returns:
collection class OntObject objects

createOntClass

public OntClass createOntClass(java.lang.String name,
                               OntClass... parentClasses)
Description copied from interface: Ontology
Create ontology class with specified short name.

Specified by:
createOntClass in interface Ontology
Parameters:
name - short name
parentClasses - super сlasses of the class
Returns:
created class

createOntObject

public OntObject createOntObject(java.lang.String name,
                                 java.lang.Object... initParams)
Description copied from interface: Ontology
Create ontology object with the specified short name.

Specified by:
createOntObject in interface Ontology
Parameters:
name - short name
initParams - init params (OntClass objects)
Returns:
created object
See Also:
OntClass

createOntObject

public OntObject createOntObject(java.lang.Object... initParams)
Description copied from interface: Ontology
Create ontology object with an unique surrogate name.

Specified by:
createOntObject in interface Ontology
Parameters:
initParams - init params (OntClass objects)
Returns:
created object
See Also:
OntClass

createOProperty

public OProperty createOProperty(java.lang.String name,
                                 OntClass domain,
                                 OntClass range,
                                 java.lang.Integer minCard,
                                 java.lang.Integer maxCard)
Description copied from interface: Ontology
Create ontology oproperty

Specified by:
createOProperty in interface Ontology
Parameters:
name - name
domain - may be null
range - may be null
minCard - may be null
maxCard - may be null
Returns:
created oproperty

createTProperty

public TProperty createTProperty(java.lang.String name,
                                 OntClass domain,
                                 Type range,
                                 java.lang.Integer minCard,
                                 java.lang.Integer maxCard)
Description copied from interface: Ontology
Create ontology tproperty

Specified by:
createTProperty in interface Ontology
Parameters:
name - name
domain - domain, may be null
range - rande, may be null
minCard - may be null
maxCard - may be null
Returns:
created tproperty

createTProperty

public TProperty createTProperty(java.lang.String name,
                                 OntClass domain,
                                 java.lang.String rangeTypeURI,
                                 int minCard,
                                 int maxCard)
Description copied from interface: Ontology
Create ontology tproperty

Specified by:
createTProperty in interface Ontology
Parameters:
name - name
domain - may be null
rangeTypeURI - data type URI, may be null
minCard - min.cardinality
maxCard - max.cardinality
Returns:
created tproperty

createTProperty

public TProperty createTProperty(java.lang.String name,
                                 OntClass domain,
                                 java.lang.String rangeTypeURI,
                                 int minCard,
                                 java.lang.Integer maxCard)
Description copied from interface: Ontology
Create ontology tproperty

Specified by:
createTProperty in interface Ontology
Parameters:
name - name
domain - may be null
rangeTypeURI - data type URI, may be null
minCard - min.cardinality
maxCard - max.cardinality, may be null
Returns:
created tproperty

delete

public void delete()
Удалить онтологию. Онтология может быть удалена, только если в ней нет объектов, свойств, классов и типов данных, иначе возникает исключение.

Specified by:
delete in interface Ontology

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

find

public java.util.Collection<OntObject> find(FindOption option,
                                            java.lang.String... query)
Description copied from interface: Ontology
Find all objects, which tproperty values contains the text. The text can be a part of a value. The search is case-insensitive.

Specified by:
find in interface Ontology
Parameters:
option - find option
query - text to find
Returns:
object collection

createType

public Type createType(java.lang.String name)
Description copied from interface: Ontology
Create ontology data type with specified short name.

Specified by:
createType in interface Ontology
Parameters:
name - short name
Returns:
created data type

getAnnotationNames

public java.util.List<java.lang.String> getAnnotationNames()
Description copied from interface: AnnotatedEntity
Get annotation names for this entity.

Specified by:
getAnnotationNames in interface AnnotatedEntity
Returns:
name list (in ascending order)

getAnnotation

public java.lang.String getAnnotation(java.lang.String name)
Description copied from interface: AnnotatedEntity
Get annotation value by this name.

Specified by:
getAnnotation in interface AnnotatedEntity
Parameters:
name - annotation name
Returns:
annotation value; null if there is no value for this name

putAnnotation

public void putAnnotation(java.lang.String name,
                          java.lang.String value)
Description copied from interface: AnnotatedEntity
Put annotation value.

Specified by:
putAnnotation in interface AnnotatedEntity
Parameters:
name - annotation name
value - annotation value; value will be removed if null