mozdev.org

JSLib
Page Updated: January 28, 2002
Latest Version: 0.1.375
Debug | Install | File I/O | RDF | Network | Sound | Utils | XUL | Zip
Home | Mailing List | Install | Source Code | Downloads | Bugs | docs | clients

RDFContainer ( will include rdfResource.js, rdfBase.js )

RDFContainer
RDF Container.prototype.addSeq
RDF Container.prototype.addAlt
RDFContainer .prototype.addBag

RDF Container.prototype.getNode
RDF
Container .prototype.addNode


RDF Container.prototype.getSubSeqs
RDFContainer .prototype.getSubAlts
RDFContainer .prototype.getSubBags
RDFContainer .prototype.getSubContainers
RDFContainer .prototype.getSubNodes

RDFContainer .prototype.remove


RDFContainer

RDFContainer is a class to manipulate rdf containers.

Note:  This class is not intended to be directly created.  RDF or RDFFile should create this for you.  See RDF.getRootSeq() for an example.

void RDFContainer (string aType, string aPath, string aParent, 
nsIRDFDataSource aDatasource)


Constructs an RDFContainer by its type and paths in the datasource.

aType - defines the type, see below.
aPath
- a resource path of the container.
aParent - a resource path to the parent if any (null if no parent).
aDatasource - an nsIRDFDataSource object.

Possible aTypes values:

Example:
var container = new RDFContainer(aType, aContainer, this.parent, this.dsource);

    RDFContainer .prototype.addSeq

Adds a sequence relative to this one.

RDFContainer addSeq (string aRelPath)


Returns a RDFContainer based on the relative resource path argument and the resource path of this container.  For example, if this container has a path of "urn:test:bob" and "addresses" was passed in as the argument, the newly created container would have a path of "urn:test:bob:addresses".

aRelPath - Relative resource path of the container.

Example:
var gRDF = new RDFFile(path);
var seq = gRDF.getRootSeq("urn:test:bob");
var newseq = seq.addSeq("addresses");


    RDFContainer .prototype.addAlt

Adds a Alt relative to this one.

RDFContainer addAlt (string aRelPath)


Returns a RDFContainer based on the relative resource path argument and the resource path of this container.  For example, if this container has a path of "urn:test:bob" and "addresses" was passed in as the argument, the newly created container would have a path of "urn:test:bob:addresses".

aRelPath - Relative resource path of the container.

Example:
var gRDF = new RDFFile(path);
var alt = gRDF.getRootAlt("urn:test:bob");
var newalt = seq.addAlt("addresses");
 

    RDFContainer .prototype.addBag

Adds a Bag relative to this one.

RDFContainer addBag (string aRelPath)


Returns a RDFContainer based on the relative resource path argument and the resource path of this container.  For example, if this container has a path of "urn:test:bob" and "addresses" was passed in as the argument, the newly created container would have a path of "urn:test:bob:addresses".

aRelPath - Relative resource path of the container.

Example:
var gRDF = new RDFFile(path);
var seq = gRDF.getRootSeq("urn:test:bob");
var newbag = seq.addBag("addresses");


    RDFContainer .prototype.getNode

Get a relative node from the rdf datasource.

RDFResource getNode (string aRelPath)


Returns an RDFResource for a given relative resource path in the rdf graph.

aRelPath - Relative resource path of the node.

Example:
var gRDF = new RDFFile(path );
var seq = gRDF.getRootSeq("urn:test:bob");
var node = seq.getNode("mynode1");


    RDFContainer .prototype.addNode

Add a node to the rdf datasource.

RDFResource addNode (string aRelPath)


Creates and returns an RDFResource for a given relative resource path in the rdf graph.

aRelPath - Relative resource path of the node.

Example:
var gRDF = new RDFFile(path );
var seq = gRDF.getRootSeq("urn:test:bob");
var node = seq.addNode("mynode1");


    RDFContainer .prototype.getSubSeqs

Get relative sequences from the rdf datasource.

Array of RDFContainers getSubSeqs ()


Returns a list of RDFContainers of type sequence that arc from this container.

Example:
var gRDF = new RDFFile(path );
var seq = gRDF.getRootSeq("urn:test:bob");
var list = gRDF.getSubSeqs();
for(var i=0; i<list.length; i++) {
    ...
}


    RDF Container.prototype.getSubAlts

Get relative alts from the rdf datasource.

Array of RDFContainers getSubAlts ()


Returns a list of RDFContainers of type alt that arc from this container.

Example:
var gRDF = new RDFFile(path );
var alt = gRDF.getRootAlt("urn:test:bob");
var list = gRDF.getSubAlts();
for(var i=0; i<list.length; i++) {
    ...
}


    RDFContainer .prototype.getSubBags

Get relative bags from the rdf datasource.

Array of RDFContainers getSubBags ()


Returns a list of RDFContainers of type bag that arc from this container.

Example:
var gRDF = new RDFFile(path );
var alt = gRDF.getRootAlt("urn:test:bob");
var list = gRDF.getSubBags();
for(var i=0; i<list.length; i++) {
    ...
}


    RDFContainer .prototype.getSubContainers

Get relative containers from the rdf datasource.

Array of RDFContainers getSubBags ()


Returns a list of RDFContainers of any type that arc from this container.

Example:
var gRDF = new RDFFile(path );
var alt = gRDF.getRootAlt("urn:test:bob");
var list = gRDF.getSubContainers();
for(var i=0; i<list.length; i++) {
    if(list[i].type == "bag") {
        ...
    }
}


    RDFContainer .prototype.getSubNodes

Get relative nodes from the rdf datasource.

Array of RDFResource getSubNodes ()


Returns a list of RDFResources that arc from this container.

Example:
var gRDF = new RDFFile(path );
var alt = gRDF.getRootAlt("urn:test:bob");
var list = gRDF.getSubNodes();
for(var i=0; i<list.length; i++)
   ...
}


    RDFContainer .prototype.remove

Remove this resource from the datasource.

void remove (boolean aDeep)


Removes the resource from the datasource.  Remember, that you have to flush the datasource to have this actually take affect.  If aDeep is true, it will remove this container and anything it points to (be carefull, it would be easy to get into trouble here).  An internal valid boolean will be set to false, and any manipulation of this container will fail.

aDeep (optional) - To recursively remove or not.

 Example:

var gRDF = new RDFFile(path);
var alt = gRDF.getRootAlt("urn:test:bob");
alt.remove(true);
// the variable alt is no longer valid.

gRDF.flush();




The jslib project can be contacted through the mailing list or the member list.
Copyright © 2000-2017. All rights reserved. Terms of Use & Privacy Policy.