RDFStore::Resource - An RDF Resource Node implementation


NAME

RDFStore::Resource - An RDF Resource Node implementation


SYNOPSIS

        use RDFStore::Resource;
        my $resource = new RDFStore::Resource("http://pen.jrc.it/index.html";);
        my $resource1 = new RDFStore::Resource("http://pen.jrc.it/";,"index.html");
        print $resource->toString." is ";
        print "not"
                unless $resource->equals($resource1);
        print " equal to ".$resource1->toString."\n";
        # or from URI object    
        use URI;
        $resource = new RDFStore::Resource("http://www.w3.org/1999/02/22-rdf-syntax-ns#";,"Description");
        $resource1 = new RDFStore::Resource( new URI("http://www.w3.org/1999/02/22-rdf-syntax-ns#Description";) );
        print $resource->toString." is ";
        print "not"
                unless $resource->equals($resource1);
        print " equal to ".$resource1->toString."\n";
        my $resource = new RDFStore::Resource([ a,{ d => 'value'}, [ 1,2,3] ]);

        print $resource->toString." is ";
        print "not"
                unless($resource->isbNode);
        print " anonymous\n";


DESCRIPTION

An RDF Resource Node implementation which support the so called anonymous-resources or bNodes (blankNodes)


METHODS

new ( LOCALNAME_NAMESPACE [, LOCALNAME ] )
This is a class method, the constructor for RDFStore::Resource. In case the method is called with a single perl scalar as parameter a new RDF Resource is created with the string passed as indentifier (LOCALNAME); a fully qualified RDF resource can be constructed by invoching the constructor with two paramters where the former is the NAMESPACE and the latter is the LOCALNAME. By RDF definition we assume that LOCALNAME can not be undefined. If LOCALNAME is a perl reference the new Resource is flagged as anonymous-resource or bNode :)

bNodes can be created either passing a perl reference to the constructor or by using the RDFStore::NodeFactory(3) createbNode() or createAnonymousResource() methods; the latter is actually setting the RDFStore::Resource internal bNode flag.

isAnonymous
Return true if the RDF Resource is anonymous or is a bNode

isbNode
Return true if the RDF Resource is anonymous or is a bNode

getURI
Return the URI identifing the RDF Resource; an undefined values i returned if the node is blank or anonymous.

getNamespace
Return the Namespace identifier of the Resource

getLocalName
Return the LocalName identifier of the Resource; if the Resource is anonymous (bNode) the Storable(3) representation of the label is returned instead. This will allow to distinguish bNodes between normal resources and give them a kind of unique identity. NOTE See RDFStore::Model(3) to see how actually bNodes are being stored and retrieved in RDFStore(3).

getLabel
Return the URI identifing the RDF Resource.

equals
Compare two RDF Resources either textual

getNodeID
Return the rdf:nodeID if the Resource is anonymous (bNode).

getbNode
Return the bNode conent.


SEE ALSO

RDFStore::RDFNode(3)


ABOUT RDF

 http://www.w3.org/TR/rdf-primer/
 http://www.w3.org/TR/rdf-mt
 http://www.w3.org/TR/rdf-syntax-grammar/
 http://www.w3.org/TR/rdf-schema/
 http://www.w3.org/TR/1999/REC-rdf-syntax-19990222 (obsolete)


AUTHOR

        Alberto Reggiori <areggiori@webweaving.org>

 RDFStore::Resource - An RDF Resource Node implementation