gr.forth.ics.rssdb.storage.specrepr
Class SpecReprRDFClass

java.lang.Object
  |
  +--gr.forth.ics.rssdb.storage.DBRDFClass
        |
        +--gr.forth.ics.rssdb.storage.specrepr.SpecReprRDFClass
All Implemented Interfaces:
PersistentRDFClass
Direct Known Subclasses:
SpecReprVar1RDFClass

public class SpecReprRDFClass
extends DBRDFClass
implements PersistentRDFClass

Stores an RDF Class

Version:
2.0 (23 July 2003)
Author:
Sofia Alexaki

Field Summary
protected static java.sql.PreparedStatement addClassChild
           
protected static java.sql.PreparedStatement addCls
           
protected static java.sql.PreparedStatement addSubClass
           
 
Constructor Summary
SpecReprRDFClass(gr.forth.ics.vrp.corevrp.model.RDF_Class rdf_class, DBStorage storage)
           
 
Method Summary
 boolean checkStoredSubClass()
          Tests if the superclasses of the RDF class are identical to those stored in DBMS for this RDF class.
(package private) static java.util.ArrayList getClasses(java.sql.Connection con, DBStorage storage)
          Returns the classes that have been stored in the DBMS.
 java.util.ArrayList getMetaClassesbelongs()
          Returns the identifiers of the metaclasses under which the class has been classified
static java.sql.ResultSet getSubClassesOf(int post, int index, boolean includeClass, boolean isDAG, java.sql.Connection con)
          Returns an ResultSet containing the post numbers of the stored subclasses of the class with post number .
static java.sql.ResultSet getSuperClassesOf(int post, boolean includeClass, boolean isDAG, java.sql.Connection con)
          Returns a ResultSet containing the post numbers of the stored superclasses of the class with post number .
static java.lang.String getURI(java.sql.Connection con, int id, boolean ext)
           
static void initPreparedStatements(java.sql.Connection con, DBStorage storage)
          Initializes the Prepared Statements required for storing an RDF class object in the database.
protected static boolean isAdded(int to, java.sql.ResultSet rs)
           
static 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
 int store(DBValidator dbv)
          Stores an instantiation link between the RDF class and the class rdfs:Class and stores the rdfs:subClassOf links defined on the RDF class.
 void storeClass(DBValidator dbv)
          Classify the current class under the metaclasses contained in its type list.
protected  void storeNonLabelChildren(boolean direct)
          Stores the classes that are descendants of the current class, through non-tree arcs
 void storeRDFSInstantiationDescriptions()
          Stores the instantiation links and the links of predefined RDFS properties that are defined on the RDF_Class object.
 void storeSubClass()
          Stores in the SubClass table the rdfs:subClassOf link that is defined on RDF_Class object and is an arc of the tree constructed during the labeling on the class hierarchy .
 
Methods inherited from class gr.forth.ics.rssdb.storage.DBRDFClass
getRDFClass, getStorage, setRDFClass, setStorage
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

addSubClass

protected static java.sql.PreparedStatement addSubClass

addClassChild

protected static java.sql.PreparedStatement addClassChild

addCls

protected static java.sql.PreparedStatement addCls
Constructor Detail

SpecReprRDFClass

public SpecReprRDFClass(gr.forth.ics.vrp.corevrp.model.RDF_Class rdf_class,
                        DBStorage storage)
Method Detail

initPreparedStatements

public static void initPreparedStatements(java.sql.Connection con,
                                          DBStorage storage)
                                   throws java.sql.SQLException
Initializes the Prepared Statements required for storing an RDF class object in the database.

getClasses

static java.util.ArrayList getClasses(java.sql.Connection con,
                                      DBStorage storage)
                               throws java.sql.SQLException
Returns the classes that have been stored in the DBMS.

storeClass

public void storeClass(DBValidator dbv)
                throws java.sql.SQLException
Classify the current class under the metaclasses contained in its type list. If no redundancies are permitted checks for any metaclass of the type list if it is a superclass of another metaclass in the type list. In that case doesn't classify the class under the metaclass.
Specified by:
storeClass in interface PersistentRDFClass
Overrides:
storeClass in class DBRDFClass
Parameters:
dbv - The DBStorage object
Throws:
java.sql.SQLException -  

storeNonLabelChildren

protected void storeNonLabelChildren(boolean direct)
                              throws java.sql.SQLException
Stores the classes that are descendants of the current class, through non-tree arcs
Throws:
java.sql.SQLException -  

isAdded

protected static boolean isAdded(int to,
                                 java.sql.ResultSet rs)
                          throws java.sql.SQLException

checkStoredSubClass

public boolean checkStoredSubClass()
                            throws java.sql.SQLException
Tests if the superclasses of the RDF class are identical to those stored in DBMS for this RDF class.
Specified by:
checkStoredSubClass in interface PersistentRDFClass
Overrides:
checkStoredSubClass in class DBRDFClass

storeRDFSInstantiationDescriptions

public void storeRDFSInstantiationDescriptions()
                                        throws java.sql.SQLException
Stores the instantiation links and the links of predefined RDFS properties that are defined on the RDF_Class object.
Specified by:
storeRDFSInstantiationDescriptions in interface PersistentRDFClass
Overrides:
storeRDFSInstantiationDescriptions in class DBRDFClass

storeSubClass

public void storeSubClass()
                   throws java.sql.SQLException
Stores in the SubClass table the rdfs:subClassOf link that is defined on RDF_Class object and is an arc of the tree constructed during the labeling on the class hierarchy . Moreover stores the non tree arcs of the node in the Class_Anc table.
Specified by:
storeSubClass in interface PersistentRDFClass
Overrides:
storeSubClass in class DBRDFClass

getURI

public static java.lang.String getURI(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)

store

public int store(DBValidator dbv)
          throws java.sql.SQLException
Stores an instantiation link between the RDF class and the class rdfs:Class and stores the rdfs:subClassOf links defined on the RDF class.
Specified by:
store in interface PersistentRDFClass
Overrides:
store in class DBRDFClass

getMetaClassesbelongs

public java.util.ArrayList getMetaClassesbelongs()
                                          throws java.sql.SQLException
Returns the identifiers of the metaclasses under which the class has been classified

getSubClassesOf

public static java.sql.ResultSet getSubClassesOf(int post,
                                                 int index,
                                                 boolean includeClass,
                                                 boolean isDAG,
                                                 java.sql.Connection con)
                                          throws java.sql.SQLException
Returns an ResultSet containing the post numbers of the stored subclasses of the class with post number .
Parameters:
includeClass - Indicates if the post number of the class will be included in the resultset.

getSuperClassesOf

public static java.sql.ResultSet getSuperClassesOf(int post,
                                                   boolean includeClass,
                                                   boolean isDAG,
                                                   java.sql.Connection con)
                                            throws java.sql.SQLException
Returns a ResultSet containing the post numbers of the stored superclasses of the class with post number .
Parameters:
includeClass - Indicates if the post number of the class will be included in the resultset.

isSubClass

public static 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.