edu.stanford.db.rdf.uml
Class UMLModel

java.lang.Object
  |
  +--edu.stanford.db.rdf.uml.UMLModel

public class UMLModel
extends java.lang.Object
implements VirtualModel

A UML model supports inverse properties and generalization and validates UML schemas. For example, the following sets of objects/subjects are equivalent:

find(X, UMLCore.Feature_owner, null) or

find(null, UMLCore.Classifier_feature, X)

To determine whether X is a class, one can use:

find(X, RDF.type, UMLCore.Class) Validation supports typing and cardinality constraints. Currently, we do not check for ordered relationships.


Constructor Summary
UMLModel()
           
UMLModel(Model instances, Model schema)
           
UMLModel(NodeFactory f)
           
UMLModel(NodeFactory f, Model instances, Model schema)
           
 
Method Summary
 void add(Statement t)
          Adds a new triple to the model.
static java.util.Hashtable computeInverse(Model schema)
          Computes hashtable containing the names of the inverse relationships
 boolean contains(Statement t)
          Tests if the model contains the given triple.
 Model create()
          Creates empty model of the same Class
 Model duplicate()
          Clone the model.
 java.util.Enumeration elements()
          Enumerate triples
 Model find(Resource subject, Resource predicate, RDFNode object)
          General method to search for triples.
 Model getGroundModel()
           
 java.lang.String getLabel()
           
 NodeFactory getNodeFactory()
          Returns the node factory for this model
static Model getRDFSClassHierarchy(Model m)
          returns "A subClassOf B" instead of "R parent A & R child B" schema should be UMLModel (must not if generalization and specialization are not used)
 java.lang.String getSourceURI()
          Returns current base URI setting.
 java.lang.String getURI()
           
 boolean isEmpty()
          true if the model contains no triples
 boolean isMutable()
           
static void main(java.lang.String[] args)
           
 void remove(Statement t)
          Removes the triple from the model.
 void setSourceURI(java.lang.String uri)
          Set a base URI for the model.
 int size()
          Number of triples in the model
 java.lang.String toString()
           
static void validateRawSchema(Model instances, Model schema)
          Validates the model given instance and schema data
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UMLModel

public UMLModel(NodeFactory f)

UMLModel

public UMLModel()

UMLModel

public UMLModel(Model instances,
                Model schema)

UMLModel

public UMLModel(NodeFactory f,
                Model instances,
                Model schema)
Method Detail

getRDFSClassHierarchy

public static Model getRDFSClassHierarchy(Model m)
                                   throws ModelException
returns "A subClassOf B" instead of "R parent A & R child B" schema should be UMLModel (must not if generalization and specialization are not used)

computeInverse

public static java.util.Hashtable computeInverse(Model schema)
                                          throws ModelException
Computes hashtable containing the names of the inverse relationships

getLabel

public java.lang.String getLabel()
                          throws ModelException

getURI

public java.lang.String getURI()
                        throws ModelException

getGroundModel

public Model getGroundModel()
                     throws ModelException
Specified by:
getGroundModel in interface VirtualModel
Returns:
model contains the fact basis of this model

setSourceURI

public void setSourceURI(java.lang.String uri)
                  throws ModelException
Set a base URI for the model. Affects creating of new resources and serialization syntax. Inherited method getURI returns the URI set in this method

getSourceURI

public java.lang.String getSourceURI()
                              throws ModelException
Returns current base URI setting.

size

public int size()
         throws ModelException
Number of triples in the model
Returns:
number of triples, -1 if unknown

isEmpty

public boolean isEmpty()
                throws ModelException
true if the model contains no triples

elements

public java.util.Enumeration elements()
                               throws ModelException
Enumerate triples

contains

public boolean contains(Statement t)
                 throws ModelException
Tests if the model contains the given triple.
Returns:
true if the triple belongs to the model; false otherwise.

add

public void add(Statement t)
         throws ModelException
Adds a new triple to the model.

remove

public void remove(Statement t)
            throws ModelException
Removes the triple from the model.

isMutable

public boolean isMutable()
                  throws ModelException

find

public Model find(Resource subject,
                  Resource predicate,
                  RDFNode object)
           throws ModelException
General method to search for triples.

duplicate

public Model duplicate()
                throws ModelException
Clone the model.

create

public Model create()
             throws ModelException
Creates empty model of the same Class

getNodeFactory

public NodeFactory getNodeFactory()
                           throws ModelException
Returns the node factory for this model

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

validateRawSchema

public static void validateRawSchema(Model instances,
                                     Model schema)
                              throws ModelException
Validates the model given instance and schema data

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception