org.daml.validator.model
Class DAMLModelImpl

java.lang.Object
  |
  +--org.daml.validator.model.DAMLModelImpl

public class DAMLModelImpl
extends java.lang.Object

DAML model used by the validator. Supports a node based view of the RDF-API model with built in semantics from RDF and DAML. Contains code from NodeCenteredView by Mike Dean.


Nested Class Summary
 class DAMLModelImpl.List
           
 class DAMLModelImpl.Node
          A Node exists for a RDF-API Resource and contains all incoming and outgoing predicates as well as any equivalent Nodes.
 class DAMLModelImpl.NodeSet
           
 class DAMLModelImpl.Restriction
           
 
Field Summary
 java.util.Vector allPropertyClasses
           
 java.util.Vector ancestorPredicates
           
 java.util.Vector cardinalityPredicates
           
 java.util.Vector cardinalityQPredicates
           
 java.util.Vector classClasses
           
 java.util.Vector complementOfPredicates
           
 java.lang.Class DAMLVocabulary
           
 java.util.Vector datatypeClasses
           
 java.util.Vector datatypePropertyClasses
           
 java.util.Vector datatypeRestrictionClasses
           
 java.util.Vector domainPredicates
          Collection of predicates (RDF Resources) that represent domain
 java.util.Vector equivalentPredicates
          Collection of predicates (RDF Resources) that have an equivalence semantic.
 java.util.Vector equivalentToPredicates
           
 java.util.Vector hasClassPredicates
           
 java.util.Vector hasClassQPredicates
           
 java.util.Vector hasValuePredicates
           
 java.util.Vector importsPredicates
          Collection of predicates (RDF Resources) that represent the imports predicate
 java.util.Vector intersectionOfPredicates
           
 java.util.Vector listClasses
           
 java.util.Vector literalClasses
           
 java.util.Vector maxCardinalityPredicates
           
 java.util.Vector maxCardinalityQPredicates
           
 java.util.Vector minCardinalityPredicates
           
 java.util.Vector minCardinalityQPredicates
           
 com.hp.hpl.mesa.rdf.jena.model.Model model
          The Model this DAMLModel is based on.
 java.util.Vector objectPropertyClasses
           
 java.util.Vector objectRestrictionClasses
           
 java.util.Vector oneOfPredicates
           
 java.util.Vector onPropertyPredicates
           
 java.util.Vector propertyClasses
           
 java.util.Vector rangePredicates
          Collection of predicates (RDF Resources) that represent range
 java.util.Vector resourceClasses
           
 java.util.Vector restrictionClasses
          Collection of classes (RDF Resources) that represent the Restriction class
 java.util.Vector samePropertyAsPredicates
           
 java.util.Vector subClassOfPredicates
          Collection of predicates (RDF Resources) that have a subClass semantic.
 java.util.Vector subPropertyOfPredicates
           
 java.util.Vector thingClasses
           
 java.util.Vector toClassPredicates
           
 java.util.Vector typePredicates
           
 java.util.Vector unionOfPredicates
           
 java.util.Vector valuePredicates
           
 
Constructor Summary
DAMLModelImpl(DAMLDatatypeValidator datatypeValidator, Preferences preferences)
           
DAMLModelImpl(com.hp.hpl.mesa.rdf.jena.model.Model model, DAMLDatatypeValidator datatypeValidator, Preferences preferences)
          Create a new Node centered view from a Model.
 
Method Summary
 void addDatatypes(java.util.Collection datatypes)
           
 void addModel(com.hp.hpl.mesa.rdf.jena.model.Model rdfModel)
          Add the RDF Model to the DAML Model.
 java.util.Vector allInstances(java.lang.String cl)
          Finds all instances of the specified class.
protected  void createNodesFromModel(com.hp.hpl.mesa.rdf.jena.model.Model model)
           
 void defineGenericProperty(com.hp.hpl.mesa.rdf.jena.model.Resource property)
          Generate a generic definition for a property.
static java.util.Set equivalentNodes(java.util.Set nodes)
          Given a vector of nodes, returns a vector of all equivantent nodes.
 com.hp.hpl.mesa.rdf.jena.model.Statement findAnyStatement(com.hp.hpl.mesa.rdf.jena.model.Model model, java.util.Collection predicates)
          This version matches the complete URI of any of a set of predicates.
 com.hp.hpl.mesa.rdf.jena.model.Statement findAnyStatement(com.hp.hpl.mesa.rdf.jena.model.Model model, com.hp.hpl.mesa.rdf.jena.model.Resource predicate)
          This version matches the complete URI of the predicate.
 com.hp.hpl.mesa.rdf.jena.model.Statement findAnyStatement(com.hp.hpl.mesa.rdf.jena.model.Model model, java.lang.String predicate)
          Returns the first statement from the model that uses the given predicate.
static java.util.Vector getAllStatements(com.hp.hpl.mesa.rdf.jena.model.Model model, java.util.Collection predicates)
          Returns a vector of from the model that match the collection of predicate resources.
 java.util.Vector getAllStatements(com.hp.hpl.mesa.rdf.jena.model.Model model, DAMLModelImpl.Node predicate)
           
static java.util.Vector getAllStatements(com.hp.hpl.mesa.rdf.jena.model.Model model, com.hp.hpl.mesa.rdf.jena.model.Resource predicate)
           
 java.util.Set getDistinctValues(java.util.Collection statements)
          Determines the distinct values for a set of statements.
 DAMLModelImpl.Node getNode(com.hp.hpl.mesa.rdf.jena.model.Resource resource)
          Find the node for the given Resource.
 DAMLModelImpl.Node getNode(com.hp.hpl.mesa.rdf.jena.model.Resource resource, boolean create)
          Finds the Node for the given resource, possibly creating a new Node.
 java.util.Enumeration getNodes()
          Return all the nodes in the DAML Model
 DAMLModelImpl.Restriction getRestriction(DAMLModelImpl.Node node)
           
 boolean isInstanceOf(com.hp.hpl.mesa.rdf.jena.model.RDFNode instance, DAMLModelImpl.Node superclass)
           
protected  void mergeEquivalenceSets(DAMLModelImpl.Node n1, DAMLModelImpl.Node n2)
          Merge the equivalence relations between the two nodes (and all equivalent nodes).
static java.util.Set parentNodes(java.util.Set nodes)
          Given a vector of nodes, returns a vector of all parent classes for those nodes.
 void setDAMLVocabulary(java.lang.String DAMLVocabulary)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

model

public com.hp.hpl.mesa.rdf.jena.model.Model model
The Model this DAMLModel is based on.


equivalentPredicates

public java.util.Vector equivalentPredicates
Collection of predicates (RDF Resources) that have an equivalence semantic.


subClassOfPredicates

public java.util.Vector subClassOfPredicates
Collection of predicates (RDF Resources) that have a subClass semantic.


domainPredicates

public java.util.Vector domainPredicates
Collection of predicates (RDF Resources) that represent domain


rangePredicates

public java.util.Vector rangePredicates
Collection of predicates (RDF Resources) that represent range


importsPredicates

public java.util.Vector importsPredicates
Collection of predicates (RDF Resources) that represent the imports predicate


restrictionClasses

public java.util.Vector restrictionClasses
Collection of classes (RDF Resources) that represent the Restriction class


objectRestrictionClasses

public java.util.Vector objectRestrictionClasses

datatypeRestrictionClasses

public java.util.Vector datatypeRestrictionClasses

classClasses

public java.util.Vector classClasses

propertyClasses

public java.util.Vector propertyClasses

datatypePropertyClasses

public java.util.Vector datatypePropertyClasses

objectPropertyClasses

public java.util.Vector objectPropertyClasses

allPropertyClasses

public java.util.Vector allPropertyClasses

cardinalityPredicates

public java.util.Vector cardinalityPredicates

cardinalityQPredicates

public java.util.Vector cardinalityQPredicates

hasClassPredicates

public java.util.Vector hasClassPredicates

hasClassQPredicates

public java.util.Vector hasClassQPredicates

hasValuePredicates

public java.util.Vector hasValuePredicates

maxCardinalityPredicates

public java.util.Vector maxCardinalityPredicates

maxCardinalityQPredicates

public java.util.Vector maxCardinalityQPredicates

minCardinalityPredicates

public java.util.Vector minCardinalityPredicates

minCardinalityQPredicates

public java.util.Vector minCardinalityQPredicates

onPropertyPredicates

public java.util.Vector onPropertyPredicates

toClassPredicates

public java.util.Vector toClassPredicates

typePredicates

public java.util.Vector typePredicates

oneOfPredicates

public java.util.Vector oneOfPredicates

complementOfPredicates

public java.util.Vector complementOfPredicates

unionOfPredicates

public java.util.Vector unionOfPredicates

intersectionOfPredicates

public java.util.Vector intersectionOfPredicates

valuePredicates

public java.util.Vector valuePredicates

subPropertyOfPredicates

public java.util.Vector subPropertyOfPredicates

ancestorPredicates

public java.util.Vector ancestorPredicates

samePropertyAsPredicates

public java.util.Vector samePropertyAsPredicates

equivalentToPredicates

public java.util.Vector equivalentToPredicates

literalClasses

public java.util.Vector literalClasses

datatypeClasses

public java.util.Vector datatypeClasses

resourceClasses

public java.util.Vector resourceClasses

thingClasses

public java.util.Vector thingClasses

listClasses

public java.util.Vector listClasses

DAMLVocabulary

public java.lang.Class DAMLVocabulary
Constructor Detail

DAMLModelImpl

public DAMLModelImpl(com.hp.hpl.mesa.rdf.jena.model.Model model,
                     DAMLDatatypeValidator datatypeValidator,
                     Preferences preferences)
              throws com.hp.hpl.mesa.rdf.jena.model.RDFException
Create a new Node centered view from a Model.


DAMLModelImpl

public DAMLModelImpl(DAMLDatatypeValidator datatypeValidator,
                     Preferences preferences)
Method Detail

getDistinctValues

public java.util.Set getDistinctValues(java.util.Collection statements)
Determines the distinct values for a set of statements.


getNode

public DAMLModelImpl.Node getNode(com.hp.hpl.mesa.rdf.jena.model.Resource resource,
                                  boolean create)
Finds the Node for the given resource, possibly creating a new Node.

Parameters:
resource - Resource to find.
create - If true, a new Node will be created if none is found.

getNode

public DAMLModelImpl.Node getNode(com.hp.hpl.mesa.rdf.jena.model.Resource resource)
Find the node for the given Resource.

Parameters:
resource - Resource to find.
Returns:
Returns the Node for the Resource or null if no Node exists.

mergeEquivalenceSets

protected void mergeEquivalenceSets(DAMLModelImpl.Node n1,
                                    DAMLModelImpl.Node n2)
Merge the equivalence relations between the two nodes (and all equivalent nodes). Should this be a Node function?


setDAMLVocabulary

public void setDAMLVocabulary(java.lang.String DAMLVocabulary)
                       throws java.lang.ClassNotFoundException
java.lang.ClassNotFoundException

createNodesFromModel

protected void createNodesFromModel(com.hp.hpl.mesa.rdf.jena.model.Model model)
                             throws com.hp.hpl.mesa.rdf.jena.model.RDFException
com.hp.hpl.mesa.rdf.jena.model.RDFException

addModel

public void addModel(com.hp.hpl.mesa.rdf.jena.model.Model rdfModel)
              throws com.hp.hpl.mesa.rdf.jena.model.RDFException
Add the RDF Model to the DAML Model.

com.hp.hpl.mesa.rdf.jena.model.RDFException

allInstances

public java.util.Vector allInstances(java.lang.String cl)
                              throws java.lang.Exception
Finds all instances of the specified class. Note: Ignores the namespace portion of the class URI.

Returns:
a Vector of Nodes that are instances of the class.
java.lang.Exception

getNodes

public java.util.Enumeration getNodes()
Return all the nodes in the DAML Model


getAllStatements

public static java.util.Vector getAllStatements(com.hp.hpl.mesa.rdf.jena.model.Model model,
                                                com.hp.hpl.mesa.rdf.jena.model.Resource predicate)

getAllStatements

public java.util.Vector getAllStatements(com.hp.hpl.mesa.rdf.jena.model.Model model,
                                         DAMLModelImpl.Node predicate)

getAllStatements

public static java.util.Vector getAllStatements(com.hp.hpl.mesa.rdf.jena.model.Model model,
                                                java.util.Collection predicates)
Returns a vector of from the model that match the collection of predicate resources.


equivalentNodes

public static java.util.Set equivalentNodes(java.util.Set nodes)
Given a vector of nodes, returns a vector of all equivantent nodes. The resulting list includes the nodes from the initial list.


parentNodes

public static java.util.Set parentNodes(java.util.Set nodes)
Given a vector of nodes, returns a vector of all parent classes for those nodes.


getRestriction

public DAMLModelImpl.Restriction getRestriction(DAMLModelImpl.Node node)

findAnyStatement

public com.hp.hpl.mesa.rdf.jena.model.Statement findAnyStatement(com.hp.hpl.mesa.rdf.jena.model.Model model,
                                                                 java.lang.String predicate)
Returns the first statement from the model that uses the given predicate. Note: this ignores the URI.


findAnyStatement

public com.hp.hpl.mesa.rdf.jena.model.Statement findAnyStatement(com.hp.hpl.mesa.rdf.jena.model.Model model,
                                                                 com.hp.hpl.mesa.rdf.jena.model.Resource predicate)
This version matches the complete URI of the predicate.


findAnyStatement

public com.hp.hpl.mesa.rdf.jena.model.Statement findAnyStatement(com.hp.hpl.mesa.rdf.jena.model.Model model,
                                                                 java.util.Collection predicates)
This version matches the complete URI of any of a set of predicates.


isInstanceOf

public boolean isInstanceOf(com.hp.hpl.mesa.rdf.jena.model.RDFNode instance,
                            DAMLModelImpl.Node superclass)
                     throws com.hp.hpl.mesa.rdf.jena.model.RDFException
com.hp.hpl.mesa.rdf.jena.model.RDFException

defineGenericProperty

public void defineGenericProperty(com.hp.hpl.mesa.rdf.jena.model.Resource property)
                           throws com.hp.hpl.mesa.rdf.jena.model.RDFException
Generate a generic definition for a property. Undefined propertys are assumed to be a binary property with no globally applicable constraints.

com.hp.hpl.mesa.rdf.jena.model.RDFException

addDatatypes

public void addDatatypes(java.util.Collection datatypes)
                  throws com.hp.hpl.mesa.rdf.jena.model.RDFException
com.hp.hpl.mesa.rdf.jena.model.RDFException