Protégé-OWL 3.4

edu.stanford.smi.protegex.owl.server.triplestore
Class ClientTripleStoreModel

java.lang.Object
  extended by edu.stanford.smi.protegex.owl.server.triplestore.ClientTripleStoreModel
All Implemented Interfaces:
edu.stanford.smi.protege.util.Disposable, TripleStoreModel

public class ClientTripleStoreModel
extends Object
implements TripleStoreModel


Constructor Summary
ClientTripleStoreModel(OWLModel owlModel)
           
 
Method Summary
 TripleStore createActiveImportedTripleStore(edu.stanford.smi.protege.model.framestore.NarrowFrameStore frameStore)
          A low level method that creates and adds a new TripleStore to implement imports.
 void deleteTripleStore(TripleStore tripleStore)
          Deletes an imported TripleStore.
 void dispose()
          Cleans up all the triple stores managed by this.
 TripleStore getActiveTripleStore()
          Gets the currently "active" TripleStore, which all future set operations will be operating on.
 TripleStore getHomeTripleStore(edu.stanford.smi.protege.model.Instance subject, edu.stanford.smi.protege.model.Slot predicate, Object object)
          The home triple store of the triple defined by the method arguments.
 TripleStore getHomeTripleStore(RDFResource resource)
          Gets the "home" triple store of a given resource.
 Collection getPropertyValues(RDFResource resource, RDFProperty property)
          A low-level access method to access property values while the usual API methods are in an invalid state.
 Collection getSlotValues(edu.stanford.smi.protege.model.Instance instance, edu.stanford.smi.protege.model.Slot slot)
          Similar to getPropertyValues but for native Protege slots and instances.
 TripleStore getSystemTripleStore()
          Gets the System Triple Store.
 TripleStore getTopTripleStore()
          Gets the "top" TripleStore, which is the first user-editable TripleStore, from which all imports start.
 TripleStore getTripleStore(String name)
          Gets the TripleStore with a given name.
 TripleStore getTripleStoreByDefaultNamespace(String namespace)
          Gets the first TripleStore that uses a given default namespace.
 List<TripleStore> getTripleStores()
          Gets the TripleStores which provide an RDF triple-based view onto this OWLModel.
 boolean isActiveTriple(RDFResource subject, RDFProperty predicate, Object object)
          Checks if a given triple is stored in the currently active TripleStore.
 boolean isEditableTriple(RDFResource subject, RDFProperty predicate, Object object)
          Checks if a given triple is stored in an editable TripleStore.
 boolean isEditableTripleStore(TripleStore ts)
           
 Iterator<RDFResource> listSubjects(RDFProperty property)
          Returns an iterator of all subjects in any triplestore that have a value for property.
 Iterator<Triple> listTriplesWithSubject(RDFResource subject)
          Combines the result of the corresponding method of each TripleStore.
 Iterator<TripleStore> listUserTripleStores()
          Provides an Iterator on all user TripleStores, i.e.
 void replaceJavaObject(RDFResource subject)
           
 void setActiveTripleStore(TripleStore tripleStore)
          Specifies which TripleStore shall be the active one for future write operations.
 void setHomeTripleStore(RDFResource resource, TripleStore tripleStore)
          Moves a given RDFResource into another "home" TripleStore.
 void setTopTripleStore(TripleStore tripleStore)
          Sets the top level triple store to the currently active triple store.
 void setViewActiveOnly(boolean viewActiveOnly)
           
 void updateEditableResourceState()
          Changes the isIncluded() value of all resources to reflect the currently active TripleStore.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClientTripleStoreModel

public ClientTripleStoreModel(OWLModel owlModel)
Method Detail

createActiveImportedTripleStore

public TripleStore createActiveImportedTripleStore(edu.stanford.smi.protege.model.framestore.NarrowFrameStore frameStore)
Description copied from interface: TripleStoreModel
A low level method that creates and adds a new TripleStore to implement imports.

Specified by:
createActiveImportedTripleStore in interface TripleStoreModel
Parameters:
frameStore - the FrameStore to be used with the TripleStore
Returns:
the new TripleStore

deleteTripleStore

public void deleteTripleStore(TripleStore tripleStore)
Description copied from interface: TripleStoreModel
Deletes an imported TripleStore.

Specified by:
deleteTripleStore in interface TripleStoreModel
Parameters:
tripleStore - the TripleStore to delete (must be neither system nor top TripleStore)

dispose

public void dispose()
Description copied from interface: TripleStoreModel
Cleans up all the triple stores managed by this. This is called when an OWLModel is disposed (e.g. at project close in the UI).

Specified by:
dispose in interface edu.stanford.smi.protege.util.Disposable
Specified by:
dispose in interface TripleStoreModel

getActiveTripleStore

public TripleStore getActiveTripleStore()
Description copied from interface: TripleStoreModel
Gets the currently "active" TripleStore, which all future set operations will be operating on.

Specified by:
getActiveTripleStore in interface TripleStoreModel
Returns:
the active TripleStore
See Also:
TripleStoreModel.getTripleStores(), TripleStoreModel.setActiveTripleStore(edu.stanford.smi.protegex.owl.model.triplestore.TripleStore)

getHomeTripleStore

public TripleStore getHomeTripleStore(RDFResource resource)
Description copied from interface: TripleStoreModel
Gets the "home" triple store of a given resource. This can be used to determine the TripleStore where changes on the resource should be performed consistently. In the default implementation, the home TripleStore is the one that contains a :NAME slot value of the resource. The intention is that this will be where the resource is first defined (using the ordering defined by the imports tree with imported ontologies first). The reality is that this is not well defined. It is easy to imagine that there are several triple stores that have a :NAME slot value for the resource. In this case this routine chooses one of these triple stores at random.

Specified by:
getHomeTripleStore in interface TripleStoreModel
Parameters:
resource - the RDFResource to find the home TripleStore of
Returns:
the home TripleStore

getHomeTripleStore

public TripleStore getHomeTripleStore(edu.stanford.smi.protege.model.Instance subject,
                                      edu.stanford.smi.protege.model.Slot predicate,
                                      Object object)
Description copied from interface: TripleStoreModel
The home triple store of the triple defined by the method arguments.

Specified by:
getHomeTripleStore in interface TripleStoreModel
Parameters:
subject - - the subject of the triple
predicate - - the predicate of the triple
object - - the object of the triple
Returns:
- the triplestore in which the triple (subject, predicate, object) is defined

getPropertyValues

public Collection getPropertyValues(RDFResource resource,
                                    RDFProperty property)
Description copied from interface: TripleStoreModel
A low-level access method to access property values while the usual API methods are in an invalid state. This may be necessary during the direct manipulation of triples on a TripleStore level.

Specified by:
getPropertyValues in interface TripleStoreModel
Parameters:
resource - the resource to get the property values of
property - the property to get the values of
Returns:
a Collection of property values (may include RDFSLiterals)

getSlotValues

public Collection getSlotValues(edu.stanford.smi.protege.model.Instance instance,
                                edu.stanford.smi.protege.model.Slot slot)
Description copied from interface: TripleStoreModel
Similar to getPropertyValues but for native Protege slots and instances.

Specified by:
getSlotValues in interface TripleStoreModel
Parameters:
instance - the instance to get the values of
slot - the slot to get the values of
Returns:
a Collection of slot values (not including RDFSLiterals)

getSystemTripleStore

public TripleStore getSystemTripleStore()
Description copied from interface: TripleStoreModel
Gets the System Triple Store.

Specified by:
getSystemTripleStore in interface TripleStoreModel
Returns:
the system triple store

getTopTripleStore

public TripleStore getTopTripleStore()
Description copied from interface: TripleStoreModel
Gets the "top" TripleStore, which is the first user-editable TripleStore, from which all imports start.

Specified by:
getTopTripleStore in interface TripleStoreModel
Returns:
the top TripleStore (never null)

getTripleStore

public TripleStore getTripleStore(String name)
Description copied from interface: TripleStoreModel
Gets the TripleStore with a given name. For additional TripleStores, the name corresponds to the import URI.

Specified by:
getTripleStore in interface TripleStoreModel
Parameters:
name - the name / import URI of the TripleStore
Returns:
the TripleStore or null if none of this name exists

getTripleStoreByDefaultNamespace

public TripleStore getTripleStoreByDefaultNamespace(String namespace)
Description copied from interface: TripleStoreModel
Gets the first TripleStore that uses a given default namespace.

Specified by:
getTripleStoreByDefaultNamespace in interface TripleStoreModel
Parameters:
namespace - the namespace
Returns:
the TripleStore or null

getTripleStores

public List<TripleStore> getTripleStores()
Description copied from interface: TripleStoreModel
Gets the TripleStores which provide an RDF triple-based view onto this OWLModel. Warning: This is work in progress!

Specified by:
getTripleStores in interface TripleStoreModel
Returns:
a collection of TripleStore objects

isActiveTriple

public boolean isActiveTriple(RDFResource subject,
                              RDFProperty predicate,
                              Object object)
Description copied from interface: TripleStoreModel
Checks if a given triple is stored in the currently active TripleStore. This is a shortcut for getActiveTripleStore().contains(...).

Specified by:
isActiveTriple in interface TripleStoreModel
Parameters:
subject - the subject of the triple
predicate - the predicate of the triple
object - the object of the triple
Returns:
true if the value is found in the active TripleStore

isEditableTriple

public boolean isEditableTriple(RDFResource subject,
                                RDFProperty predicate,
                                Object object)
Description copied from interface: TripleStoreModel
Checks if a given triple is stored in an editable TripleStore. Editable TripleStores are those that could be saved to a local file, using the OWLModel's URIResolver.

Specified by:
isEditableTriple in interface TripleStoreModel
Parameters:
subject - the subject of the triple
predicate - the predicate of the triple
object - the object of the triple
Returns:
true if the value is found in an editable TripleStore

isEditableTripleStore

public boolean isEditableTripleStore(TripleStore ts)
Specified by:
isEditableTripleStore in interface TripleStoreModel

listSubjects

public Iterator<RDFResource> listSubjects(RDFProperty property)
Description copied from interface: TripleStoreModel
Returns an iterator of all subjects in any triplestore that have a value for property.

Specified by:
listSubjects in interface TripleStoreModel

listTriplesWithSubject

public Iterator<Triple> listTriplesWithSubject(RDFResource subject)
Description copied from interface: TripleStoreModel
Combines the result of the corresponding method of each TripleStore.

Specified by:
listTriplesWithSubject in interface TripleStoreModel
Parameters:
subject - the subject to get all triples of
Returns:
an Iterator of Triples

listUserTripleStores

public Iterator<TripleStore> listUserTripleStores()
Description copied from interface: TripleStoreModel
Provides an Iterator on all user TripleStores, i.e. all results of getTripleStores() except for the first (system) TripleStore.

Specified by:
listUserTripleStores in interface TripleStoreModel
Returns:
an Iterator of TripleStore objects

replaceJavaObject

public void replaceJavaObject(RDFResource subject)
Specified by:
replaceJavaObject in interface TripleStoreModel

setActiveTripleStore

public void setActiveTripleStore(TripleStore tripleStore)
Description copied from interface: TripleStoreModel
Specifies which TripleStore shall be the active one for future write operations.

Specified by:
setActiveTripleStore in interface TripleStoreModel
Parameters:
tripleStore - one of the results of a recent call to getTripleStores().

setHomeTripleStore

public void setHomeTripleStore(RDFResource resource,
                               TripleStore tripleStore)
Description copied from interface: TripleStoreModel
Moves a given RDFResource into another "home" TripleStore. This does not move any other triples but only moves the low-level information about which TripleStore shall be regarded as the "home" in the future. In Protege, this is the graph where the :NAME slot value is stored, i.e. moving the home means moving the :NAME value.

Specified by:
setHomeTripleStore in interface TripleStoreModel
Parameters:
resource - the RDFResource to move
tripleStore - the new home TripleStoe

setTopTripleStore

public void setTopTripleStore(TripleStore tripleStore)
Description copied from interface: TripleStoreModel
Sets the top level triple store to the currently active triple store. This should only be called early on in the initialization sequence. Use of this after an owl model is loaded will lead to unpredictable behavior.

Specified by:
setTopTripleStore in interface TripleStoreModel

setViewActiveOnly

public void setViewActiveOnly(boolean viewActiveOnly)
Specified by:
setViewActiveOnly in interface TripleStoreModel

updateEditableResourceState

public void updateEditableResourceState()
Description copied from interface: TripleStoreModel
Changes the isIncluded() value of all resources to reflect the currently active TripleStore. This should be called if the editable flag is relevant (e.g. in a user interface) after changes of the active TripleStore.

Specified by:
updateEditableResourceState in interface TripleStoreModel

Protégé-OWL 3.4

Submit a bug report or feature request
Copyright (c) 1998-2009 Stanford University.