gr.forth.ics.rdfsuite.rssdb.repr
Class DBRepresentation

java.lang.Object
  extended by gr.forth.ics.rdfsuite.rssdb.repr.DBRepresentation
Direct Known Subclasses:
HybridRepresentation, SSRepresentation, SSWSRepresentation

public abstract class DBRepresentation
extends java.lang.Object


Field Summary
static java.lang.String anon_ids
           
protected  java.lang.String bag_types
           
protected  java.lang.String classAnc1
           
protected  java.lang.String cluster_namespace
           
protected  java.lang.String enumeration1
           
protected  java.lang.String enumeration2
           
protected  java.lang.String function_add_propertyQuery
           
protected  java.lang.String function_create_instanceQuery
           
protected  java.lang.String function_delete_objectQuery
           
protected  java.lang.String function_delete_propertyQuery
           
protected  java.lang.String function_update_propertyQuery
           
protected  java.lang.String generator1
           
protected  java.lang.String generator2
           
protected  java.lang.String graph_table
           
protected  java.lang.String graphspace_dep
           
protected  java.lang.String graphspace1
           
protected  java.lang.String graphspace2
           
protected  java.lang.String index_bagtype1
           
protected  java.lang.String index_bagtype2
           
protected  java.lang.String index_bagtype3
           
protected  java.lang.String index_class1
           
protected  java.lang.String index_classanc1
           
protected  java.lang.String index_classanc2
           
protected  java.lang.String index_classanc3
           
protected  java.lang.String index_classanc4
           
protected  java.lang.String index_enumeration1
           
protected  java.lang.String index_graph
           
protected  java.lang.String index_metaclass1
           
protected  java.lang.String index_metaclass2
           
protected  java.lang.String index_metaclass3
           
protected  java.lang.String index_metaproperty1
           
protected  java.lang.String index_metaproperty2
           
protected  java.lang.String index_metaproperty3
           
protected  java.lang.String index_namespace
           
protected  java.lang.String index_propertyanc1
           
protected  java.lang.String index_propertyanc2
           
protected  java.lang.String index_propertyanc3
           
protected  java.lang.String index_propertyanc4
           
protected  java.lang.String index_seqtype1
           
protected  java.lang.String index_seqtype2
           
protected  java.lang.String index_seqtype3
           
protected  java.lang.String index_seqtype4
           
protected  java.lang.String index_subclass1
           
protected  java.lang.String index_subclass2
           
protected  java.lang.String index_subclass3
           
protected  java.lang.String index_subclass4
           
protected  java.lang.String index_submetaclass1
           
protected  java.lang.String index_submetaclass2
           
protected  java.lang.String index_submetaclass3
           
protected  java.lang.String index_submetaproperty1
           
protected  java.lang.String index_submetaproperty2
           
protected  java.lang.String index_submetaproperty3
           
protected  java.lang.String index_subproperty1
           
protected  java.lang.String index_subproperty2
           
protected  java.lang.String index_subproperty3
           
protected  java.lang.String index_subproperty4
           
protected  java.lang.String literal1
           
protected  java.lang.String literal2
           
protected static org.apache.log4j.Logger log
          The RSSDB output in file for now (I have cut of the GUI)
protected static org.apache.log4j.Logger logquery
           
protected  java.lang.String max_postorder1
           
protected  java.lang.String max_postorder2
           
protected  java.lang.String metaclass1
           
protected  java.lang.String metaclass10
          http://139.91.183.30:9090/RDF/rdfsuite.rdfs#
protected  java.lang.String metaclass11
          I will hardcode the Graphnamespace
protected  java.lang.String metaclass2
           
protected  java.lang.String metaclass3
           
protected  java.lang.String metaclass4
           
protected  java.lang.String metaclass5
           
protected  java.lang.String metaclass6
           
protected  java.lang.String metaclass7
           
protected  java.lang.String metaclass8
           
protected  IRDFDB_Model model
           
protected  java.lang.String namespace_dep
           
protected  java.lang.String namespace1
           
protected  java.lang.String namespace3
           
protected  java.lang.String namespace4
           
protected  java.lang.String namespace5
           
protected  java.lang.String namespace6
           
protected  java.lang.String propertyAnc1
           
protected  java.lang.String representation1
           
protected  java.lang.String seq_types
           
protected  java.lang.String subClass1
           
protected  java.lang.String subClass2
           
protected  java.lang.String subProperty1
           
protected  java.lang.String thesaurus1
           
protected  java.lang.String thesaurus2
           
 
Constructor Summary
DBRepresentation(IRDFDB_Model model)
           
 
Method Summary
 boolean checkStoredSubClass(RDF_Class rdf_class)
          Tests if the superclasses of the RDF class are identical to those stored in DBMS for this RDF class.
 boolean checkStoredSubMetaClass(RDF_MetaClass metaclass)
          Tests if the superclasses of the Metaclass are identical to those stored in DBMS for this metaclass.
 boolean checkStoredSubProperty(RDF_Property rdf_property)
          Tests if the superproperties of the RDF property are identical to those stored in DBMS for this RDF property.
abstract  int clusterClassTables()
          Clusters upon request the table where class instances are stored.
 void clusterGraphTable()
           
 void clusterNamespaceTable()
           
 boolean compareDomainRange(RDF_Property rdf_property, int domainID, int rangeID, int rng_kind)
          Check if the domain and range of the property declared in the RDF file is identical to the respective of the property that is stored in the db.
protected  java.lang.String correlateTripleIdWithGraphspaceQuery(java.lang.String graphspace_uri, int triple_id)
           
abstract  void createInitIndexes(java.sql.Statement stmt)
          Indexes are created on the core database tables and on the table where data resources are stored (i.e., Instances table).
 void createPrimitiveTableIndexes(java.sql.Statement stmt)
          Indexes are defined on the primitive tables.
 void createPrimitiveTables(java.sql.Statement stmt)
          The core/primitive tables of the database representation are created and they are populated with data.
protected  void deleteRedundantSubClassOf(IRDF_Class rdf_class, IRDF_Class superclass)
          Deletes from db the subclass relation between the two given classes
protected  void deleteRedundantSubMetaClassOf(IRDF_MetaClass rdf_meta_class, IRDF_MetaClass supermetaclass)
          Deletes from db the submetaclass relation between the two given metaclasses
protected  void deleteRedundantSubPropertyOf(IRDF_Property rdf_property, IRDF_Property superproperty)
          Deleted from db the subproperty relation between the two given properties
abstract  boolean existMultipleLevelClassifiedResource()
           
 java.sql.ResultSet getAllClassesAndSuperClasses(java.lang.String schema)
           
 java.sql.ResultSet getAllMetaClassesAndSuperMetaClasses(java.lang.String schema)
           
 java.sql.ResultSet getAllPropertiesWithDomainAndRange()
           
 java.lang.String getAllpropertiesWithDomainAndRangeQuery()
           
static java.sql.ResultSet getClassIndex(java.sql.Statement stmt, int class_post)
           
 java.lang.String getClassURI(java.sql.Connection con, int id, boolean ext)
           
static java.util.Collection<java.lang.String> getDescendantsOf(java.lang.String URI, int mode, java.sql.Statement s)
           
static java.lang.String getDescendantsOfClassQuery(int class_post)
           
static java.lang.String getDescendantsOfMetaClassQuery(int metaclass_post)
           
static java.lang.String getDescendantsOfPropertyQuery(int property_post)
           
static java.util.ArrayList<java.lang.Integer> getLabelFromDB(IRDFDB_Model model, java.lang.String uri, int what)
          Retrieves the label from the DB of the given uri if it is a class,property or metaclass
static java.util.TreeSet<IntervalLabel> getLabelsOfDirectTreeDescendants(java.sql.Statement stmt, IntervalLabel interval, int mode)
          Returns the interval set of the direct descendants of the node with the given interval in the spanning tree.
static java.sql.ResultSet getMetaClassAndSuperMetaClassForFetching(java.sql.Statement stmt, java.lang.String metaclass_lname, int namespace_id)
           
 java.util.ArrayList getMetaClassesClassBelongs(RDF_Class rdf_class, int repr)
          Returns the identifiers of the metaclasses under which the class has been classified
 java.util.ArrayList getMetaClassesPropertyBelongs(RDF_Property rdf_property, int repr)
          Returns the identifiers of the metaclasses under which the property has been classified
 java.lang.String getMetaClassURI(java.sql.Connection con, int id)
           
static int getNamespaceID(RDF_Model model, java.sql.Statement stmt, java.lang.String namespace_uri)
          Is the method that returns the namespace DBID of a namespace uri
static java.util.Map<IntervalLabel,java.lang.Boolean> getPropagatedLabelsOfClass(IRDFDB_Model model, int class_post)
          Given a class post id it returns its propagated labels (direct and indirect)
static java.util.Map<IntervalLabel,java.lang.Boolean> getPropagatedLabelsOfMetaClass(IRDFDB_Model model, int metaclass_post)
          Given a metaclass post id it returns its propagated labels (direct and indirect)
static java.util.Map<IntervalLabel,java.lang.Boolean> getPropagatedLabelsOfMetaProperty(IRDFDB_Model model, int metaproperty_post)
          Given a metaproperty post id it returns its propagated labels (direct and indirect)
static java.util.Map<IntervalLabel,java.lang.Boolean> getPropagatedLabelsOfProperty(IRDFDB_Model model, int property_post)
          Given a property post id it returns its propagated labels (direct and indirect)
 java.lang.String getPropertyURI(java.sql.Connection con, int id)
           
protected  int getRepr()
           
 int getRepresentation()
          Is the method that returns the representation kind of the DB
 java.util.HashMap getStoredMetaClasses(java.sql.Connection con)
          Returns the metaclasses that are stored in the db.
protected  java.lang.String getStoredMetaClassesQuery()
           
abstract  void initPreparedStatements()
           
protected  java.lang.String insertXMLSchemaTypesQuery(java.lang.String dt, java.lang.String dtLp)
           
 boolean isGraphspaceInDB(IRDFDB_Model model, java.lang.String uri)
           
 int isMetaClass(int mcid)
          Checks if the stored object with id is a MetaClass.
 boolean isNonTreeSubClass(int subpost, int suppost, int subindex, java.sql.Connection con)
           
protected  java.lang.String isNonTreeSubClassQuery(int subpost, int suppost, int subindex)
           
 boolean isNonTreeSubMetaClass(int subpost, int suppost, int subindex, java.sql.Connection con)
           
protected  java.lang.String isNonTreeSubMetaClassQuery(int subpost, int suppost, int subindex)
           
protected  java.lang.String isResourceStoredAsClassQuery(java.lang.String ns, java.lang.String resource_uri)
           
protected  java.lang.String isResourceStoredAsMetaClassQuery(IRDF_Resource resource, int meta_kind, java.lang.String ns)
           
 boolean isSubClass(int subpost, int suppost, int subindex, int supindex, boolean includeClass, boolean isDAG, java.sql.Connection con)
          Returns true if the class with post number is subclass of the class with post number and index
protected  int isSubClassOfRedundant(IRDF_Class rdf_class, IRDF_Class superclass)
          Based on the already stored subclass relationships tells whether the "new" subclassof is redundant
 boolean isSubMetaClass(int subpost, int suppost, int subindex, int supindex, boolean includeClass, boolean isDAG, java.sql.Connection con)
          Returns true if the metaclass with post number is subclass of the metaclass with post number and index
protected  int isSubMetaClassOfRedundant(IRDF_MetaClass rdf_class, IRDF_MetaClass superclass)
          Based on the already stored submetaclass relationships tells whether the "new" submetaclassof is redundant
protected  int isSubPropertyOfRedundant(IRDF_Property rdf_property, IRDF_Property superproperty)
          Based on the already stored subproperty relationships tells whether the "new" subpropertyof is redundant
 IntervalLabel metaclassContainsResource(int mcid, java.lang.String URI)
          Indicates if the object with URI is instance of the metaclass/property with post number mcid
protected  java.lang.String metaclassContainsResourceQuery(int mcid, java.lang.String lpart, java.lang.String ns)
           
protected  java.lang.String representation2Query(int repr)
           
 boolean resourceIsStoredAsClass(java.lang.String resource_uri)
          Tests if the Resource has been stored in the database as a class.
 boolean resourceIsStoredAsMetaClass(IRDF_Resource resource, int meta_kind)
          Tests if the resource has been stored in the database as a metaclass of classes, properties, thesaurus or enumerations.
abstract  int store(IRDF_Class rdf_class)
           
abstract  int store(IRDF_Individual rdf_class_instance, java.lang.String graphspace_uri)
           
abstract  int store(IRDF_MetaClass rdf_meta_class)
           
abstract  int store(IRDF_Property rdf_property)
           
abstract  int store(IRDF_PropertyInstance rdf_property_instance, java.lang.String graphspace_uri)
           
abstract  int store(IRDF_Resource rdf_resource, java.lang.String uri)
           
protected  void storeClassDefaultProperties(IRDF_Class rdf_class)
           
 void storeClassInstanceDefaultProperties(IRDF_Individual rdf_class_instance)
          Stores comments,labels,seeAlsos,isDefinedBys defined on ClassInstances in the following relations resourcecomment(string classinstance,string comment,int triple_id,int classinstance_type_id) resourcelabel(string classinstance,string label,int triple_id,int classinstance_type_id)
abstract  void storeGraphspaceAsClassInstance(java.lang.String uri)
           
 void storeGraphspaceDependency(int graphspace_dbid, int depended_namespace_dbid, int depended_graphspace_dbid)
          (depended_namespace_dbid==0)||(depended_graphspace_db_id==0)
 void storeNamespaceDependency(int namespace_dbid, int depended_namespace_dbid)
           
abstract  void storeNonLabelChildren(IRDF_Class rdf_class, boolean direct)
          Stores the classes that are descendants of the current class, through non-tree arcs
abstract  void storeNonLabelChildren(IRDF_MetaClass rdf_meta_class, boolean direct)
          Stores the metaclasses that are descendants of the current metaclass, through non-tree arcs
abstract  void storeNonLabelChildrenProperty(IRDF_Property rdf_property, boolean direct)
          Stores the properties that are descendants of the current property, through non-tree arcs
 void storePrimitiveFunctions(java.sql.Statement stmt)
          Stores the primitive functions
abstract  void storePrimitiveSchema()
          Stores primitive schema
protected  void storePropertyDefaultProperties(IRDF_Property rdf_property)
           
protected  java.lang.String subClassGraph(int graph_index)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static final org.apache.log4j.Logger log
The RSSDB output in file for now (I have cut of the GUI)


logquery

protected static final org.apache.log4j.Logger logquery

model

protected IRDFDB_Model model

namespace1

protected java.lang.String namespace1

namespace_dep

protected java.lang.String namespace_dep

graphspace1

protected java.lang.String graphspace1

graphspace_dep

protected java.lang.String graphspace_dep

graphspace2

protected java.lang.String graphspace2

anon_ids

public static java.lang.String anon_ids

namespace3

protected java.lang.String namespace3

namespace4

protected java.lang.String namespace4

namespace5

protected java.lang.String namespace5

namespace6

protected java.lang.String namespace6

graph_table

protected java.lang.String graph_table

metaclass1

protected java.lang.String metaclass1

metaclass2

protected java.lang.String metaclass2

metaclass3

protected java.lang.String metaclass3

metaclass4

protected java.lang.String metaclass4

metaclass5

protected java.lang.String metaclass5

metaclass6

protected java.lang.String metaclass6

metaclass7

protected java.lang.String metaclass7

metaclass8

protected java.lang.String metaclass8

metaclass10

protected java.lang.String metaclass10
http://139.91.183.30:9090/RDF/rdfsuite.rdfs#


metaclass11

protected java.lang.String metaclass11
I will hardcode the Graphnamespace


literal1

protected java.lang.String literal1

literal2

protected java.lang.String literal2

thesaurus1

protected java.lang.String thesaurus1

enumeration1

protected java.lang.String enumeration1

thesaurus2

protected java.lang.String thesaurus2

enumeration2

protected java.lang.String enumeration2

subClass1

protected java.lang.String subClass1

subClass2

protected java.lang.String subClass2

subProperty1

protected java.lang.String subProperty1

classAnc1

protected java.lang.String classAnc1

propertyAnc1

protected java.lang.String propertyAnc1

generator1

protected java.lang.String generator1

generator2

protected java.lang.String generator2

representation1

protected java.lang.String representation1

max_postorder1

protected java.lang.String max_postorder1

max_postorder2

protected java.lang.String max_postorder2

seq_types

protected java.lang.String seq_types

bag_types

protected java.lang.String bag_types

index_class1

protected java.lang.String index_class1

index_subclass1

protected java.lang.String index_subclass1

index_subclass2

protected java.lang.String index_subclass2

index_subclass3

protected java.lang.String index_subclass3

index_subclass4

protected java.lang.String index_subclass4

index_subproperty1

protected java.lang.String index_subproperty1

index_subproperty2

protected java.lang.String index_subproperty2

index_subproperty3

protected java.lang.String index_subproperty3

index_subproperty4

protected java.lang.String index_subproperty4

index_submetaclass1

protected java.lang.String index_submetaclass1

index_submetaclass2

protected java.lang.String index_submetaclass2

index_submetaclass3

protected java.lang.String index_submetaclass3

index_submetaproperty1

protected java.lang.String index_submetaproperty1

index_submetaproperty2

protected java.lang.String index_submetaproperty2

index_submetaproperty3

protected java.lang.String index_submetaproperty3

index_classanc1

protected java.lang.String index_classanc1

index_classanc2

protected java.lang.String index_classanc2

index_classanc3

protected java.lang.String index_classanc3

index_classanc4

protected java.lang.String index_classanc4

index_propertyanc1

protected java.lang.String index_propertyanc1

index_propertyanc2

protected java.lang.String index_propertyanc2

index_propertyanc3

protected java.lang.String index_propertyanc3

index_propertyanc4

protected java.lang.String index_propertyanc4

index_metaclass1

protected java.lang.String index_metaclass1

index_metaclass2

protected java.lang.String index_metaclass2

index_metaclass3

protected java.lang.String index_metaclass3

index_metaproperty1

protected java.lang.String index_metaproperty1

index_metaproperty2

protected java.lang.String index_metaproperty2

index_metaproperty3

protected java.lang.String index_metaproperty3

index_enumeration1

protected java.lang.String index_enumeration1

index_seqtype1

protected java.lang.String index_seqtype1

index_seqtype2

protected java.lang.String index_seqtype2

index_seqtype3

protected java.lang.String index_seqtype3

index_seqtype4

protected java.lang.String index_seqtype4

index_bagtype1

protected java.lang.String index_bagtype1

index_bagtype2

protected java.lang.String index_bagtype2

index_bagtype3

protected java.lang.String index_bagtype3

index_namespace

protected java.lang.String index_namespace

cluster_namespace

protected java.lang.String cluster_namespace

index_graph

protected java.lang.String index_graph

function_create_instanceQuery

protected java.lang.String function_create_instanceQuery

function_delete_objectQuery

protected java.lang.String function_delete_objectQuery

function_add_propertyQuery

protected java.lang.String function_add_propertyQuery

function_delete_propertyQuery

protected java.lang.String function_delete_propertyQuery

function_update_propertyQuery

protected java.lang.String function_update_propertyQuery
Constructor Detail

DBRepresentation

public DBRepresentation(IRDFDB_Model model)
Method Detail

getRepr

protected int getRepr()

subClassGraph

protected java.lang.String subClassGraph(int graph_index)

insertXMLSchemaTypesQuery

protected java.lang.String insertXMLSchemaTypesQuery(java.lang.String dt,
                                                     java.lang.String dtLp)

representation2Query

protected java.lang.String representation2Query(int repr)

getStoredMetaClassesQuery

protected java.lang.String getStoredMetaClassesQuery()

isResourceStoredAsClassQuery

protected java.lang.String isResourceStoredAsClassQuery(java.lang.String ns,
                                                        java.lang.String resource_uri)

isResourceStoredAsMetaClassQuery

protected java.lang.String isResourceStoredAsMetaClassQuery(IRDF_Resource resource,
                                                            int meta_kind,
                                                            java.lang.String ns)

isNonTreeSubMetaClassQuery

protected java.lang.String isNonTreeSubMetaClassQuery(int subpost,
                                                      int suppost,
                                                      int subindex)

isNonTreeSubClassQuery

protected java.lang.String isNonTreeSubClassQuery(int subpost,
                                                  int suppost,
                                                  int subindex)

metaclassContainsResourceQuery

protected java.lang.String metaclassContainsResourceQuery(int mcid,
                                                          java.lang.String lpart,
                                                          java.lang.String ns)

getMetaClassAndSuperMetaClassForFetching

public static java.sql.ResultSet getMetaClassAndSuperMetaClassForFetching(java.sql.Statement stmt,
                                                                          java.lang.String metaclass_lname,
                                                                          int namespace_id)
                                                                   throws java.sql.SQLException
Throws:
java.sql.SQLException - if the query aborts

getRepresentation

public int getRepresentation()
                      throws java.sql.SQLException
Is the method that returns the representation kind of the DB

Returns:
the int Representation of the representation in the DB (ISA=2, NOISA=3,Hybrid=4)
Throws:
java.sql.SQLException - If the query aborts

getNamespaceID

public static int getNamespaceID(RDF_Model model,
                                 java.sql.Statement stmt,
                                 java.lang.String namespace_uri)
                          throws java.sql.SQLException
Is the method that returns the namespace DBID of a namespace uri

Returns:
the int in of the namespace in the DB
Throws:
java.sql.SQLException - If the query aborts

storePrimitiveSchema

public abstract void storePrimitiveSchema()
                                   throws java.sql.SQLException
Stores primitive schema

Throws:
java.sql.SQLException - if the query aborts

createPrimitiveTables

public void createPrimitiveTables(java.sql.Statement stmt)
                           throws java.sql.SQLException
The core/primitive tables of the database representation are created and they are populated with data.

Throws:
java.sql.SQLException - if the query aborts

createInitIndexes

public abstract void createInitIndexes(java.sql.Statement stmt)
                                throws java.sql.SQLException
Indexes are created on the core database tables and on the table where data resources are stored (i.e., Instances table).

Throws:
java.sql.SQLException - if the query aborts

createPrimitiveTableIndexes

public void createPrimitiveTableIndexes(java.sql.Statement stmt)
                                 throws java.sql.SQLException
Indexes are defined on the primitive tables.

Throws:
java.sql.SQLException - if the query aborts

storePrimitiveFunctions

public void storePrimitiveFunctions(java.sql.Statement stmt)
                             throws java.sql.SQLException
Stores the primitive functions

Throws:
java.sql.SQLException - if the query aborts

initPreparedStatements

public abstract void initPreparedStatements()
                                     throws java.sql.SQLException
Throws:
java.sql.SQLException - if the query aborts

store

public abstract int store(IRDF_Class rdf_class)
                   throws java.sql.SQLException
Throws:
java.sql.SQLException - if some query aborts in the storing

store

public abstract int store(IRDF_Individual rdf_class_instance,
                          java.lang.String graphspace_uri)
                   throws java.sql.SQLException
Throws:
java.sql.SQLException - if some query aborts in the storing

store

public abstract int store(IRDF_MetaClass rdf_meta_class)
                   throws java.sql.SQLException
Throws:
java.sql.SQLException - if some query aborts in the storing

store

public abstract int store(IRDF_Property rdf_property)
                   throws java.sql.SQLException
Throws:
java.sql.SQLException - if some query aborts in the storing

store

public abstract int store(IRDF_PropertyInstance rdf_property_instance,
                          java.lang.String graphspace_uri)
                   throws java.sql.SQLException
Throws:
java.sql.SQLException - if some query aborts in the storing

store

public abstract int store(IRDF_Resource rdf_resource,
                          java.lang.String uri)
                   throws java.sql.SQLException
Throws:
java.sql.SQLException - if some query aborts in the storing

clusterClassTables

public abstract int clusterClassTables()
                                throws java.sql.SQLException
Clusters upon request the table where class instances are stored.

Throws:
java.sql.SQLException - if some clustering query aborts

existMultipleLevelClassifiedResource

public abstract boolean existMultipleLevelClassifiedResource()
                                                      throws java.sql.SQLException
Returns:
Throws:
java.sql.SQLException - if some query aborts

getStoredMetaClasses

public java.util.HashMap getStoredMetaClasses(java.sql.Connection con)
                                       throws java.sql.SQLException
Returns the metaclasses that are stored in the db.

Parameters:
con - JBDC Connection Object
Returns:
A HashMap that contains the classes that are stored in the db. Keys are the metaclasses URIs and values are arrays of integers. The first element of the array is the identifier of the metaclass. The second element is the integer that are given by RQL to classes containing either class or properties.
Throws:
java.sql.SQLException - if some query aborts

resourceIsStoredAsClass

public boolean resourceIsStoredAsClass(java.lang.String resource_uri)
                                throws java.sql.SQLException
Tests if the Resource has been stored in the database as a class.

Throws:
java.sql.SQLException - if some query aborts

resourceIsStoredAsMetaClass

public boolean resourceIsStoredAsMetaClass(IRDF_Resource resource,
                                           int meta_kind)
                                    throws java.sql.SQLException
Tests if the resource has been stored in the database as a metaclass of classes, properties, thesaurus or enumerations.

Parameters:
meta_kind - indicates the kind of the metaclass
Throws:
java.sql.SQLException - if some query aborts

isSubMetaClass

public boolean isSubMetaClass(int subpost,
                              int suppost,
                              int subindex,
                              int supindex,
                              boolean includeClass,
                              boolean isDAG,
                              java.sql.Connection con)
                       throws java.sql.SQLException
Returns true if the metaclass with post number is subclass of the metaclass with post number and index

Parameters:
subpost - The post number of the subclass
suppost - The post number of the superclass
subindex - The index number of the subclass
supindex - The index number of the superclass
includeClass - If this parameter is true, the method will return true if the numbers subpost and suppost are equal.
Returns:
Returns true if the metaclass with post number is subclass of the metaclass with post number and index otherwise returns false.
Throws:
java.sql.SQLException - if some query aborts

isNonTreeSubMetaClass

public boolean isNonTreeSubMetaClass(int subpost,
                                     int suppost,
                                     int subindex,
                                     java.sql.Connection con)
                              throws java.sql.SQLException
Parameters:
subpost -
suppost -
subindex -
con -
Returns:
Throws:
java.sql.SQLException - if some query aborts

isSubClass

public boolean isSubClass(int subpost,
                          int suppost,
                          int subindex,
                          int supindex,
                          boolean includeClass,
                          boolean isDAG,
                          java.sql.Connection con)
                   throws java.sql.SQLException
Returns true if the class with post number is subclass of the class with post number and index

Parameters:
subpost - The post number of the subclass
suppost - The post number of the superclass
subindex - The index number of the subclass
supindex - The index number of the superclass
includeClass - If this parameter is true, the method will return true if the numbers subpost and suppost are equal.
Returns:
Returns true if the class with post number is subclass of the class with post number and index otherwise returns false.
Throws:
java.sql.SQLException - if some query aborts

isNonTreeSubClass

public boolean isNonTreeSubClass(int subpost,
                                 int suppost,
                                 int subindex,
                                 java.sql.Connection con)
                          throws java.sql.SQLException
Parameters:
subpost -
suppost -
subindex -
con -
Returns:
Throws:
java.sql.SQLException - if some query aborts

metaclassContainsResource

public IntervalLabel metaclassContainsResource(int mcid,
                                               java.lang.String URI)
                                        throws java.sql.SQLException
Indicates if the object with URI is instance of the metaclass/property with post number mcid

Parameters:
mcid - The post number of the metaclass
Returns:
The post number and the index of the class
Throws:
java.sql.SQLException - if some query aborts

isMetaClass

public int isMetaClass(int mcid)
                throws java.sql.SQLException
Checks if the stored object with id is a MetaClass.

Parameters:
mcid - Represents the integer id
Returns:
The kind of MetaClass
Throws:
java.sql.SQLException - if some query aborts

getAllClassesAndSuperClasses

public java.sql.ResultSet getAllClassesAndSuperClasses(java.lang.String schema)
                                                throws java.sql.SQLException
Parameters:
schema -
Returns:
Throws:
java.sql.SQLException - if some query aborts

getAllMetaClassesAndSuperMetaClasses

public java.sql.ResultSet getAllMetaClassesAndSuperMetaClasses(java.lang.String schema)
                                                        throws java.sql.SQLException
Parameters:
schema -
Returns:
Throws:
java.sql.SQLException - if some query aborts

compareDomainRange

public boolean compareDomainRange(RDF_Property rdf_property,
                                  int domainID,
                                  int rangeID,
                                  int rng_kind)
                           throws java.sql.SQLException
Check if the domain and range of the property declared in the RDF file is identical to the respective of the property that is stored in the db.

Parameters:
domainID - The id of domain class of the stored property
rangeID - The id of range class of the stored property
Returns:
true if the domain and range of the property declared in the RDF file is identical to the respective of the property that is stored in the db, false otherwise
Throws:
java.sql.SQLException - if some query aborts

getClassURI

public java.lang.String getClassURI(java.sql.Connection con,
                                    int id,
                                    boolean ext)
                             throws java.sql.SQLException
Parameters:
con - JBDC connection object
id - Database integer identifier of a class (or Literal or Thesaurus)
ext - if false the function returns the URI of a class if the id corresponds to a class. If true the function returns the URI of a class or Literal type or Thesaurus if the id corresponds to a class or Literal type or Thesaurus respectively
Returns:
The URI of a class (or Literal type or Thesaurus)
Throws:
java.sql.SQLException - if some query aborts

getMetaClassURI

public java.lang.String getMetaClassURI(java.sql.Connection con,
                                        int id)
                                 throws java.sql.SQLException
Parameters:
con - JBDC connection object
id - Database integer identifier of a metaclass
Returns:
The URI of a metaclass
Throws:
java.sql.SQLException - if some query aborts

checkStoredSubMetaClass

public boolean checkStoredSubMetaClass(RDF_MetaClass metaclass)
                                throws java.sql.SQLException
Tests if the superclasses of the Metaclass are identical to those stored in DBMS for this metaclass.

Throws:
java.sql.SQLException - if some query aborts

checkStoredSubClass

public boolean checkStoredSubClass(RDF_Class rdf_class)
                            throws java.sql.SQLException
Tests if the superclasses of the RDF class are identical to those stored in DBMS for this RDF class.

Throws:
java.sql.SQLException - if some query aborts

checkStoredSubProperty

public boolean checkStoredSubProperty(RDF_Property rdf_property)
                               throws java.sql.SQLException
Tests if the superproperties of the RDF property are identical to those stored in DBMS for this RDF property.

Throws:
java.sql.SQLException - if some query aborts

getPropertyURI

public java.lang.String getPropertyURI(java.sql.Connection con,
                                       int id)
                                throws java.sql.SQLException
Parameters:
con -
id -
Returns:
Throws:
java.sql.SQLException - if some query aborts

getMetaClassesClassBelongs

public java.util.ArrayList getMetaClassesClassBelongs(RDF_Class rdf_class,
                                                      int repr)
                                               throws java.sql.SQLException
Returns the identifiers of the metaclasses under which the class has been classified

Throws:
java.sql.SQLException - if some query aborts

getMetaClassesPropertyBelongs

public java.util.ArrayList getMetaClassesPropertyBelongs(RDF_Property rdf_property,
                                                         int repr)
                                                  throws java.sql.SQLException
Returns the identifiers of the metaclasses under which the property has been classified

Throws:
java.sql.SQLException - if some query aborts

isGraphspaceInDB

public boolean isGraphspaceInDB(IRDFDB_Model model,
                                java.lang.String uri)
                         throws java.sql.SQLException
Parameters:
model -
uri -
Returns:
Throws:
java.sql.SQLException - if some query aborts

getAllPropertiesWithDomainAndRange

public java.sql.ResultSet getAllPropertiesWithDomainAndRange()
                                                      throws java.sql.SQLException
Returns:
Throws:
java.sql.SQLException - if some query aborts
Since:
05-03-2007

getAllpropertiesWithDomainAndRangeQuery

public java.lang.String getAllpropertiesWithDomainAndRangeQuery()

storeGraphspaceAsClassInstance

public abstract void storeGraphspaceAsClassInstance(java.lang.String uri)
                                             throws java.sql.SQLException
Parameters:
uri -
Throws:
java.sql.SQLException - if some query aborts

storeClassDefaultProperties

protected void storeClassDefaultProperties(IRDF_Class rdf_class)
                                    throws java.sql.SQLException
Parameters:
rdf_class -
Throws:
java.sql.SQLException - if some query aborts

storeClassInstanceDefaultProperties

public void storeClassInstanceDefaultProperties(IRDF_Individual rdf_class_instance)
                                         throws java.sql.SQLException
Stores comments,labels,seeAlsos,isDefinedBys defined on ClassInstances in the following relations resourcecomment(string classinstance,string comment,int triple_id,int classinstance_type_id) resourcelabel(string classinstance,string label,int triple_id,int classinstance_type_id)

Parameters:
rdf_class_instance -
Throws:
java.sql.SQLException - if some query aborts

storePropertyDefaultProperties

protected void storePropertyDefaultProperties(IRDF_Property rdf_property)
                                       throws java.sql.SQLException
Parameters:
rdf_property -
Throws:
java.sql.SQLException - if some query aborts

clusterNamespaceTable

public void clusterNamespaceTable()
                           throws java.sql.SQLException
Throws:
java.sql.SQLException - if some query aborts

clusterGraphTable

public void clusterGraphTable()
                       throws java.sql.SQLException
Throws:
java.sql.SQLException - if some query aborts

storeNamespaceDependency

public void storeNamespaceDependency(int namespace_dbid,
                                     int depended_namespace_dbid)
                              throws java.sql.SQLException
Parameters:
namespace_dbid -
depended_namespace_dbid -
Throws:
java.sql.SQLException - if some query aborts

storeGraphspaceDependency

public void storeGraphspaceDependency(int graphspace_dbid,
                                      int depended_namespace_dbid,
                                      int depended_graphspace_dbid)
                               throws java.sql.SQLException
(depended_namespace_dbid==0)||(depended_graphspace_db_id==0)

Throws:
java.sql.SQLException - if some query aborts

correlateTripleIdWithGraphspaceQuery

protected java.lang.String correlateTripleIdWithGraphspaceQuery(java.lang.String graphspace_uri,
                                                                int triple_id)
                                                         throws java.sql.SQLException
Throws:
java.sql.SQLException - if some query aborts

getLabelsOfDirectTreeDescendants

public static java.util.TreeSet<IntervalLabel> getLabelsOfDirectTreeDescendants(java.sql.Statement stmt,
                                                                                IntervalLabel interval,
                                                                                int mode)
                                                                         throws java.sql.SQLException
Returns the interval set of the direct descendants of the node with the given interval in the spanning tree.

Parameters:
mode, - 1: Classes 2: META_CLASSES 3: PROPS 4: META_PROPS
Throws:
java.sql.SQLException - if some query aborts

getClassIndex

public static java.sql.ResultSet getClassIndex(java.sql.Statement stmt,
                                               int class_post)
                                        throws java.sql.SQLException
Parameters:
stmt -
class_post -
Returns:
Throws:
java.sql.SQLException - if some query aborts

getDescendantsOf

public static java.util.Collection<java.lang.String> getDescendantsOf(java.lang.String URI,
                                                                      int mode,
                                                                      java.sql.Statement s)
                                                               throws java.sql.SQLException
Parameters:
URI - The uri of a class or property
mode - 0 if class,1 if metaclass, 2 if property
Returns:
Collection The stored ancestors of the resource with the given uri
Throws:
java.sql.SQLException - if some query aborts

getDescendantsOfClassQuery

public static java.lang.String getDescendantsOfClassQuery(int class_post)

getDescendantsOfMetaClassQuery

public static java.lang.String getDescendantsOfMetaClassQuery(int metaclass_post)

getDescendantsOfPropertyQuery

public static java.lang.String getDescendantsOfPropertyQuery(int property_post)

isSubClassOfRedundant

protected int isSubClassOfRedundant(IRDF_Class rdf_class,
                                    IRDF_Class superclass)
                             throws java.sql.SQLException
Based on the already stored subclass relationships tells whether the "new" subclassof is redundant

Parameters:
rdf_class -
superclass -
Returns:
0 if it is redundant, 1 if it is not redundant and no deletions are needed, 2 if it is not redundant and deletions are needed
Throws:
java.sql.SQLException - if some query aborts

isSubMetaClassOfRedundant

protected int isSubMetaClassOfRedundant(IRDF_MetaClass rdf_class,
                                        IRDF_MetaClass superclass)
                                 throws java.sql.SQLException
Based on the already stored submetaclass relationships tells whether the "new" submetaclassof is redundant

Parameters:
rdf_meta_class -
super_meta_class -
Returns:
0 if it is redundant, 1 if it is not redundant and no deletions are needed, 2 if it is not redundant and deletions are needed
Throws:
java.sql.SQLException - if some query aborts

isSubPropertyOfRedundant

protected int isSubPropertyOfRedundant(IRDF_Property rdf_property,
                                       IRDF_Property superproperty)
                                throws java.sql.SQLException
Based on the already stored subproperty relationships tells whether the "new" subpropertyof is redundant

Parameters:
rdf_property -
superproperty -
Returns:
0 if it is redundant, 1 if it is not redundant and no deletions are needed, 2 if it is not redundant and deletions are needed
Throws:
java.sql.SQLException - if some query aborts

deleteRedundantSubClassOf

protected void deleteRedundantSubClassOf(IRDF_Class rdf_class,
                                         IRDF_Class superclass)
                                  throws java.sql.SQLException
Deletes from db the subclass relation between the two given classes

Parameters:
class_id -
super_class_id -
Throws:
java.sql.SQLException - if some query aborts

deleteRedundantSubMetaClassOf

protected void deleteRedundantSubMetaClassOf(IRDF_MetaClass rdf_meta_class,
                                             IRDF_MetaClass supermetaclass)
                                      throws java.sql.SQLException
Deletes from db the submetaclass relation between the two given metaclasses

Parameters:
meta_class_id -
super_meta_class_id -
Throws:
java.sql.SQLException - if some query aborts

deleteRedundantSubPropertyOf

protected void deleteRedundantSubPropertyOf(IRDF_Property rdf_property,
                                            IRDF_Property superproperty)
                                     throws java.sql.SQLException
Deleted from db the subproperty relation between the two given properties

Parameters:
property_id -
super_property_id -
Throws:
java.sql.SQLException - if some query aborts

getPropagatedLabelsOfClass

public static java.util.Map<IntervalLabel,java.lang.Boolean> getPropagatedLabelsOfClass(IRDFDB_Model model,
                                                                                        int class_post)
                                                                                 throws java.sql.SQLException
Given a class post id it returns its propagated labels (direct and indirect)

Parameters:
class_post - the post id of the class
Returns:
A Map that contains the propagated label as key and the information whether it is direct or not as value(boolean)
Throws:
java.sql.SQLException - if the query aborts

getPropagatedLabelsOfProperty

public static java.util.Map<IntervalLabel,java.lang.Boolean> getPropagatedLabelsOfProperty(IRDFDB_Model model,
                                                                                           int property_post)
                                                                                    throws java.sql.SQLException
Given a property post id it returns its propagated labels (direct and indirect)

Parameters:
property_post - the post id of the property
Returns:
A Map that contains the propagated label as key and the information whether it is direct or not as value(boolean)
Throws:
java.sql.SQLException - if the query aborts

getPropagatedLabelsOfMetaClass

public static java.util.Map<IntervalLabel,java.lang.Boolean> getPropagatedLabelsOfMetaClass(IRDFDB_Model model,
                                                                                            int metaclass_post)
                                                                                     throws java.sql.SQLException
Given a metaclass post id it returns its propagated labels (direct and indirect)

Parameters:
metaclass_post - the post id of the metaclass
Returns:
A Map that contains the propagated label as key and the information whether it is direct or not as value(boolean)
Throws:
java.sql.SQLException - if the query aborts

getPropagatedLabelsOfMetaProperty

public static java.util.Map<IntervalLabel,java.lang.Boolean> getPropagatedLabelsOfMetaProperty(IRDFDB_Model model,
                                                                                               int metaproperty_post)
                                                                                        throws java.sql.SQLException
Given a metaproperty post id it returns its propagated labels (direct and indirect)

Parameters:
metaproperty_post - the post id of the class
Returns:
A Map that contains the propagated label as key and the information whether it is direct or not as value(boolean)
Throws:
java.sql.SQLException - if the query aborts

storeNonLabelChildren

public abstract void storeNonLabelChildren(IRDF_Class rdf_class,
                                           boolean direct)
                                    throws java.sql.SQLException
Stores the classes that are descendants of the current class, through non-tree arcs

Throws:
java.sql.SQLException - In case a query aborts

storeNonLabelChildren

public abstract void storeNonLabelChildren(IRDF_MetaClass rdf_meta_class,
                                           boolean direct)
                                    throws java.sql.SQLException
Stores the metaclasses that are descendants of the current metaclass, through non-tree arcs

Throws:
java.sql.SQLException - In case a query aborts

storeNonLabelChildrenProperty

public abstract void storeNonLabelChildrenProperty(IRDF_Property rdf_property,
                                                   boolean direct)
                                            throws java.sql.SQLException
Stores the properties that are descendants of the current property, through non-tree arcs

Throws:
java.sql.SQLException - In case a query aborts

getLabelFromDB

public static java.util.ArrayList<java.lang.Integer> getLabelFromDB(IRDFDB_Model model,
                                                                    java.lang.String uri,
                                                                    int what)
Retrieves the label from the DB of the given uri if it is a class,property or metaclass

Parameters:
uri - The uri of a class,property or metaclass
what - 1 for class,2 for proeprty,3 for metaclass,4 for metaproperty
Returns:
A Collection with two integers, the index and the post of the resource if exist else an empty Collection