edu.lehigh.swat.hawk.owl
Class OwlRdfReader

java.lang.Object
  extended by edu.lehigh.swat.hawk.core.OntReader
      extended by edu.lehigh.swat.hawk.owl.OwlRdfReader

public class OwlRdfReader
extends OntReader

OWL reader, reads OWL documents.


Constructor Summary
OwlRdfReader(StorageModel s)
          Constructor
OwlRdfReader(StorageModel s, java.lang.String blfile)
          Constructor
 
Method Summary
protected  boolean containsAnonymousChildren(AxiomNode node)
          This method determines if a given AxiomNode contains any anonymous children
protected  boolean eliminateAnonymousNode(Ontology ont, Axiom a, AxiomNode node, AxiomNode aNode, AxiomNode rNode, int d)
          If the given AxiomNode (node) or any of its descendants are equivalent to the anonymous node (aNode) then they are replaced by the replacement node (rNode)
protected  boolean eliminateAnonymousNode(Ontology ont, AxiomNode parent, AxiomNode node, AxiomNode aNode, AxiomNode rNode)
           
protected  RDFNode firstNode(NodeIterator ri)
          OilEd: Returns the first statement in a model.
 Axiom getCompletelyDefinedDefinitions(ObjectId sid, Ontology ont)
          This method return the object of the axioms where the given sid plays the role of the subject
 Proxy getProxy()
           
 boolean isAnonRestriction(AxiomNode res)
          This method returns true if the given restriction node is anonymous, false otherwise
protected  boolean isAnonymous(ObjectId id)
          Returns true of the given ObjectId is an anonymous node
protected  void mergeEquivalents(Ontology ont)
          This method wherever possible eliminates non top level axioms containing anonymous nodes either in the subject or the object position.
 Document read(java.io.InputStream in)
          Use empty string as XMl base.
 Document read(java.io.InputStream in, java.lang.String xmlBase)
          Read an input in OWL format to the model and return the document object
 Document read(java.lang.String url)
          Read document from given URL
protected  void readOntology(Ontology ont, Model model)
          Parse and construct an ontology.
 void resolveAnonResProperties(AxiomNode propRes, java.util.Vector<AxiomNode> temp, Ontology ont)
          This method resolves the anonymous properties occuring within a restriction.
 void resolveAnonymousRestrictions(Ontology ont)
          This method resolves all the restrictions nested within other axioms/restrictions and also stores the top level restrictions into the ontology
 void resolveNonAtomicRestrictions(java.util.Vector<AxiomNode> nonAtomicRestrictions, AxiomNode atomicRes, java.util.Vector<AxiomNode> atomicRestrictions, java.util.Vector<AxiomNode> tempA)
          This method resolves all the non-atomic restrictions.
 void resolveNonAtomicRestrictions(java.util.Vector<AxiomNode> nonAtomicRestrictions, Axiom axiom, java.util.Vector<AxiomNode> atomicRestrictions, java.util.Vector<Axiom> tempA, Ontology ont)
          This method resolves all the non-atomic restrictions.
 void resolveRestrictionsInAxioms(Axiom a, int pos, AxiomNode atomicRes, java.util.Vector<AxiomNode> temp)
          This method resolves all the anonymous restrictions occuring in an axiom by replacing them with their equivalent atomic restrictions.
 void resolveRestrictionsInAxioms(AxiomNode parent, AxiomNode child, AxiomNode atomicRes, java.util.Vector<AxiomNode> temp)
           
 void setProxy(Proxy p)
           
protected  boolean topLevel(AxiomNode node, AxiomNode aNode)
           
protected  boolean topLevel(Ontology ont, AxiomNode node)
          Returns true if the given AxiomNode is a top level node i.e.
protected  java.util.Collection unpackList(Model currentModel, Resource r)
          OilEd: Unpacks a RDF List into a collection of resources
 
Methods inherited from class edu.lehigh.swat.hawk.core.OntReader
getAllowUpdate, getLoadImports, setAllowUpdate, setLoadImports
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OwlRdfReader

public OwlRdfReader(StorageModel s)
             throws java.lang.Exception
Constructor

Throws:
java.lang.Exception

OwlRdfReader

public OwlRdfReader(StorageModel s,
                    java.lang.String blfile)
             throws java.lang.Exception
Constructor

Throws:
java.lang.Exception
Method Detail

read

public Document read(java.io.InputStream in)
              throws java.lang.Exception
Use empty string as XMl base.

Specified by:
read in class OntReader
Throws:
java.lang.Exception

read

public Document read(java.lang.String url)
              throws java.lang.Exception
Read document from given URL

Throws:
java.lang.Exception

read

public Document read(java.io.InputStream in,
                     java.lang.String xmlBase)
              throws java.lang.Exception
Read an input in OWL format to the model and return the document object

Throws:
java.lang.Exception

readOntology

protected void readOntology(Ontology ont,
                            Model model)
Parse and construct an ontology.


mergeEquivalents

protected void mergeEquivalents(Ontology ont)
This method wherever possible eliminates non top level axioms containing anonymous nodes either in the subject or the object position.

Parameters:
ont -

isAnonymous

protected boolean isAnonymous(ObjectId id)
Returns true of the given ObjectId is an anonymous node

Parameters:
id -
Returns:

containsAnonymousChildren

protected boolean containsAnonymousChildren(AxiomNode node)
This method determines if a given AxiomNode contains any anonymous children

Parameters:
node -
Returns:

eliminateAnonymousNode

protected boolean eliminateAnonymousNode(Ontology ont,
                                         Axiom a,
                                         AxiomNode node,
                                         AxiomNode aNode,
                                         AxiomNode rNode,
                                         int d)
If the given AxiomNode (node) or any of its descendants are equivalent to the anonymous node (aNode) then they are replaced by the replacement node (rNode)


eliminateAnonymousNode

protected boolean eliminateAnonymousNode(Ontology ont,
                                         AxiomNode parent,
                                         AxiomNode node,
                                         AxiomNode aNode,
                                         AxiomNode rNode)

topLevel

protected boolean topLevel(Ontology ont,
                           AxiomNode node)
Returns true if the given AxiomNode is a top level node i.e. does not occur in the object position of any axiom

Parameters:
ont -
node -
Returns:

topLevel

protected boolean topLevel(AxiomNode node,
                           AxiomNode aNode)

resolveAnonymousRestrictions

public void resolveAnonymousRestrictions(Ontology ont)
This method resolves all the restrictions nested within other axioms/restrictions and also stores the top level restrictions into the ontology

Parameters:
ont -

getCompletelyDefinedDefinitions

public Axiom getCompletelyDefinedDefinitions(ObjectId sid,
                                             Ontology ont)
This method return the object of the axioms where the given sid plays the role of the subject

Parameters:
sid -
ont -
Returns:

resolveRestrictionsInAxioms

public void resolveRestrictionsInAxioms(Axiom a,
                                        int pos,
                                        AxiomNode atomicRes,
                                        java.util.Vector<AxiomNode> temp)
This method resolves all the anonymous restrictions occuring in an axiom by replacing them with their equivalent atomic restrictions. Atomic restrictions are completed defined in terms of their onProperty, allValuesFrom/someValuesFrom/hasValue

Parameters:
a -
pos -
atomicRes -
temp -

resolveRestrictionsInAxioms

public void resolveRestrictionsInAxioms(AxiomNode parent,
                                        AxiomNode child,
                                        AxiomNode atomicRes,
                                        java.util.Vector<AxiomNode> temp)

resolveAnonResProperties

public void resolveAnonResProperties(AxiomNode propRes,
                                     java.util.Vector<AxiomNode> temp,
                                     Ontology ont)
This method resolves the anonymous properties occuring within a restriction. ex: if the onProperty is the inverse of some other property.

Parameters:
propRes -
temp -
ont -

resolveNonAtomicRestrictions

public void resolveNonAtomicRestrictions(java.util.Vector<AxiomNode> nonAtomicRestrictions,
                                         AxiomNode atomicRes,
                                         java.util.Vector<AxiomNode> atomicRestrictions,
                                         java.util.Vector<AxiomNode> tempA)
This method resolves all the non-atomic restrictions. Restrictions are non-atomic if either of their someValuesFrom/allValuesFrom/hasValue are anonymous.

Parameters:
nonAtomicRestrictions -
atomicRes -
atomicRestrictions -
tempA -

resolveNonAtomicRestrictions

public void resolveNonAtomicRestrictions(java.util.Vector<AxiomNode> nonAtomicRestrictions,
                                         Axiom axiom,
                                         java.util.Vector<AxiomNode> atomicRestrictions,
                                         java.util.Vector<Axiom> tempA,
                                         Ontology ont)
This method resolves all the non-atomic restrictions. Restrictions are non-atomic if either of their someValuesFrom/allValuesFrom/hasValue are anonymous.

Parameters:
nonAtomicRestrictions -
atomicRes -
atomicRestrictions -
tempA -

isAnonRestriction

public boolean isAnonRestriction(AxiomNode res)
This method returns true if the given restriction node is anonymous, false otherwise

Parameters:
res -
Returns:

unpackList

protected java.util.Collection unpackList(Model currentModel,
                                          Resource r)
OilEd: Unpacks a RDF List into a collection of resources


firstNode

protected RDFNode firstNode(NodeIterator ri)
OilEd: Returns the first statement in a model. Assumes there is one, so you've better have checked that before calling this.


getProxy

public Proxy getProxy()

setProxy

public void setProxy(Proxy p)