Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

nl.aidministrator.rdf.ral.rdbms
Class SQLRAL  view SQLRAL download SQLRAL.java

java.lang.Object
  extended bynl.aidministrator.rdf.ral.rdbms.SQLRAL
All Implemented Interfaces:
nl.aidministrator.rdf.ral.RAL
Direct Known Subclasses:
MySQLRAL, PostgreSQLRAL

public abstract class SQLRAL
extends java.lang.Object
implements nl.aidministrator.rdf.ral.RAL

An implementation of the Repository Abstraction Layer based on SQL, also SQL92 or SQL2, that implements an relational databaseschema developed in the project Sesame Advance at AIdministrator. Each DBMS has its own SQL dialect. For example each DBMS differs in datatypes, the variable length character datatype is defined in Oracle as nvarchar2(n) and in MySQL as varchar(n). This means that for each DBMS each SQL query must multiple times be defined. This is solved as described next. SQLRAL defines static final Strings, like ID_INT. Each time the integer datatype is used in a SQL query it is substituted by ID_INT. For each DBMS there is a subclass of SQLRAL defined. ID_INT is initialized in the subclass of SQLRAL for the specific DBMS. For example ID_INT for MySQL is initialized as int unsigned, for PostgreSQL as int4. SQLRAL is an abstract class, no instances of SQLRAL can be created.

Version:
1.13, 01/30/02

Field Summary
protected  nl.aidministrator.util.jdbc.ConnectionPool _conPool
          ConnectionPool between DBMS and RAL.
protected  java.util.Map _namespaceTable
          Map with as key namespace names, and as values Namespace object.
protected  int _nextNamespaceId
          Eliminating the need of querying the namespaces table looking for the next id to insert.
protected  int _nextValueId
          Eliminating the need of querying the resources and literals tables looking for the next id to insert.
protected  int _rdfPropertyId
          Id of rdf:Property.
protected  int _rdfsClassId
          Id of rdfs:Class.
protected  int _rdfsCommentId
          Id of rdfs:comment.
protected  int _rdfsDomainId
          Id of rdfs:domain.
protected  int _rdfsLabelId
          Id of rdfs:label.
protected  int _rdfsLiteralId
          Id of rdfs:Literal.
protected  int _rdfsRangeId
          Id of rdfs:range.
protected  int _rdfsResourceId
          Id of rdfs:Resource.
protected  int _rdfsSubClassOfId
          Id of rdfs:subClassOf.
protected  int _rdfsSubPropertyOfId
          Id of rdfs:subPropertyOf.
protected  int _rdfTypeId
          Id of rdf:Type.
protected  java.lang.String _reposName
          Repositoryname identifying repository.
static java.lang.String CLASS_TABLE
          Name of table containing classes.
protected  java.lang.String COMMENT
          Datatype of comment.
static java.lang.String COMMENT_TABLE
          Name of table containing comments.
static java.lang.String DOMAIN_TABLE
          Name of table containing domains.
protected  java.lang.String FALSE
          Boolean value false.
protected  java.lang.String ID_INT
          Integer datatype.
protected  java.lang.String INDEXLENGTH
          Length of an index.
protected  java.lang.String IS_DERIVED
          Datatype of boolean.
protected  java.lang.String LABEL
          Datatype of label.
static java.lang.String LABEL_TABLE
          Name of table containing labels.
protected  java.lang.String LANGUAGE
          Datatype of language of literal.
static java.lang.String LITERALS_TABLE
          Name of table containing literals.
protected  java.lang.String LOCALNAME
          Datatype of localname of resource.
protected  java.lang.String NAME
          Datatype of name of namespace.
static java.lang.String NAMESPACES_TABLE
          Name of table containing namespaces.
protected  java.lang.String PREFIX
          Datatype of prefix of namespace.
static java.lang.String PROPERTY_TABLE
          Name of table containing properties.
static java.lang.String RANGE_TABLE
          Name of table containing ranges.
static java.lang.String RESOURCES_TABLE
          Name of table containing resources.
static java.lang.String SUBCLASSOF_TABLE
          Name of table containing statements where predicate is rdfs:subClassOf
static java.lang.String SUBPROPERTYOF_TABLE
          Name of table containing statements where predicate is rdfs:subPropertyOf.
static java.lang.String TRIPLES_TABLE
          Name of table containing all statements.
protected  java.lang.String TRUE
          Boolean value true.
static java.lang.String TYPE_TABLE
          Name of table containing statements where predicate is rdf:type.
protected  java.lang.String VALUE
          Datatype of value of literal.
 
Constructor Summary
SQLRAL()
          Constructor.
 
Method Summary
private  void _addClass(int classId)
           
private  void _addDataStatement(int subjectId, int predicateId, int objectId, boolean is_derived)
           
private  void _addInstance(int valueId, int classId)
           
private  void _addInstance(int valueId, int classId, boolean is_derived)
           
private  int _addLiteral(java.lang.String language, java.lang.String value)
           
private  int _addNamespace(java.lang.String namespace)
           
private  int _addNamespace(java.lang.String prefix, java.lang.String namespace)
           
private  void _addProperty(int propertyId)
           
private  int _addResource(int namespaceId, java.lang.String localname)
           
private  void _addRow(java.lang.String tablename, int columnOne, boolean columnTwo)
           
private  void _addRow(java.lang.String tablename, int columnOne, int columnTwo, boolean columnThree)
           
private  void _addSubClass(int subClassId, int superClassId, boolean is_derived)
           
private  void _appendIds(nl.aidministrator.rdf.ral.ResourceIterator i, java.lang.StringBuffer query)
           
private  java.lang.String _convertBoolean(boolean b)
           
private  int _createIdForLiteral(nl.aidministrator.rdf.sail.model.Literal literal)
           
private  int _createIdForNamespace(java.lang.String namespace)
           
private  int _createIdForPrimitive(nl.aidministrator.rdf.sail.model.Resource resource)
           
private  int _createIdForResource(nl.aidministrator.rdf.sail.model.Resource resource)
           
private  int _createIdForValue(nl.aidministrator.rdf.sail.model.Value value)
           
private  void _dropTable(java.sql.Statement statement, java.lang.String tablename)
           
private  java.lang.String _escapeString(java.lang.String s)
           
private  void _executeUpdate(java.lang.String query)
           
private  nl.aidministrator.rdf.ral.ResourceIterator _getClassesOrProperties(java.lang.String tablename)
           
private  nl.aidministrator.rdf.ral.ResourceIterator _getCommentsOrLabelsFor(nl.aidministrator.rdf.sail.model.Resource resource, java.lang.String tablename)
           
private  nl.aidministrator.rdf.sail.model.Value _getDomainOrRangeFor(nl.aidministrator.rdf.sail.model.Resource property, java.lang.String tablename)
           
private  int _getLiteralId(nl.aidministrator.rdf.sail.model.Literal literal)
           
private  int _getNamespaceId(java.lang.String namespace)
           
private  int _getNextValueId()
           
private  int _getResourceId(nl.aidministrator.rdf.sail.model.Resource resource)
           
private  nl.aidministrator.rdf.ral.ResourceIterator _getSubClassesOrPropertiesOf(IdResource superResource, boolean recursive, java.lang.String tablename)
           
private  nl.aidministrator.rdf.ral.ResourceIterator _getSubClassesOrPropertiesOf(nl.aidministrator.rdf.sail.model.Resource superResource, boolean recursive, java.lang.String tablename)
           
private  nl.aidministrator.rdf.ral.ResourceIterator _getSuperClassesOrPropertiesOf(IdResource subResource, boolean recursive, java.lang.String tablename)
           
private  nl.aidministrator.rdf.ral.ResourceIterator _getSuperClassesOrPropertiesOf(nl.aidministrator.rdf.sail.model.Resource subResource, boolean recursive, java.lang.String tablename)
           
private  int _getValueId(nl.aidministrator.rdf.sail.model.Value value)
           
private  void _initData()
           
protected  void _initDatabase()
          Initializes the database.
private  void _initNamespaceTable()
           
private  boolean _isClassOrProperty(int classId, java.lang.String tablename)
           
private  boolean _isClassOrProperty(nl.aidministrator.rdf.sail.model.Value value, java.lang.String tablename)
           
private  boolean _isCommentOrLabel(nl.aidministrator.rdf.sail.model.Resource predicate, nl.aidministrator.rdf.sail.model.Literal object, java.lang.String tablename)
           
private  boolean _isRow(java.lang.String tablename, java.lang.String columnOne, int valueOne, java.lang.String columnTwo, int valueTwo)
           
private  boolean _isStatement(int subjectId, IdResource predicate, int objectId, boolean recursive)
           
private  boolean _isSubClassOrPropertyOf(nl.aidministrator.rdf.sail.model.Value subValue, nl.aidministrator.rdf.sail.model.Value superValue, java.lang.String tablename)
           
private  boolean _queryHasResults(java.lang.String query)
           
private  boolean _tableExists(java.lang.String tablename)
           
 void addClass(nl.aidministrator.rdf.sail.model.Resource classResource)
          Adds a class to the repository.
 void addComment(nl.aidministrator.rdf.sail.model.Resource resource, nl.aidministrator.rdf.sail.model.Literal comment)
          Adds a comment for resource 'resource' to the repository.
 void addDataStatement(nl.aidministrator.rdf.sail.model.Resource subject, nl.aidministrator.rdf.sail.model.Resource predicate, nl.aidministrator.rdf.sail.model.Value object)
          Adds a data statament to the repository.
 void addDomain(nl.aidministrator.rdf.sail.model.Resource property, nl.aidministrator.rdf.sail.model.Resource domainClass)
          Adds a domain restriction to the repository.
 void addInstance(nl.aidministrator.rdf.sail.model.Value dataValue, nl.aidministrator.rdf.sail.model.Resource classResource)
          Adds an instance of class 'classResource' to the repository.
 void addLabel(nl.aidministrator.rdf.sail.model.Resource resource, nl.aidministrator.rdf.sail.model.Literal label)
          Adds a label for resource 'resource' to the repository.
 void addProperty(nl.aidministrator.rdf.sail.model.Resource property)
          Adds a property to the repository.
 void addRange(nl.aidministrator.rdf.sail.model.Resource property, nl.aidministrator.rdf.sail.model.Resource rangeClass)
          Adds a range restriction to the repository.
 void addSubClass(nl.aidministrator.rdf.sail.model.Resource subClass, nl.aidministrator.rdf.sail.model.Resource superClass)
          Adds a subclass-relation to the repository.
 void addSubProperty(nl.aidministrator.rdf.sail.model.Resource subProp, nl.aidministrator.rdf.sail.model.Resource superProp)
          Adds a subproperty-relation to the repository.
 void clearRepository()
          Clears the repository.
 nl.aidministrator.rdf.ral.ResourceIterator getClasses()
          Gets all defined classes.
 nl.aidministrator.rdf.ral.ResourceIterator getCommentsFor(nl.aidministrator.rdf.sail.model.Resource resource)
          Gets all comments for the supplied resource.
 nl.aidministrator.rdf.sail.model.Value getDomainFor(nl.aidministrator.rdf.sail.model.Resource propertyResource)
          Gets the domain for the supplied property.
 nl.aidministrator.rdf.ral.ResourceIterator getInstancesOf(nl.aidministrator.rdf.sail.model.Resource classResource, boolean properInstances)
          Gets all instances of the supplied class.
 nl.aidministrator.rdf.ral.ResourceIterator getLabelsFor(nl.aidministrator.rdf.sail.model.Resource resource)
          Gets all labels for the supplied resource.
 nl.aidministrator.rdf.ral.NamespaceIterator getNamespaces()
          Gets the prefix and name of all namespaces.
 nl.aidministrator.rdf.ral.ResourceIterator getProperties()
          Gets all defined properties.
 nl.aidministrator.rdf.sail.model.Value getRangeFor(nl.aidministrator.rdf.sail.model.Resource propertyResource)
          Gets the range for the supplied property.
 nl.aidministrator.rdf.ral.StatementIterator getStatements(nl.aidministrator.rdf.sail.model.Resource source, nl.aidministrator.rdf.sail.model.Resource predicate, nl.aidministrator.rdf.sail.model.Value target, boolean recursive)
          Gets all statements with a specific predicate and, possibly, with a specific source and/or target.
 nl.aidministrator.rdf.ral.ResourceIterator getSubClassesOf(nl.aidministrator.rdf.sail.model.Resource classResource, boolean recursive)
          Gets all subclasses of the supplied class.
 nl.aidministrator.rdf.ral.ResourceIterator getSubPropertiesOf(nl.aidministrator.rdf.sail.model.Resource propertyResource, boolean recursive)
          Gets all subproperties of the supplied property.
 nl.aidministrator.rdf.ral.ResourceIterator getSuperClassesOf(nl.aidministrator.rdf.sail.model.Resource classResource, boolean recursive)
          Gets all superclasses of the supplied class.
 nl.aidministrator.rdf.ral.ResourceIterator getSuperPropertiesOf(nl.aidministrator.rdf.sail.model.Resource propertyResource, boolean recursive)
          Gets all superproperties of the supplied property.
 void initialize(java.util.Map configParams)
          Needed parameters (both key and value of type String):
jdbcDriver : The String representing the JDBC-driver class, e.g.
 boolean isClass(nl.aidministrator.rdf.sail.model.Value value)
          Checks whether the supplied resource represents a class.
 boolean isComment(nl.aidministrator.rdf.sail.model.Resource source, nl.aidministrator.rdf.sail.model.Literal target)
          Checks whether a comment with the specified source and target exisits.
 boolean isInstanceOf(nl.aidministrator.rdf.sail.model.Value dataValue, nl.aidministrator.rdf.sail.model.Resource classResource, boolean properInstances)
          Checks whether the supplied data resource is an instance of the supplied class.
 boolean isLabel(nl.aidministrator.rdf.sail.model.Resource source, nl.aidministrator.rdf.sail.model.Literal target)
          Checks whether a label with the specified source and target exists.
 boolean isProperty(nl.aidministrator.rdf.sail.model.Value resource)
          Checks whether the supplied resource represents a property.
 boolean isStatement(nl.aidministrator.rdf.sail.model.Resource source, nl.aidministrator.rdf.sail.model.Resource predicate, nl.aidministrator.rdf.sail.model.Value target, boolean recursive)
          Checks whether a specific statement is already present.
 boolean isSubClassOf(nl.aidministrator.rdf.sail.model.Value subClass, nl.aidministrator.rdf.sail.model.Value superClass)
          Checks whether one uri is a subclass of another (recursively).
 boolean isSubPropertyOf(nl.aidministrator.rdf.sail.model.Value subProperty, nl.aidministrator.rdf.sail.model.Value superProperty)
          Checks whether one property is a subproperty of another (recursively).
 void removeDataStatements(nl.aidministrator.rdf.sail.model.Resource subject, nl.aidministrator.rdf.sail.model.Resource predicate, nl.aidministrator.rdf.sail.model.Value object)
          Removes data statements that match the (subject, predicate, object) pattern from the repository.
 void shutDown()
          Allow the RAL to synchronize any stale data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NAMESPACES_TABLE

public static final java.lang.String NAMESPACES_TABLE
Name of table containing namespaces.

See Also:
Constant Field Values

RESOURCES_TABLE

public static final java.lang.String RESOURCES_TABLE
Name of table containing resources.

See Also:
Constant Field Values

LITERALS_TABLE

public static final java.lang.String LITERALS_TABLE
Name of table containing literals.

See Also:
Constant Field Values

CLASS_TABLE

public static final java.lang.String CLASS_TABLE
Name of table containing classes.

See Also:
Constant Field Values

PROPERTY_TABLE

public static final java.lang.String PROPERTY_TABLE
Name of table containing properties.

See Also:
Constant Field Values

SUBCLASSOF_TABLE

public static final java.lang.String SUBCLASSOF_TABLE
Name of table containing statements where predicate is rdfs:subClassOf

See Also:
Constant Field Values

SUBPROPERTYOF_TABLE

public static final java.lang.String SUBPROPERTYOF_TABLE
Name of table containing statements where predicate is rdfs:subPropertyOf.

See Also:
Constant Field Values

DOMAIN_TABLE

public static final java.lang.String DOMAIN_TABLE
Name of table containing domains.

See Also:
Constant Field Values

RANGE_TABLE

public static final java.lang.String RANGE_TABLE
Name of table containing ranges.

See Also:
Constant Field Values

TYPE_TABLE

public static final java.lang.String TYPE_TABLE
Name of table containing statements where predicate is rdf:type.

See Also:
Constant Field Values

COMMENT_TABLE

public static final java.lang.String COMMENT_TABLE
Name of table containing comments.

See Also:
Constant Field Values

LABEL_TABLE

public static final java.lang.String LABEL_TABLE
Name of table containing labels.

See Also:
Constant Field Values

TRIPLES_TABLE

public static final java.lang.String TRIPLES_TABLE
Name of table containing all statements.

See Also:
Constant Field Values

ID_INT

protected java.lang.String ID_INT
Integer datatype.


LOCALNAME

protected java.lang.String LOCALNAME
Datatype of localname of resource. varchar(64) is default datatype for Postgres and MySQL.


LANGUAGE

protected java.lang.String LANGUAGE
Datatype of language of literal. varchar(4) is default datatype for Postgres and MySQL.


VALUE

protected java.lang.String VALUE
Datatype of value of literal. text is default datatype for Postgres and MySQL.


PREFIX

protected java.lang.String PREFIX
Datatype of prefix of namespace. varchar(16) default datatype for Postgres and MySQL.


NAME

protected java.lang.String NAME
Datatype of name of namespace. text is default datatype for Postgres and MySQL.


IS_DERIVED

protected java.lang.String IS_DERIVED
Datatype of boolean. bool is default datatype for Postgres and MySQL.


COMMENT

protected java.lang.String COMMENT
Datatype of comment. text is default datatype for Postgres and MySQL.


LABEL

protected java.lang.String LABEL
Datatype of label. varchar(64) is default datatype for Postgres and MySQL.


INDEXLENGTH

protected java.lang.String INDEXLENGTH
Length of an index. Used by MySQL only when an index is created on a column with datatype text.


TRUE

protected java.lang.String TRUE
Boolean value true.


FALSE

protected java.lang.String FALSE
Boolean value false.


_reposName

protected java.lang.String _reposName
Repositoryname identifying repository.


_conPool

protected nl.aidministrator.util.jdbc.ConnectionPool _conPool
ConnectionPool between DBMS and RAL.


_nextNamespaceId

protected int _nextNamespaceId
Eliminating the need of querying the namespaces table looking for the next id to insert.


_nextValueId

protected int _nextValueId
Eliminating the need of querying the resources and literals tables looking for the next id to insert.


_rdfPropertyId

protected int _rdfPropertyId
Id of rdf:Property.


_rdfTypeId

protected int _rdfTypeId
Id of rdf:Type.


_rdfsResourceId

protected int _rdfsResourceId
Id of rdfs:Resource.


_rdfsLiteralId

protected int _rdfsLiteralId
Id of rdfs:Literal.


_rdfsClassId

protected int _rdfsClassId
Id of rdfs:Class.


_rdfsSubPropertyOfId

protected int _rdfsSubPropertyOfId
Id of rdfs:subPropertyOf.


_rdfsSubClassOfId

protected int _rdfsSubClassOfId
Id of rdfs:subClassOf.


_rdfsDomainId

protected int _rdfsDomainId
Id of rdfs:domain.


_rdfsRangeId

protected int _rdfsRangeId
Id of rdfs:range.


_rdfsCommentId

protected int _rdfsCommentId
Id of rdfs:comment.


_rdfsLabelId

protected int _rdfsLabelId
Id of rdfs:label.


_namespaceTable

protected java.util.Map _namespaceTable
Map with as key namespace names, and as values Namespace object. Acts as a cache.

Constructor Detail

SQLRAL

public SQLRAL()
Constructor. Initializes the namespace cache.

Method Detail

initialize

public void initialize(java.util.Map configParams)
                throws java.lang.Exception
Needed parameters (both key and value of type String):
jdbcDriver : The String representing the JDBC-driver class, e.g. "org.gjt.mm.mysql.Driver"
jdbcUrl : The String representing the JDBC-url of the database to connect to, e.g. "jdbc:mysql://localhost/sesame"
dbUser : The username that can be used to connect to the DBMS
dbPassword : The password of the user in the DBMS

Specified by:
initialize in interface nl.aidministrator.rdf.ral.RAL

shutDown

public void shutDown()
Description copied from interface: nl.aidministrator.rdf.ral.RAL
Allow the RAL to synchronize any stale data. The RAL can assume that shutDown() is called before an application is stopped.

Specified by:
shutDown in interface nl.aidministrator.rdf.ral.RAL

_initDatabase

protected void _initDatabase()
                      throws java.sql.SQLException
Initializes the database. _initDatabase() creates tables, indexes and inserts default values into the database.


_initData

private void _initData()
                throws java.sql.SQLException

_createIdForPrimitive

private int _createIdForPrimitive(nl.aidministrator.rdf.sail.model.Resource resource)
                           throws java.sql.SQLException

_addInstance

private void _addInstance(int valueId,
                          int classId)
                   throws java.sql.SQLException

_addProperty

private void _addProperty(int propertyId)
                   throws java.sql.SQLException

_addClass

private void _addClass(int classId)
                throws java.sql.SQLException

_initNamespaceTable

private void _initNamespaceTable()
                          throws java.sql.SQLException

addDataStatement

public void addDataStatement(nl.aidministrator.rdf.sail.model.Resource subject,
                             nl.aidministrator.rdf.sail.model.Resource predicate,
                             nl.aidministrator.rdf.sail.model.Value object)
                      throws java.sql.SQLException
Description copied from interface: nl.aidministrator.rdf.ral.RAL
Adds a data statament to the repository. The RAL can assume that the property 'predicate' has already been defined before.

Specified by:
addDataStatement in interface nl.aidministrator.rdf.ral.RAL

addProperty

public void addProperty(nl.aidministrator.rdf.sail.model.Resource property)
                 throws java.sql.SQLException
Description copied from interface: nl.aidministrator.rdf.ral.RAL
Adds a property to the repository.

Specified by:
addProperty in interface nl.aidministrator.rdf.ral.RAL

addClass

public void addClass(nl.aidministrator.rdf.sail.model.Resource classResource)
              throws java.sql.SQLException
Description copied from interface: nl.aidministrator.rdf.ral.RAL
Adds a class to the repository.

Specified by:
addClass in interface nl.aidministrator.rdf.ral.RAL

addInstance

public void addInstance(nl.aidministrator.rdf.sail.model.Value dataValue,
                        nl.aidministrator.rdf.sail.model.Resource classResource)
                 throws java.sql.SQLException
Description copied from interface: nl.aidministrator.rdf.ral.RAL
Adds an instance of class 'classResource' to the repository. The RAL can assume that the class 'classResource' has already been defined before.

Specified by:
addInstance in interface nl.aidministrator.rdf.ral.RAL

addSubProperty

public void addSubProperty(nl.aidministrator.rdf.sail.model.Resource subProp,
                           nl.aidministrator.rdf.sail.model.Resource superProp)
                    throws java.sql.SQLException
Description copied from interface: nl.aidministrator.rdf.ral.RAL
Adds a subproperty-relation to the repository. The RAL can assume that the two properties have already been defined before.

Specified by:
addSubProperty in interface nl.aidministrator.rdf.ral.RAL

addSubClass

public void addSubClass(nl.aidministrator.rdf.sail.model.Resource subClass,
                        nl.aidministrator.rdf.sail.model.Resource superClass)
                 throws java.sql.SQLException
Description copied from interface: nl.aidministrator.rdf.ral.RAL
Adds a subclass-relation to the repository. The RAL can assume that the two classes have already been defined before.

Specified by:
addSubClass in interface nl.aidministrator.rdf.ral.RAL

addDomain

public void addDomain(nl.aidministrator.rdf.sail.model.Resource property,
                      nl.aidministrator.rdf.sail.model.Resource domainClass)
               throws java.sql.SQLException
Description copied from interface: nl.aidministrator.rdf.ral.RAL
Adds a domain restriction to the repository. The RAL can assume that the property 'property' and the class 'domainClass' have already been defined before.

Specified by:
addDomain in interface nl.aidministrator.rdf.ral.RAL

addRange

public void addRange(nl.aidministrator.rdf.sail.model.Resource property,
                     nl.aidministrator.rdf.sail.model.Resource rangeClass)
              throws java.sql.SQLException
Description copied from interface: nl.aidministrator.rdf.ral.RAL
Adds a range restriction to the repository. The RAL can assume that the property 'property' and the class 'domainClass' have already been defined before.

Specified by:
addRange in interface nl.aidministrator.rdf.ral.RAL

addComment

public void addComment(nl.aidministrator.rdf.sail.model.Resource resource,
                       nl.aidministrator.rdf.sail.model.Literal comment)
                throws java.sql.SQLException
Description copied from interface: nl.aidministrator.rdf.ral.RAL
Adds a comment for resource 'resource' to the repository.

Specified by:
addComment in interface nl.aidministrator.rdf.ral.RAL

addLabel

public void addLabel(nl.aidministrator.rdf.sail.model.Resource resource,
                     nl.aidministrator.rdf.sail.model.Literal label)
              throws java.sql.SQLException
Description copied from interface: nl.aidministrator.rdf.ral.RAL
Adds a label for resource 'resource' to the repository.

Specified by:
addLabel in interface nl.aidministrator.rdf.ral.RAL

clearRepository

public void clearRepository()
                     throws java.sql.SQLException
Description copied from interface: nl.aidministrator.rdf.ral.RAL
Clears the repository. After the repository was cleared, it should be in the same state as after initialization.

Specified by:
clearRepository in interface nl.aidministrator.rdf.ral.RAL

removeDataStatements

public void removeDataStatements(nl.aidministrator.rdf.sail.model.Resource subject,
                                 nl.aidministrator.rdf.sail.model.Resource predicate,
                                 nl.aidministrator.rdf.sail.model.Value object)
                          throws java.sql.SQLException
Description copied from interface: nl.aidministrator.rdf.ral.RAL
Removes data statements that match the (subject, predicate, object) pattern from the repository. subject, predicate, or object may each be null, but at least one value must be specified.

Specified by:
removeDataStatements in interface nl.aidministrator.rdf.ral.RAL

_dropTable

private void _dropTable(java.sql.Statement statement,
                        java.lang.String tablename)
                 throws java.sql.SQLException

_addSubClass

private void _addSubClass(int subClassId,
                          int superClassId,
                          boolean is_derived)
                   throws java.sql.SQLException

_addInstance

private void _addInstance(int valueId,
                          int classId,
                          boolean is_derived)
                   throws java.sql.SQLException

_addRow

private void _addRow(java.lang.String tablename,
                     int columnOne,
                     boolean columnTwo)
              throws java.sql.SQLException

_addRow

private void _addRow(java.lang.String tablename,
                     int columnOne,
                     int columnTwo,
                     boolean columnThree)
              throws java.sql.SQLException

_addDataStatement

private void _addDataStatement(int subjectId,
                               int predicateId,
                               int objectId,
                               boolean is_derived)
                        throws java.sql.SQLException

_addResource

private int _addResource(int namespaceId,
                         java.lang.String localname)
                  throws java.sql.SQLException

_addLiteral

private int _addLiteral(java.lang.String language,
                        java.lang.String value)
                 throws java.sql.SQLException

_addNamespace

private int _addNamespace(java.lang.String namespace)
                   throws java.sql.SQLException

_addNamespace

private int _addNamespace(java.lang.String prefix,
                          java.lang.String namespace)
                   throws java.sql.SQLException

_createIdForValue

private int _createIdForValue(nl.aidministrator.rdf.sail.model.Value value)
                       throws java.sql.SQLException

_createIdForResource

private int _createIdForResource(nl.aidministrator.rdf.sail.model.Resource resource)
                          throws java.sql.SQLException

_createIdForLiteral

private int _createIdForLiteral(nl.aidministrator.rdf.sail.model.Literal literal)
                         throws java.sql.SQLException

_createIdForNamespace

private int _createIdForNamespace(java.lang.String namespace)
                           throws java.sql.SQLException

getNamespaces

public nl.aidministrator.rdf.ral.NamespaceIterator getNamespaces()
Description copied from interface: nl.aidministrator.rdf.ral.RAL
Gets the prefix and name of all namespaces.

Specified by:
getNamespaces in interface nl.aidministrator.rdf.ral.RAL

getStatements

public nl.aidministrator.rdf.ral.StatementIterator getStatements(nl.aidministrator.rdf.sail.model.Resource source,
                                                                 nl.aidministrator.rdf.sail.model.Resource predicate,
                                                                 nl.aidministrator.rdf.sail.model.Value target,
                                                                 boolean recursive)
Description copied from interface: nl.aidministrator.rdf.ral.RAL
Gets all statements with a specific predicate and, possibly, with a specific source and/or target. 'source' and 'target' parameters may be null to indicate wildcards.

Specified by:
getStatements in interface nl.aidministrator.rdf.ral.RAL

getClasses

public nl.aidministrator.rdf.ral.ResourceIterator getClasses()
Description copied from interface: nl.aidministrator.rdf.ral.RAL
Gets all defined classes.

Specified by:
getClasses in interface nl.aidministrator.rdf.ral.RAL

getSubClassesOf

public nl.aidministrator.rdf.ral.ResourceIterator getSubClassesOf(nl.aidministrator.rdf.sail.model.Resource classResource,
                                                                  boolean recursive)
Description copied from interface: nl.aidministrator.rdf.ral.RAL
Gets all subclasses of the supplied class. Note that the subclass relation is reflexive: a class is always a subclass of itself. rdfs:Resource is assumed to be the superclass of all classes.

Specified by:
getSubClassesOf in interface nl.aidministrator.rdf.ral.RAL

getSuperClassesOf

public nl.aidministrator.rdf.ral.ResourceIterator getSuperClassesOf(nl.aidministrator.rdf.sail.model.Resource classResource,
                                                                    boolean recursive)
Description copied from interface: nl.aidministrator.rdf.ral.RAL
Gets all superclasses of the supplied class. Note that the superclass relation is reflexive: a class is always a superclass of itself. rdfs:Resource is assumed to be the superclass of all classes.

Specified by:
getSuperClassesOf in interface nl.aidministrator.rdf.ral.RAL

getProperties

public nl.aidministrator.rdf.ral.ResourceIterator getProperties()
Description copied from interface: nl.aidministrator.rdf.ral.RAL
Gets all defined properties.

Specified by:
getProperties in interface nl.aidministrator.rdf.ral.RAL

getSubPropertiesOf

public nl.aidministrator.rdf.ral.ResourceIterator getSubPropertiesOf(nl.aidministrator.rdf.sail.model.Resource propertyResource,
                                                                     boolean recursive)
Description copied from interface: nl.aidministrator.rdf.ral.RAL
Gets all subproperties of the supplied property. Note that the subproperty relation is reflexive: a property is always a subproperty of itself.

Specified by:
getSubPropertiesOf in interface nl.aidministrator.rdf.ral.RAL

getSuperPropertiesOf

public nl.aidministrator.rdf.ral.ResourceIterator getSuperPropertiesOf(nl.aidministrator.rdf.sail.model.Resource propertyResource,
                                                                       boolean recursive)
Description copied from interface: nl.aidministrator.rdf.ral.RAL
Gets all superproperties of the supplied property. Note that the superproperty relation is reflexive: a property is always a subproperty of itself.

Specified by:
getSuperPropertiesOf in interface nl.aidministrator.rdf.ral.RAL

getDomainFor

public nl.aidministrator.rdf.sail.model.Value getDomainFor(nl.aidministrator.rdf.sail.model.Resource propertyResource)
Description copied from interface: nl.aidministrator.rdf.ral.RAL
Gets the domain for the supplied property.

Specified by:
getDomainFor in interface nl.aidministrator.rdf.ral.RAL

getRangeFor

public nl.aidministrator.rdf.sail.model.Value getRangeFor(nl.aidministrator.rdf.sail.model.Resource propertyResource)
Description copied from interface: nl.aidministrator.rdf.ral.RAL
Gets the range for the supplied property.

Specified by:
getRangeFor in interface nl.aidministrator.rdf.ral.RAL

getInstancesOf

public nl.aidministrator.rdf.ral.ResourceIterator getInstancesOf(nl.aidministrator.rdf.sail.model.Resource classResource,
                                                                 boolean properInstances)
Description copied from interface: nl.aidministrator.rdf.ral.RAL
Gets all instances of the supplied class. Everything is an instance of rdfs:Resource.

Specified by:
getInstancesOf in interface nl.aidministrator.rdf.ral.RAL

getCommentsFor

public nl.aidministrator.rdf.ral.ResourceIterator getCommentsFor(nl.aidministrator.rdf.sail.model.Resource resource)
Description copied from interface: nl.aidministrator.rdf.ral.RAL
Gets all comments for the supplied resource.

Specified by:
getCommentsFor in interface nl.aidministrator.rdf.ral.RAL

getLabelsFor

public nl.aidministrator.rdf.ral.ResourceIterator getLabelsFor(nl.aidministrator.rdf.sail.model.Resource resource)
Description copied from interface: nl.aidministrator.rdf.ral.RAL
Gets all labels for the supplied resource.

Specified by:
getLabelsFor in interface nl.aidministrator.rdf.ral.RAL

_getDomainOrRangeFor

private nl.aidministrator.rdf.sail.model.Value _getDomainOrRangeFor(nl.aidministrator.rdf.sail.model.Resource property,
                                                                    java.lang.String tablename)
                                                             throws java.sql.SQLException

_getSuperClassesOrPropertiesOf

private nl.aidministrator.rdf.ral.ResourceIterator _getSuperClassesOrPropertiesOf(nl.aidministrator.rdf.sail.model.Resource subResource,
                                                                                  boolean recursive,
                                                                                  java.lang.String tablename)
                                                                           throws java.sql.SQLException

_getSuperClassesOrPropertiesOf

private nl.aidministrator.rdf.ral.ResourceIterator _getSuperClassesOrPropertiesOf(IdResource subResource,
                                                                                  boolean recursive,
                                                                                  java.lang.String tablename)
                                                                           throws java.sql.SQLException

_getSubClassesOrPropertiesOf

private nl.aidministrator.rdf.ral.ResourceIterator _getSubClassesOrPropertiesOf(nl.aidministrator.rdf.sail.model.Resource superResource,
                                                                                boolean recursive,
                                                                                java.lang.String tablename)
                                                                         throws java.sql.SQLException

_getSubClassesOrPropertiesOf

private nl.aidministrator.rdf.ral.ResourceIterator _getSubClassesOrPropertiesOf(IdResource superResource,
                                                                                boolean recursive,
                                                                                java.lang.String tablename)
                                                                         throws java.sql.SQLException

_getCommentsOrLabelsFor

private nl.aidministrator.rdf.ral.ResourceIterator _getCommentsOrLabelsFor(nl.aidministrator.rdf.sail.model.Resource resource,
                                                                           java.lang.String tablename)
                                                                    throws java.sql.SQLException

_getClassesOrProperties

private nl.aidministrator.rdf.ral.ResourceIterator _getClassesOrProperties(java.lang.String tablename)
                                                                    throws java.sql.SQLException

_getValueId

private int _getValueId(nl.aidministrator.rdf.sail.model.Value value)
                 throws java.sql.SQLException

_getResourceId

private int _getResourceId(nl.aidministrator.rdf.sail.model.Resource resource)
                    throws java.sql.SQLException

_getLiteralId

private int _getLiteralId(nl.aidministrator.rdf.sail.model.Literal literal)
                   throws java.sql.SQLException

_getNamespaceId

private int _getNamespaceId(java.lang.String namespace)

_getNextValueId

private int _getNextValueId()
                     throws java.sql.SQLException

_isStatement

private boolean _isStatement(int subjectId,
                             IdResource predicate,
                             int objectId,
                             boolean r