|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectgr.forth.ics.rdfsuite.swkm.model.impl.RDF_Model
gr.forth.ics.rdfsuite.swkm.model.db.impl.RDFDB_Model
public class RDFDB_Model
| Field Summary | |
|---|---|
static int |
EMPTY
Indicates that db is empty |
static int |
SPECIFIC
Represents the Specific representation suitable for ORDBMS |
static int |
SPECIFIC_NOSUBTABLE
Represents the variation of Specific representation suitable for RDBMS. |
static int |
SPECIFIC_UNIQUETABLE
Represents the variation of Specific representation where a unique table is created for all classes and a unique table for each property type |
| Constructor Summary | |
|---|---|
RDFDB_Model(java.lang.String dbPath,
java.lang.String db_login,
java.lang.String db_passwd,
int representation,
boolean cluster)
|
|
| Method Summary | |
|---|---|
void |
addGsInDB(int db_id,
java.lang.String graphspace_uri)
|
void |
addNsInDB(int db_id,
java.lang.String namespace_uri)
|
protected void |
addResource(IRDF_Resource resource)
|
protected void |
castResourcesToClasses(IRDF_MetaClass rdf_meta_class)
This method iterates over the type triples and casts to classes all resources that are subjects of triples with object this metaclass |
protected void |
castResourcesToClassInstances(IRDF_Class rdf_class)
This method iterates over the type triples and casts to class instances all resources that are subjects of triples with object this class |
protected void |
castResourcesToProperties(IRDF_MetaClass rdf_meta_class)
This method iterates over the type triples and casts to properties all resources that are subjects of triples with object this metaclass(of properties) |
protected void |
createPostorder(RDF_DAG subClassDag,
RDF_DAG subPropertyDag,
RDF_DAG subMetaClassDag,
RDF_DAG subMetaPropertyDag)
Creates the labeling |
protected int |
enter_property_instance(java.lang.String subject,
java.lang.String predicate,
java.lang.String object,
Position pos,
java.lang.String graphspace_uri,
java.lang.String namespace_uri,
boolean strict)
|
protected int |
enter_type(java.lang.String subject,
java.lang.String predicate,
java.lang.String object,
Position pos,
java.lang.String graphspace_uri,
boolean strict,
java.lang.String namespace_uri)
|
void |
fetchDirectDescsFromDB(java.util.Collection<IRDF_Schema_Resource> nodes)
Fetches the direct descendants of a class in main memory |
void |
fetchSubsumptionClassHierarchyInMainMemory(java.util.Collection<IntervalLabel> parentTreeLabels)
This methods fetched from database and creates the whole subsumption hierarchy starting from these labels |
void |
fetchSubsumptionMetaClassHierarchyInMainMemory(java.util.Collection<IntervalLabel> parentTreeLabels)
This methods fetches from database and creates the whole subsumption hierarchy starting from these labels |
void |
fetchSubsumptionPropertyHierarchyInMainMemory(java.util.Collection<IntervalLabel> parentTreeLabels)
This methods fetched from database and creates the whole subsumption hierarchy starting from these labels |
DBRepresentation |
getDb_representation()
|
DBValidator |
getDb_validator()
|
DBMSValues |
getDbms_values()
|
int |
getGsInDB(java.lang.String graphsapce_uri)
|
java.util.HashMap<java.lang.String,java.lang.Integer> |
getGsInDBs()
|
int |
getNsInDB(java.lang.String namesapce_uri)
|
java.util.HashMap<java.lang.String,java.lang.Integer> |
getNsInDBs()
|
IRDF_Graphspace |
getOrCreateGraphspace(java.lang.String graphspace_uri)
>>>>>>> .r2656 This method retrieves an RDF_Graphspace with a given uri. |
IRDFDB_Namespace |
getOrCreateNamespace(java.lang.String namespace_uri)
This method retrieves an RDF_Namespace with a given uri from MM. |
protected IRDF_Resource |
getResource(java.lang.String resource_uri)
|
protected java.util.HashMap |
getResources()
|
java.util.HashMap<java.lang.String,java.lang.Boolean> |
getStorableNSs()
|
StorageMetaData |
getStorage_metadata()
|
StorageParameters |
getStorage_parameters()
|
StorageUtilities |
getStorage_utilities()
|
protected org.apache.commons.collections.MultiMap |
getTypes_hashed_on_object()
|
protected java.util.Map |
getTypes_hashed_on_subject_object()
|
protected void |
import_namespace(java.lang.String import_namespace,
parser rdf_parser)
|
void |
import_namespaces(java.util.ArrayList import_namespaces,
java.lang.String base_uri)
VRP Comments: Will be called by the parser if he reached the EOF of the current file. |
void |
initDbSchema_()
|
void |
initDbSchema()
Creates the primitive tables in the database |
void |
initStoringParameters()
|
boolean |
isGsStorable(java.lang.String graphspace_uri)
Opines whether the given namespace is storable due to its own and its dependencies storability |
java.lang.Boolean |
isNsStorable(java.lang.String namespace_uri)
If a namespace is not explicitly set to non storable it is considered as storable |
protected void |
read_rdf_xml(java.io.InputStream file,
java.lang.String base_uri,
boolean fetch_dependencies,
boolean strict)
This method parses an RDF/XML file using vrp parser and creates the corresponding RDF_Namespace and RDF_Graphspace objects |
void |
read(java.io.InputStream file,
java.lang.String base_uri,
java.lang.String triple_format,
boolean fetch_dependencies,
boolean strict)
Receives input from an Input Stream an loads the corresponding namespaces/graphspaces to the model The base_uri given as a parameter should be the same as the one included in the file(if one) |
void |
read(java.lang.String filename,
java.lang.String base_uri,
java.lang.String triple_format,
boolean fetch_dependencies,
boolean strict)
Receives input from a file an loads the corresponding namespaces/graphspaces to the model The base_uri given as a parameter should be the same as the one included in the file(if one) |
protected void |
removeSubClassTriplesOf(IRDF_Class rdf_class)
|
void |
restoreReferences(java.lang.String uri,
IRDF_Resource new_resource)
Searches in all related namespaces for an RDF_Resource with uri "uri" and replaces it with new_resource Searches all triples in model for the occurence of a resource with uri "uri" and replaces it with new_resource Used in data dbvalidation |
void |
setDb_representation(DBRepresentation db_representation)
|
void |
setDb_validator(DBValidator db_validator)
|
void |
setDbms_values(DBMSValues dbms_values)
|
void |
setNsStorable(java.lang.String namespace_uri,
boolean storable)
|
protected void |
setResources(java.util.HashMap resources)
|
void |
setStorage_metadata(StorageMetaData storage_metadata)
|
void |
setStorage_parameters(StorageParameters storage_parameters)
|
void |
setStorage_utilities(StorageUtilities storage_utilities)
|
void |
setStoreableNSs(java.util.HashMap<java.lang.String,java.lang.Boolean> storeableNS)
|
void |
store(boolean validate)
Stores the schema and data loaded in this model |
void |
storeData()
Stores the data loaded in this model |
void |
storeSchema()
Stores the schemas loaded in main memory It is the user's responsibility to call validateSchema before if he requires validation |
protected void |
updateResourceReferencesInTriples(IRDF_Resource original_rdf_resource,
IRDF_Resource new_rdf_resource)
Replaces rdf_class with rdf_meta_class in all triples that rdf_class occures |
int |
validateData(DBValidator dbv)
Validates the data loaded in main memory. |
int |
validateSchema(DBValidator dbv)
Validates the schemas loaded in main memory with respect to possibly already stored schemas |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int EMPTY
public static final int SPECIFIC
public static final int SPECIFIC_NOSUBTABLE
public static final int SPECIFIC_UNIQUETABLE
| Constructor Detail |
|---|
public RDFDB_Model(java.lang.String dbPath,
java.lang.String db_login,
java.lang.String db_passwd,
int representation,
boolean cluster)
throws gr.forth.ics.rdfsuite.services.exceptions.InvalidDatabaseRepresentationException,
gr.forth.ics.rdfsuite.services.exceptions.InvalidDatabaseRepresentationException
dbPath - The host/port the dbms listens at. Example
localhost:5432/testdbdb_login - The username to connect to the dbmsdb_passwd - The password to connect to the dbmsrepresentation - The desired db representation. Predefined values DBRepresentation.SS
DBRepresentation.SSWS and DBRepresentation.Hybridcluster - If true clustering will be performed to the db tables
gr.forth.ics.rdfsuite.services.exceptions.InvalidDatabaseRepresentationException - if the given representation is not one of the predefined in RDFDB_Model| Method Detail |
|---|
public DBValidator getDb_validator()
public void setDb_validator(DBValidator db_validator)
public DBMSValues getDbms_values()
public void setDbms_values(DBMSValues dbms_values)
public StorageMetaData getStorage_metadata()
public void setStorage_metadata(StorageMetaData storage_metadata)
public StorageParameters getStorage_parameters()
public void setStorage_parameters(StorageParameters storage_parameters)
public StorageUtilities getStorage_utilities()
public void setStorage_utilities(StorageUtilities storage_utilities)
public void read(java.lang.String filename,
java.lang.String base_uri,
java.lang.String triple_format,
boolean fetch_dependencies,
boolean strict)
throws java.sql.SQLException,
java.lang.ClassNotFoundException,
java.io.IOException,
gr.forth.ics.rdfsuite.services.exceptions.ParsingException,
gr.forth.ics.rdfsuite.services.exceptions.TrigException,
gr.forth.ics.rdfsuite.services.exceptions.InvalidTripleFormatException
IRDF_Model
read in interface IRDF_Modelread in class RDF_Modelfilename - A Stringbase_uri - The base uri of the file.triple_format - RDF_Model.RDF_XML( For rdf/xml files),RDF_Model.TRIG( for trig files)fetch_dependencies - If true all the dependent namespacies will be fetched from their actual location(Requires
a valid uri to be set)strict - If true all the necessary checks will be performed while if it is false we will perform a "good will" building
java.sql.SQLException - if some query aborts
java.lang.ClassNotFoundException - If postgres driver is not found
java.io.IOException - In case the input stream is malformed
gr.forth.ics.rdfsuite.services.exceptions.ParsingException - In case something went wrong in the parsing of the file
gr.forth.ics.rdfsuite.services.exceptions.TrigException - In case the trig parser throws an Exception
gr.forth.ics.rdfsuite.services.exceptions.InvalidTripleFormatException - in case parameter triple format is not one of the predefined values
gr.forth.ics.rdfsuite.services.exceptions.NamespaceStoringException - in RDF_Model
public void read(java.io.InputStream file,
java.lang.String base_uri,
java.lang.String triple_format,
boolean fetch_dependencies,
boolean strict)
throws java.sql.SQLException,
java.lang.ClassNotFoundException,
java.io.IOException,
gr.forth.ics.rdfsuite.services.exceptions.ParsingException,
gr.forth.ics.rdfsuite.services.exceptions.TrigException,
gr.forth.ics.rdfsuite.services.exceptions.InvalidTripleFormatException
IRDF_Model
read in interface IRDF_Modelread in class RDF_Modelfile - An RDF/XML or TRIG Input Streambase_uri - If null then we retrieve the base uri from the file itselftriple_format - RDF_Model.RDF_XML( For rdf/xml files),RDF_Model.TRIG( for trig files)fetch_dependencies - If true all the dependent namespacies will be fetched from their actual location(Requiresstrict - If true all the necessary checks will be performed while if it is false we will perform a good will building
java.sql.SQLException - if some query aborts
java.lang.ClassNotFoundException - If postgres driver is not found
java.io.IOException - In case the input stream is malformed
gr.forth.ics.rdfsuite.services.exceptions.ParsingException - In case something went wrong in the parsing of the file
gr.forth.ics.rdfsuite.services.exceptions.TrigException - In case the trig parser throws an Exception
gr.forth.ics.rdfsuite.services.exceptions.InvalidTripleFormatException - in case parameter triple format is not one of the predefined values
gr.forth.ics.rdfsuite.services.exceptions.NamespaceStoringException - in RDF_Model
public void initStoringParameters()
throws java.sql.SQLException,
java.lang.ClassNotFoundException
java.sql.SQLException - If some sql query aborts
java.lang.ClassNotFoundException - If postgres driver is not found
public void import_namespaces(java.util.ArrayList import_namespaces,
java.lang.String base_uri)
RDF_Model
import_namespaces in interface IRDF_Modelimport_namespaces in class RDF_Modelimport_namespaces - the namespaces to be loaded in the modelbase_uri - the base uripublic java.util.HashMap<java.lang.String,java.lang.Integer> getNsInDBs()
public void addNsInDB(int db_id,
java.lang.String namespace_uri)
public int getNsInDB(java.lang.String namesapce_uri)
public java.util.HashMap<java.lang.String,java.lang.Integer> getGsInDBs()
public void addGsInDB(int db_id,
java.lang.String graphspace_uri)
public int getGsInDB(java.lang.String graphsapce_uri)
public java.util.HashMap<java.lang.String,java.lang.Boolean> getStorableNSs()
public java.lang.Boolean isNsStorable(java.lang.String namespace_uri)
namespace_uri -
public void setStoreableNSs(java.util.HashMap<java.lang.String,java.lang.Boolean> storeableNS)
public void setNsStorable(java.lang.String namespace_uri,
boolean storable)
namespace_uri - storable -
public void store(boolean validate)
throws java.sql.SQLException,
java.lang.ClassNotFoundException,
gr.forth.ics.rdfsuite.services.exceptions.LabelCreationException,
gr.forth.ics.rdfsuite.services.exceptions.InvalidDatabaseRepresentationException,
gr.forth.ics.rdfsuite.services.exceptions.NamespaceStoringException,
gr.forth.ics.rdfsuite.services.exceptions.ValidationException
store in interface IRDFDB_Modelif - true validates and stores else stores only (It is highly recommended to validate first)
java.sql.SQLException - if some sql query aborts
java.lang.ClassNotFoundException - if postgres driver is not found
gr.forth.ics.rdfsuite.services.exceptions.LabelCreationException - if something went wrong in the label creation
gr.forth.ics.rdfsuite.services.exceptions.InvalidDatabaseRepresentationException - if the given database representation is not one of the predefined in RDFDB_Model
gr.forth.ics.rdfsuite.services.exceptions.NamespaceStoringException - if the stored representation is not the same with the given one
gr.forth.ics.rdfsuite.services.exceptions.ValidationException - if the schema or data are not valid
public int validateSchema(DBValidator dbv)
throws java.sql.SQLException
dbv - DBValidator You can obtain it calling RDFDB_Model.getDb_validator()
java.sql.SQLException - if some sql query aborts
public void storeSchema()
throws java.sql.SQLException,
gr.forth.ics.rdfsuite.services.exceptions.InvalidDatabaseRepresentationException,
java.lang.ClassNotFoundException,
gr.forth.ics.rdfsuite.services.exceptions.LabelCreationException,
gr.forth.ics.rdfsuite.services.exceptions.NamespaceStoringException
java.sql.SQLException - if some sql query aborts
gr.forth.ics.rdfsuite.services.exceptions.InvalidDatabaseRepresentationException - if the given representation is not one of the predefined in the RDFDB_Model
java.lang.ClassNotFoundException - if postgres driver is not found
gr.forth.ics.rdfsuite.services.exceptions.LabelCreationException - if something went wrong in the label creation
gr.forth.ics.rdfsuite.services.exceptions.NamespaceStoringException - if the stored representation is not the same to the given oneRDFDB_Model.validateSchema(DBValidator dbv)
public int validateData(DBValidator dbv)
throws java.sql.SQLException
dbv - DBValidator You can obtain it calling RDFDB_Model.getDb_Validator
java.sql.SQLException - if some query aborts
protected void createPostorder(RDF_DAG subClassDag,
RDF_DAG subPropertyDag,
RDF_DAG subMetaClassDag,
RDF_DAG subMetaPropertyDag)
throws gr.forth.ics.rdfsuite.services.exceptions.LabelCreationException
createPostorder in class RDF_Modelgr.forth.ics.rdfsuite.services.exceptions.LabelCreationException - if something goes wrong in the label creation
java.sql.SQLException - if some sql query aborts
public void storeData()
throws java.sql.SQLException
dbPath - The database URL. The format is:
<postgreSQL server>:<port>/<dbname>
postgreSQL server: The machine where postgreSQL server is running.
port: The port where postgreSQL server is running. dbname: database name,
e.g., athena.ics.forth.gr:8080/testdbdb_representation - Database Represenation
java.sql.SQLException - if some sql query abortspublic boolean isGsStorable(java.lang.String graphspace_uri)
graphspace_uri -
public DBRepresentation getDb_representation()
public void setDb_representation(DBRepresentation db_representation)
public void restoreReferences(java.lang.String uri,
IRDF_Resource new_resource)
uri - An existing resource urinew_resource - The new resource with which it must me substituted
protected int enter_type(java.lang.String subject,
java.lang.String predicate,
java.lang.String object,
Position pos,
java.lang.String graphspace_uri,
boolean strict,
java.lang.String namespace_uri)
throws gr.forth.ics.rdfsuite.services.exceptions.TripleCreationException
enter_type in class RDF_Modelgr.forth.ics.rdfsuite.services.exceptions.TripleCreationException - Essentially if some sql query aborts
protected int enter_property_instance(java.lang.String subject,
java.lang.String predicate,
java.lang.String object,
Position pos,
java.lang.String graphspace_uri,
java.lang.String namespace_uri,
boolean strict)
throws gr.forth.ics.rdfsuite.services.exceptions.TripleCreationException
enter_property_instance in class RDF_Modelgr.forth.ics.rdfsuite.services.exceptions.TripleCreationException - Essentially if some sql query abortspublic IRDFDB_Namespace getOrCreateNamespace(java.lang.String namespace_uri)
RDF_Model
getOrCreateNamespace in interface IRDF_ModelgetOrCreateNamespace in class RDF_Modelnamespace_uri - the uri of the namespace
public IRDF_Graphspace getOrCreateGraphspace(java.lang.String graphspace_uri)
getOrCreateGraphspace in interface IRDF_ModelgetOrCreateGraphspace in class RDF_Modelgraphspace_uri - the uri of the graphspace
protected void read_rdf_xml(java.io.InputStream file,
java.lang.String base_uri,
boolean fetch_dependencies,
boolean strict)
throws java.io.IOException,
gr.forth.ics.rdfsuite.services.exceptions.ParsingException
read_rdf_xml in class RDF_Modelstrict - If true all the necessary checks will be performed while if it is false we will perform a good will building
java.io.IOException - if the input stream is malformed
gr.forth.ics.rdfsuite.services.exceptions.ParsingException - if something went wrong in the parsing of the file
protected void import_namespace(java.lang.String import_namespace,
parser rdf_parser)
throws gr.forth.ics.rdfsuite.services.exceptions.UnresolvedDependencyException
import_namespace in class RDF_Modelgr.forth.ics.rdfsuite.services.exceptions.UnresolvedDependencyException - if a namespace referenced by another namespace can be fetched neither from a
file nor from db nor from its actual web location
protected void updateResourceReferencesInTriples(IRDF_Resource original_rdf_resource,
IRDF_Resource new_rdf_resource)
updateResourceReferencesInTriples in class RDF_Modeloriginal_rdf_resource - new_rdf_resource - protected void addResource(IRDF_Resource resource)
addResource in class RDF_Modelprotected IRDF_Resource getResource(java.lang.String resource_uri)
getResource in class RDF_Modelprotected java.util.HashMap getResources()
getResources in class RDF_Modelprotected void setResources(java.util.HashMap resources)
setResources in class RDF_Modelprotected void castResourcesToClassInstances(IRDF_Class rdf_class)
castResourcesToClassInstances in class RDF_Modelrdf_class - protected void castResourcesToClasses(IRDF_MetaClass rdf_meta_class)
castResourcesToClasses in class RDF_Modelrdf_class - protected void castResourcesToProperties(IRDF_MetaClass rdf_meta_class)
castResourcesToProperties in class RDF_Modelrdf_meta_class - protected void removeSubClassTriplesOf(IRDF_Class rdf_class)
removeSubClassTriplesOf in class RDF_Modelprotected org.apache.commons.collections.MultiMap getTypes_hashed_on_object()
getTypes_hashed_on_object in class RDF_Modelprotected java.util.Map getTypes_hashed_on_subject_object()
getTypes_hashed_on_subject_object in class RDF_Model
public void fetchSubsumptionClassHierarchyInMainMemory(java.util.Collection<IntervalLabel> parentTreeLabels)
throws java.sql.SQLException
fetchSubsumptionClassHierarchyInMainMemory in interface IRDFDB_ModelparentLabels - the set containing all the tree labels of the parents of a new node
java.sql.SQLException
public void fetchSubsumptionPropertyHierarchyInMainMemory(java.util.Collection<IntervalLabel> parentTreeLabels)
throws java.sql.SQLException
fetchSubsumptionPropertyHierarchyInMainMemory in interface IRDFDB_Modellabels - A set of IntervalLabel objects
java.sql.SQLException
public void fetchSubsumptionMetaClassHierarchyInMainMemory(java.util.Collection<IntervalLabel> parentTreeLabels)
throws java.sql.SQLException
fetchSubsumptionMetaClassHierarchyInMainMemory in interface IRDFDB_Modellabels - A set of IntervalLabel objects
java.sql.SQLException
public void fetchDirectDescsFromDB(java.util.Collection<IRDF_Schema_Resource> nodes)
throws java.sql.SQLException
java.sql.SQLException
public void initDbSchema_()
throws java.lang.ClassNotFoundException,
java.sql.SQLException
java.sql.SQLException - if some sql query aborts
java.lang.ClassNotFoundException - if postgres driver is not found
public void initDbSchema()
throws java.sql.SQLException,
gr.forth.ics.rdfsuite.services.exceptions.PostgresConnectionException
IRDFDB_Model
initDbSchema in interface IRDFDB_Modeljava.sql.SQLException - if some sql query aborts
gr.forth.ics.rdfsuite.services.exceptions.PostgresConnectionException - if postgres driver is not found
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||