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

Quick Search    Search Deep

nl.aidministrator.rdf.ral
Class SynchronizationRAL  view SynchronizationRAL download SynchronizationRAL.java

java.lang.Object
  extended bynl.aidministrator.rdf.ral.SynchronizationRAL
All Implemented Interfaces:
RAL

public class SynchronizationRAL
extends java.lang.Object
implements RAL

An implementation of the Repository Abstraction Layer which handles synchronization between write- and read-threads. This RAL implements a policy where read-threads can run concurrently, but write-threads need exclusive access to the abstraction layer, including the blocking of read-threads. No guarantees are given on the order in which threads take turn. Once threads have started they can finish their jobs.


Field Summary
protected  RAL _persistentRAL
           
private  int _readingThreads
           
private  boolean _writeRequested
           
 
Constructor Summary
SynchronizationRAL(RAL persistentRAL)
          Creates a new SynchronizationRAL that adds synchronization to the supplied RAL.
 
Method Summary
private  void _getReadLock()
           
private  void _getWriteLock()
           
private  void _releaseReadLock()
           
private  void _releaseWriteLock()
           
 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 propertyResource)
          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.
 ResourceIterator getClasses()
          Gets all defined classes.
 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.
 ResourceIterator getInstancesOf(nl.aidministrator.rdf.sail.model.Resource classResource, boolean properInstances)
          Gets all instances of the supplied class.
 ResourceIterator getLabelsFor(nl.aidministrator.rdf.sail.model.Resource resource)
          Gets all labels for the supplied resource.
 NamespaceIterator getNamespaces()
          Gets the prefix and name of all namespaces.
 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.
 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.
 ResourceIterator getSubClassesOf(nl.aidministrator.rdf.sail.model.Resource classResource, boolean recursive)
          Gets all subclasses of the supplied class.
 ResourceIterator getSubPropertiesOf(nl.aidministrator.rdf.sail.model.Resource propertyResource, boolean recursive)
          Gets all subproperties of the supplied property.
 ResourceIterator getSuperClassesOf(nl.aidministrator.rdf.sail.model.Resource classResource, boolean recursive)
          Gets all superclasses of the supplied class.
 ResourceIterator getSuperPropertiesOf(nl.aidministrator.rdf.sail.model.Resource propertyResource, boolean recursive)
          Gets all superproperties of the supplied property.
 void initialize(java.util.Map configParams)
          Initializes the RAL using a set of configuration parameters.
 boolean isClass(nl.aidministrator.rdf.sail.model.Value resource)
          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 exisits.
 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

_persistentRAL

protected RAL _persistentRAL

_writeRequested

private boolean _writeRequested

_readingThreads

private int _readingThreads
Constructor Detail

SynchronizationRAL

public SynchronizationRAL(RAL persistentRAL)
Creates a new SynchronizationRAL that adds synchronization to the supplied RAL.

Method Detail

initialize

public void initialize(java.util.Map configParams)
                throws java.lang.Exception
Description copied from interface: RAL
Initializes the RAL using a set of configuration parameters. The relevant names and values of the paramters are determined by the implementation of this interface.

Specified by:
initialize in interface RAL

shutDown

public void shutDown()
Description copied from interface: 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 RAL

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: 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 RAL

addProperty

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

Specified by:
addProperty in interface RAL

addClass

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

Specified by:
addClass in interface 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: 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 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: 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 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: 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 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: 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 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: 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 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: RAL
Adds a comment for resource 'resource' to the repository.

Specified by:
addComment in interface 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: RAL
Adds a label for resource 'resource' to the repository.

Specified by:
addLabel in interface 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: 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 RAL

clearRepository

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

Specified by:
clearRepository in interface RAL

getNamespaces

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

Specified by:
getNamespaces in interface RAL

getClasses

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

Specified by:
getClasses in interface RAL

isClass

public boolean isClass(nl.aidministrator.rdf.sail.model.Value resource)
Description copied from interface: RAL
Checks whether the supplied resource represents a class.

Specified by:
isClass in interface RAL

getSubClassesOf

public ResourceIterator getSubClassesOf(nl.aidministrator.rdf.sail.model.Resource classResource,
                                        boolean recursive)
Description copied from interface: 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 RAL

getSuperClassesOf

public ResourceIterator getSuperClassesOf(nl.aidministrator.rdf.sail.model.Resource classResource,
                                          boolean recursive)
Description copied from interface: 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 RAL

isSubClassOf

public boolean isSubClassOf(nl.aidministrator.rdf.sail.model.Value subClass,
                            nl.aidministrator.rdf.sail.model.Value superClass)
Description copied from interface: RAL
Checks whether one uri is a subclass of another (recursively). rdfs:Resource is assumed to be the superclass of all classes.

Specified by:
isSubClassOf in interface RAL

getProperties

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

Specified by:
getProperties in interface RAL

isProperty

public boolean isProperty(nl.aidministrator.rdf.sail.model.Value resource)
Description copied from interface: RAL
Checks whether the supplied resource represents a property.

Specified by:
isProperty in interface RAL

getSubPropertiesOf

public ResourceIterator getSubPropertiesOf(nl.aidministrator.rdf.sail.model.Resource propertyResource,
                                           boolean recursive)
Description copied from interface: 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 RAL

getSuperPropertiesOf

public ResourceIterator getSuperPropertiesOf(nl.aidministrator.rdf.sail.model.Resource propertyResource,
                                             boolean recursive)
Description copied from interface: 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 RAL

isSubPropertyOf

public boolean isSubPropertyOf(nl.aidministrator.rdf.sail.model.Value subProperty,
                               nl.aidministrator.rdf.sail.model.Value superProperty)
Description copied from interface: RAL
Checks whether one property is a subproperty of another (recursively).

Specified by:
isSubPropertyOf in interface RAL

getDomainFor

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

Specified by:
getDomainFor in interface RAL

getRangeFor

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

Specified by:
getRangeFor in interface RAL

getInstancesOf

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

Specified by:
getInstancesOf in interface RAL

isInstanceOf

public boolean isInstanceOf(nl.aidministrator.rdf.sail.model.Value dataValue,
                            nl.aidministrator.rdf.sail.model.Resource classResource,
                            boolean properInstances)
Description copied from interface: RAL
Checks whether the supplied data resource is an instance of the supplied class. Everything is an instance of rdfs:Resource.

Specified by:
isInstanceOf in interface RAL

getCommentsFor

public ResourceIterator getCommentsFor(nl.aidministrator.rdf.sail.model.Resource resource)
Gets all comments for the supplied resource.

Specified by:
getCommentsFor in interface RAL

isComment

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

Specified by:
isComment in interface RAL

getLabelsFor

public ResourceIterator getLabelsFor(nl.aidministrator.rdf.sail.model.Resource resource)
Gets all labels for the supplied resource.

Specified by:
getLabelsFor in interface RAL

isLabel

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

Specified by:
isLabel in interface RAL

getStatements

public 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: 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 RAL

isStatement

public 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)
Description copied from interface: RAL
Checks whether a specific statement is already present.

Specified by:
isStatement in interface RAL

_getWriteLock

private void _getWriteLock()

_releaseWriteLock

private void _releaseWriteLock()

_getReadLock

private void _getReadLock()

_releaseReadLock

private void _releaseReadLock()