Protégé-OWL 3.4.1

edu.stanford.smi.protegex.owl.model.triplestore.impl
Class TripleStoreImpl

java.lang.Object
  extended by edu.stanford.smi.protegex.owl.model.triplestore.impl.TripleStoreImpl
All Implemented Interfaces:
edu.stanford.smi.protege.util.Disposable, NamespaceMap, TripleStore

public class TripleStoreImpl
extends Object
implements TripleStore

A TripleStore that acts as a view on an existing NarrowFrameStore.

Author:
Holger Knublauch

Field Summary
protected  edu.stanford.smi.protege.model.Slot nameSlot
           
protected  edu.stanford.smi.protege.model.framestore.NarrowFrameStore narrowFrameStore
           
protected  String originalXMLBase
           
protected  OWLModel owlModel
           
protected  TripleStoreModel tripleStoreModel
           
 
Constructor Summary
TripleStoreImpl(OWLModel owlModel, edu.stanford.smi.protege.model.framestore.NarrowFrameStore frameStore, TripleStoreModel tripleStoreModel)
           
TripleStoreImpl(OWLModel owlModel, edu.stanford.smi.protege.model.framestore.NarrowFrameStore narrowFrameStore, TripleStoreModel tripleStoreModel, NamespaceManager namespaceManager, String name)
           
 
Method Summary
 void add(RDFResource subject, RDFProperty predicate, Object object)
           
 void add(Triple triple)
           
 void addIOAddress(String uri)
           
 boolean addValue(edu.stanford.smi.protege.model.Instance subject, edu.stanford.smi.protege.model.Slot slot, Object object)
           
 boolean contains(RDFResource subject, RDFProperty predicate, Object object)
           
 boolean contains(Triple triple)
           
 void dispose()
          Disposes this triple store.
 void dump(Level level)
          Debugging only.
 boolean equals(Object obj)
           
 String getDefaultNamespace()
           
 RDFResource getHomeResource(String name)
           
 Collection<String> getIOAddresses()
          Tracks the set of io names that have been used to retrieve this triple store.
 String getName()
           
 String getNamespaceForPrefix(String prefix)
           
 NamespaceManager getNamespaceManager()
           
 edu.stanford.smi.protege.model.framestore.NarrowFrameStore getNarrowFrameStore()
          Provides access to the internal Protege storage for low-level access.
 String getOriginalXMLBase()
           
 OWLOntology getOWLOntology()
           
 String getPrefix(String namespace)
           
 Collection<String> getPrefixes()
           
protected  Collection<edu.stanford.smi.protege.model.Reference> getReferences(Object search)
           
 Collection getSlotValues(edu.stanford.smi.protege.model.Instance instance, edu.stanford.smi.protege.model.Slot slot)
           
 Set<RDFSNamedClass> getUserDefinedClasses()
           
<X extends RDFResource>
Set<X>
getUserDefinedDirectInstancesOf(RDFSClass rdfsClass, Class<? extends X> javaClass)
          Returns the direct class instances defined in this triplestore as objects of X.
<X extends RDFResource>
Set<X>
getUserDefinedInstancesOf(RDFSClass rdfsClass, Class<? extends X> javaClass)
          Returns the all (direct and indirect) class instances defined in this triplestore as objects of X.
 Set<RDFProperty> getUserDefinedProperties()
           
protected  Collection getValues(edu.stanford.smi.protege.model.Instance instance, edu.stanford.smi.protege.model.Slot slot)
           
 int hashCode()
           
 Iterator<RDFResource> listHomeResources()
          Gets all resources that have their "home" in this triple store.
 Iterator listObjects(RDFResource subject, RDFProperty property)
          Gets the values of a given subject/property combination.
 Iterator listSubjects(RDFProperty property)
          The the subjects of all triples where a given property has any value.
 Iterator listSubjects(RDFProperty predicate, Object object)
          Gets the subjects of all triples with a given predicate and object.
 Iterator<Triple> listTriples()
           
 Iterator<Triple> listTriplesWithObject(RDFObject object)
          Lists all Triples that have a given object.
 Iterator listTriplesWithSubject(RDFResource subject)
          Lists all Triples that have a given subject.
 void remove(RDFResource subject, RDFProperty predicate, Object object)
           
 void remove(Triple triple)
           
 void removeIOAddress(String uri)
           
 void removePrefix(String prefix)
           
 void setDefaultNamespace(String value)
           
 void setDefaultNamespace(URI uri)
           
 void setName(String value)
           
 void setOriginalXMLBase(String xmlBase)
           
 void setPrefix(String namespace, String prefix)
           
 void setPrefix(URI namespace, String prefix)
           
 void sortPropertyValues(RDFResource resource, RDFProperty property, Comparator comparator)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

narrowFrameStore

protected edu.stanford.smi.protege.model.framestore.NarrowFrameStore narrowFrameStore

nameSlot

protected edu.stanford.smi.protege.model.Slot nameSlot

owlModel

protected OWLModel owlModel

tripleStoreModel

protected TripleStoreModel tripleStoreModel

originalXMLBase

protected String originalXMLBase
Constructor Detail

TripleStoreImpl

public TripleStoreImpl(OWLModel owlModel,
                       edu.stanford.smi.protege.model.framestore.NarrowFrameStore frameStore,
                       TripleStoreModel tripleStoreModel)

TripleStoreImpl

public TripleStoreImpl(OWLModel owlModel,
                       edu.stanford.smi.protege.model.framestore.NarrowFrameStore narrowFrameStore,
                       TripleStoreModel tripleStoreModel,
                       NamespaceManager namespaceManager,
                       String name)
Method Detail

getNamespaceManager

public NamespaceManager getNamespaceManager()
Specified by:
getNamespaceManager in interface TripleStore

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

listTriples

public Iterator<Triple> listTriples()
Specified by:
listTriples in interface TripleStore

hashCode

public int hashCode()
Overrides:
hashCode in class Object

add

public void add(Triple triple)
Specified by:
add in interface TripleStore

add

public void add(RDFResource subject,
                RDFProperty predicate,
                Object object)
Specified by:
add in interface TripleStore

addValue

public boolean addValue(edu.stanford.smi.protege.model.Instance subject,
                        edu.stanford.smi.protege.model.Slot slot,
                        Object object)

contains

public boolean contains(Triple triple)
Specified by:
contains in interface TripleStore

contains

public boolean contains(RDFResource subject,
                        RDFProperty predicate,
                        Object object)
Specified by:
contains in interface TripleStore

getDefaultNamespace

public String getDefaultNamespace()
Specified by:
getDefaultNamespace in interface NamespaceMap

getHomeResource

public RDFResource getHomeResource(String name)
Specified by:
getHomeResource in interface TripleStore

getOWLOntology

public OWLOntology getOWLOntology()
Specified by:
getOWLOntology in interface TripleStore

getName

public String getName()
Specified by:
getName in interface TripleStore

getNamespaceForPrefix

public String getNamespaceForPrefix(String prefix)
Specified by:
getNamespaceForPrefix in interface NamespaceMap

getNarrowFrameStore

public edu.stanford.smi.protege.model.framestore.NarrowFrameStore getNarrowFrameStore()
Description copied from interface: TripleStore
Provides access to the internal Protege storage for low-level access. This method should only be used by experienced users.

Specified by:
getNarrowFrameStore in interface TripleStore
Returns:
the NarrowFrameStore

getSlotValues

public Collection getSlotValues(edu.stanford.smi.protege.model.Instance instance,
                                edu.stanford.smi.protege.model.Slot slot)

getValues

protected Collection getValues(edu.stanford.smi.protege.model.Instance instance,
                               edu.stanford.smi.protege.model.Slot slot)

getPrefix

public String getPrefix(String namespace)
Specified by:
getPrefix in interface NamespaceMap

getPrefixes

public Collection<String> getPrefixes()
Specified by:
getPrefixes in interface NamespaceMap

getReferences

protected Collection<edu.stanford.smi.protege.model.Reference> getReferences(Object search)

listHomeResources

public Iterator<RDFResource> listHomeResources()
Description copied from interface: TripleStore
Gets all resources that have their "home" in this triple store. The home is defined to be the TripleStore with the :NAME value of the resource.

Specified by:
listHomeResources in interface TripleStore
Returns:
an Iterator of RDFResources

listObjects

public Iterator listObjects(RDFResource subject,
                            RDFProperty property)
Description copied from interface: TripleStore
Gets the values of a given subject/property combination.

Specified by:
listObjects in interface TripleStore
Returns:
a Collection of Objects (e.g. RDFResources)

listSubjects

public Iterator listSubjects(RDFProperty property)
Description copied from interface: TripleStore
The the subjects of all triples where a given property has any value. The Iterator does not contain duplicates.

Specified by:
listSubjects in interface TripleStore
Parameters:
property - the property to look for
Returns:
an Iterator of RDFResources

listSubjects

public Iterator listSubjects(RDFProperty predicate,
                             Object object)
Description copied from interface: TripleStore
Gets the subjects of all triples with a given predicate and object.

Specified by:
listSubjects in interface TripleStore
Parameters:
predicate - the predicate to match
object - the object to match
Returns:
an Iterator of RDFResources

listTriplesWithObject

public Iterator<Triple> listTriplesWithObject(RDFObject object)
Description copied from interface: TripleStore
Lists all Triples that have a given object.

Specified by:
listTriplesWithObject in interface TripleStore
Parameters:
object - the object to get the triples of
Returns:
an Iterator of Triples

listTriplesWithSubject

public Iterator listTriplesWithSubject(RDFResource subject)
Description copied from interface: TripleStore
Lists all Triples that have a given subject. In other words, this returns all property-value pairs of a given resource. Note that this operation is currently not efficiently implemented.

Specified by:
listTriplesWithSubject in interface TripleStore
Parameters:
subject - the subject in the triples
Returns:
an Iterator of Triples

getUserDefinedProperties

public Set<RDFProperty> getUserDefinedProperties()
Specified by:
getUserDefinedProperties in interface TripleStore
Returns:
All the user defined properties (non-system) defined in this triplestore.

getUserDefinedClasses

public Set<RDFSNamedClass> getUserDefinedClasses()
Specified by:
getUserDefinedClasses in interface TripleStore
Returns:
All the user defined classes (non-system) defined in this triplestore.

getUserDefinedDirectInstancesOf

public <X extends RDFResource> Set<X> getUserDefinedDirectInstancesOf(RDFSClass rdfsClass,
                                                                      Class<? extends X> javaClass)
Description copied from interface: TripleStore
Returns the direct class instances defined in this triplestore as objects of X.

Specified by:
getUserDefinedDirectInstancesOf in interface TripleStore

getUserDefinedInstancesOf

public <X extends RDFResource> Set<X> getUserDefinedInstancesOf(RDFSClass rdfsClass,
                                                                Class<? extends X> javaClass)
Description copied from interface: TripleStore
Returns the all (direct and indirect) class instances defined in this triplestore as objects of X.

Specified by:
getUserDefinedInstancesOf in interface TripleStore

remove

public void remove(Triple triple)
Specified by:
remove in interface TripleStore

remove

public void remove(RDFResource subject,
                   RDFProperty predicate,
                   Object object)
Specified by:
remove in interface TripleStore

setName

public void setName(String value)
Specified by:
setName in interface TripleStore

removePrefix

public void removePrefix(String prefix)
Specified by:
removePrefix in interface NamespaceMap

setDefaultNamespace

public void setDefaultNamespace(String value)
Specified by:
setDefaultNamespace in interface NamespaceMap

setDefaultNamespace

public void setDefaultNamespace(URI uri)
Specified by:
setDefaultNamespace in interface NamespaceMap

setPrefix

public void setPrefix(String namespace,
                      String prefix)
Specified by:
setPrefix in interface NamespaceMap

setPrefix

public void setPrefix(URI namespace,
                      String prefix)
Specified by:
setPrefix in interface NamespaceMap

sortPropertyValues

public void sortPropertyValues(RDFResource resource,
                               RDFProperty property,
                               Comparator comparator)
Specified by:
sortPropertyValues in interface TripleStore

getOriginalXMLBase

public String getOriginalXMLBase()
Specified by:
getOriginalXMLBase in interface TripleStore

setOriginalXMLBase

public void setOriginalXMLBase(String xmlBase)
Specified by:
setOriginalXMLBase in interface TripleStore

toString

public String toString()
Overrides:
toString in class Object

dump

public void dump(Level level)
Description copied from interface: TripleStore
Debugging only.

Specified by:
dump in interface TripleStore

dispose

public void dispose()
Description copied from interface: TripleStore
Disposes this triple store. Called by the triple store manager when an OWL model is disposed.

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

addIOAddress

public void addIOAddress(String uri)
Specified by:
addIOAddress in interface TripleStore

getIOAddresses

public Collection<String> getIOAddresses()
Description copied from interface: TripleStore
Tracks the set of io names that have been used to retrieve this triple store. This can be different than the ontology name in the case of a broken import statement.

Specified by:
getIOAddresses in interface TripleStore

removeIOAddress

public void removeIOAddress(String uri)
Specified by:
removeIOAddress in interface TripleStore

Protégé-OWL 3.4.1

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