RDFNode

An RDFNode is a non-literal node in an RDF datasource. The node may have child nodes which can retrieved and manipulated using RDFNode's methods. You should create an RDFNode by calling RDFDataSource's getNode method. In the methods below, properties should be a string URI's. Node references in arguments can be either RDFNodes, RDFLiterals or string URIs. Strings will be converted into nodes as needed.

Properties and Methods:

addChild ( child , exists )

Adds a node as a child of a container node. If exists is false, it will not be added if it already exists. If exists is true, it will be added regardless.

addChildAt ( child , index )

Adds a node as a child of a container node at a specific index.

addTarget ( prop , target )

Adds an assertion to the graph from the node to the target via the given property. This would be used to set properties of a resource.

addTargetOnce ( prop , target )

If an assertion already exists from the node to some target via the given property, the target is changed to a new one, specfied by the second argument. Otherwise, it is added.

getChildCount ( )

Returns the number of child nodes in a container node. Returns -1 if the element is not a container.

getChildIndex ( child )

Returns the index of the child in the container node. If the child is not in the container, -1 is returned.

getChildren ( )

Returns an RDFEnumerator of the children of the container node or null if the element is not a container.

getInProperties ( )

Returns an RDFEnumerator of all of the properties that point into the node. This means the properties that have this node as its value.

getProperties ( )

Returns an RDFEnumerator of all of the properties of the node.

getSource ( prop )

Returns the source of the node via the given property. If more than one exists, the first one is returned.

getSources ( prop )

Returns an enumeration of all sources pointing to the node via the given property.

getTarget ( prop )

Returns the target of the node via the given property. This is used to get a property of a node. If more than one exists, the first one is returned.

getTargets ( prop )

Returns an enumeration of all targets of the node via the given property.

inPropertyExists ( prop )

Returns true if there is a property that points into the node.

isAlt ( )

Returns true if the node is an RDF Alt container.

isBag ( )

Returns true if the node is an RDF Bag container.

isContainer ( )

Returns true if the node is an RDF container, whether it be a Bag, a Seq or an Alt.

isSeq ( )

Returns true if the node is an RDF Seq container.

makeAlt ( )

Turns the node into an RDF Alt container. This has no effect if the node is already a container.

makeBag ( )

Turns the node into an RDF Bag container. This has no effect if the node is already a container.

makeSeq ( )

Turns the node into an RDF Seq container. This has no effect if the node is already a container.

modifySource ( prop , oldsource , newsource )

Change an assertion that points to the node from oldsource to newsource. This is like changing the parent of a resource.

modifyTarget ( prop , oldtarget , newtarget )

Change the assertion via the given property from oldtarget to newtarget.

propertyExists ( prop )

Returns true if the given property exists for the node.

removeChild ( child )

Removes a child node from the container node.

removeChildAt ( index )

Removes a child at the specified index from the container node.

removeTarget ( prop , target )

Removes an assertion to target from the graph.

targetExists ( prop , target )

Returns true if an assertion exists from the node to the target via the given property.


Copyright (C) 1999 - 2003 XulPlanet.com