com.bbn.swede.core.dom
Class PropertyNode

java.lang.Object
  extended bycom.bbn.swede.core.dom.OASTNode
      extended bycom.bbn.swede.core.dom.TagNode
          extended bycom.bbn.swede.core.dom.PropertyNode
Direct Known Subclasses:
AllValuesFrom, BackwardCompatibleWith, Cardinality, Comment, ComplementOf, DifferentFrom, DisjointWith, DistinctMembers, Domain, EquivalentClass, EquivalentProperty, First, GenericPredicate, HasValue, Imports, IncompatibleWith, IntersectionOf, InverseOf, Label, MaxCardinality, MinCardinality, OneOf, OnProperty, PriorVersion, Range, Rest, SameAs, SeeAlso, SomeValuesFrom, SubClassOf, SubPropertyOf, Type, UnionOf, VersionInfo

public abstract class PropertyNode
extends TagNode

Common implementation for property nodes. A property node is any tag that is treated as a predicate, either due to the type of the tag or based on its position in the document relative to other things and predicates.

Author:
jlerner

Nested Class Summary
 
Nested classes inherited from class com.bbn.swede.core.dom.OASTNode
OASTNode.NodeCleanupVisitor, OASTNode.NodeInitVisitor
 
Field Summary
protected  ReifiedStatement _reified
          The resource representing the reification of the statement formed by this property node.
protected  Statement _stmtAssoc
          The Jena statement resource associated with this property node.
 
Fields inherited from class com.bbn.swede.core.dom.OASTNode
_iLength, _iOffset, _nodeParent, _tree, AS_OWL, AS_RDF, AS_RDFS, BASE, COMMENT, DOCTYPE, DOCUMENT, GENERICATTRIBUTE, GENERICPREDICATE, GENERICTHING, LITERAL, NAMESPACE, OWL, OWL_ALLDIFFERENT, OWL_ALLVALUESFROM, OWL_ANNOTATIONPROPERTY, OWL_BACKWARDCOMPATIBLEWITH, OWL_CARDINALITY, OWL_CLASS, OWL_COMPLEMENTOF, OWL_DATARANGE, OWL_DATATYPEPROPERTY, OWL_DEPRECATEDCLASS, OWL_DEPRECATEDPROPERTY, OWL_DIFFERENTFROM, OWL_DISJOINTWITH, OWL_DISTINCTMEMBERS, OWL_EQUIVALENTCLASS, OWL_EQUIVALENTPROPERTY, OWL_FUNCTIONALPROPERTY, OWL_HASVALUE, OWL_IMPORTS, OWL_INCOMPATIBLEWITH, OWL_INTERSECTIONOF, OWL_INVERSEFUNCTIONALPROPERTY, OWL_INVERSEOF, OWL_MAXCARDINALITY, OWL_MINCARDINALITY, OWL_NOTHING, OWL_OBJECTPROPERTY, OWL_ONEOF, OWL_ONPROPERTY, OWL_ONTOLOGY, OWL_ONTOLOGYPROPERTY, OWL_PRIORVERSION, OWL_RESTRICTION, OWL_SAMEAS, OWL_SOMEVALUESFROM, OWL_SYMMETRICPROPERTY, OWL_THING, OWL_TRANSITIVEPROPERTY, OWL_UNIONOF, OWL_VERSIONINFO, PROCESSING_INSTRUCTION, RDF, RDF_ABOUT, RDF_ALT, RDF_BAG, RDF_DATATYPE, RDF_DESCRIPTION, RDF_FIRST, RDF_ID, RDF_LIST, RDF_NODEID, RDF_OBJECT, RDF_PARSETYPE, RDF_PREDICATE, RDF_PROPERTY, RDF_RDF, RDF_RESOURCE, RDF_REST, RDF_SEQ, RDF_STATEMENT, RDF_SUBJECT, RDF_TYPE, RDF_VALUE, RDF_XMLLITERAL, RDFS, RDFS_CLASS, RDFS_COMMENT, RDFS_CONTAINER, RDFS_CONTAINERMEMBERSHIPPROPERTY, RDFS_DATATYPE, RDFS_DOMAIN, RDFS_ISDEFINEDBY, RDFS_LABEL, RDFS_LITERAL, RDFS_MEMBER, RDFS_RANGE, RDFS_RESOURCE, RDFS_SEEALSO, RDFS_SUBCLASSOF, RDFS_SUBPROPERTYOF, S_OWL_URI, S_RDF_URI, S_RDFS_URI, S_XSD_URI, UNPARSEABLE, XML_VERSION
 
Constructor Summary
PropertyNode()
          Default constructor for property nodes.
PropertyNode(boolean bSingleton)
          Creates a parentless, childless node as either a singleton or with discrete begin and end tags.
 
Method Summary
protected  Statement createJenaStatement(Model model)
          Creates a Jena statement to represent the property node.
 Statement getAssociatedStatement()
          Retrieves the Jena statement associated with the node.
 OASTNode getObject()
          Retrieves the object of the statement represented by this property node.
 ReifiedStatement getReification()
          Retrieves the Jena resource representing the reification of the statement associated with this node.
protected  void removeJenaStatement(Model model)
          Removes this property's associated statement from the Jena model.
protected  void setAssociatedStatement(Statement stmt)
          Associates a Jena statement with the node.
 void setObjectLiteral(String sLiteral)
          Changes the object of this property to a literal.
 void setObjectResource(String sResourceURI)
          Changes the object of this property to a resource defined by a tag elsewhere.
 void setObjectTag(ClassNode tagObject)
          Changes the object of this property to an individual whose tags are nested within the property node.
protected  void setReification(ReifiedStatement rs)
          Associates a Jena reified statement resource with this node.
 
Methods inherited from class com.bbn.swede.core.dom.TagNode
addAttribute, appendChildAttribute, appendChildTag, clone, create, create, createRegions, createSingletonRegion, displace, duplicateType, generateNodeText, getAttribute, getAttributes, initRegions, isSingleton, prependChildAttribute, prependChildTag, removeAttribute, removeAttribute, setAttribute, setBeginRegion, setEndRegion, simplePartitioning, splitSingleton
 
Methods inherited from class com.bbn.swede.core.dom.OASTNode
accept, allowedChildren, appendChild, attach, cleanup, createChild, createChildAttribute, detach, displace, endsBefore, findCommonAncestor, findXmlBase, getChildren, getContainingChild, getDefaultNamespace, getFirstChild, getLastAttribute, getLength, getLevel, getLockObject, getName, getNamespace, getNamespaces, getNextChild, getNodesOfType, getNodesOfType, getNodeType, getOffset, getOWLAbstractSyntaxTree, getOWLDocument, getParent, getPreviousChild, getQName, getQName, getRoot, getUri, getXmlBase, init, insert, match, remove, replace, setLength, setOffset, startsAfter, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_stmtAssoc

protected Statement _stmtAssoc
The Jena statement resource associated with this property node. This may be null if the property is not part of a complete statement.


_reified

protected ReifiedStatement _reified
The resource representing the reification of the statement formed by this property node. May be null if the associated statement is not reified.

Constructor Detail

PropertyNode

public PropertyNode()
Default constructor for property nodes. Creates a parentless, childless node as a singleton tag.


PropertyNode

public PropertyNode(boolean bSingleton)
Creates a parentless, childless node as either a singleton or with discrete begin and end tags.

Parameters:
bSingleton - true to create a singleton tag, false to create discrete begin and end tags.
Method Detail

setAssociatedStatement

protected void setAssociatedStatement(Statement stmt)
Associates a Jena statement with the node.

Parameters:
stmt - The statement.

setReification

protected void setReification(ReifiedStatement rs)
Associates a Jena reified statement resource with this node.

Parameters:
rs - The reified statement resource.

getAssociatedStatement

public Statement getAssociatedStatement()
Retrieves the Jena statement associated with the node.

Returns:
The associated statement, or null if no statement is associated.

getReification

public ReifiedStatement getReification()
Retrieves the Jena resource representing the reification of the statement associated with this node.

Returns:
The reified statement resource, or null if the associated statement is not reified.

createJenaStatement

protected Statement createJenaStatement(Model model)

Creates a Jena statement to represent the property node. The resulting statement will be of the form [parentResource, getQName(), createObject()]. Statement creation will fail if there is no resource associated with the parent node or if getObject() fails.

If the node has an ID, the created statement will be flagged in the model as being reified.

Parameters:
model - The Jena model in which to create the statement.
Returns:
The created statement, or null if no statement could be created.
See Also:
#createObject(Model)

removeJenaStatement

protected void removeJenaStatement(Model model)
Removes this property's associated statement from the Jena model. If the same statement is specified by another node in the document, it will not be removed. If there is no statement associated with this node, nothing happens.

Parameters:
model - The model to remove the statement from.

setObjectLiteral

public void setObjectLiteral(String sLiteral)
                      throws OASTException
Changes the object of this property to a literal.

Parameters:
sLiteral - The text to use as the new object
Throws:
OASTException - if this node is attached to a read-only OAST

setObjectTag

public void setObjectTag(ClassNode tagObject)
                  throws OASTException
Changes the object of this property to an individual whose tags are nested within the property node.

Parameters:
tagObject - The individual to use as the new object
Throws:
OASTException - if this node is attached to a read-only OAST

setObjectResource

public void setObjectResource(String sResourceURI)
                       throws OASTException
Changes the object of this property to a resource defined by a tag elsewhere.

Parameters:
sResourceURI - The URI of the resource to use as the new object
Throws:
OASTException - if this node is attached to a read-only OAST

getObject

public OASTNode getObject()
                   throws OASTException
Retrieves the object of the statement represented by this property node. This node may be either an rdf:resource attribute, a literal, or a tag.

Returns:
The object of the statement, or null if this node is not part of a complete statement.
Throws:
OASTException - if the property has more than one child that could be interpreted as the object of the statement.


Copyright © 2004-2005 BBN Technologies. All Rights Reserved.