Redland RDF Application Framework - Perl RDF::Redland::Node Class
RDF::Redland::Node - Redland RDF Node (RDF Resource, Property, Literal) Class
use RDF::Redland;
my $node=new RDF::Redland::Node();
my $node2=RDF::Redland::Node->new_from_uri_string("http://example.com/";);
my $node3=RDF::Redland::Node->new_from_uri(new RDF::Redland::URI("http://example.com/";));
my $node4=RDF::Redland::Node->new_from_literal("Hello, World!","",0);
my $node5=RDF::Redland::Node->new_from_literal("<tag>content</tag>","",1);
my $node6=RDF::Redland::Node->new_from_blank_identifier("genid1");
...
print $node2->uri->as_string,"\n"; # Using RDF::Redland::URI::as_string
print $node4->literal_value_as_latin1,"\n";
This class represents nodes and arcs in the RDF model graph. RDF model Nodes are RDF resources and literals and RDF model Arcs are properties. RDF::Redland::Statement is a subclass of RDF::Redland::Node.
- new
- Create a new RDF::Redland::Node object
- new_from_uri_string URI_STRING
- Create a new RDF::Redland::Node object for a resource with URI URI_STRING.
- new_from_uri URI
- Create a new RDF::Redland::Node object for a resource with RDF::Redland::URI object URI.
- new_from_literal STRING XML_LANGUAGE IS_WF
- Create a new RDF::Redland::Node object for a literal value STRING with XML language (xml:lang attribute) XML_LANGUAGE and if content is well formed XML, when IS_WF is non 0. XML_LANGUAGE is optional can can be set to undef.
- new_from_typed_literal STRING DATATYPE [XML_LANGUAGE]
- Create a new RDF::Redland::Node object for a datatyped literal value STRING with dataype URI DATATYPE (an RDF::Redland::URI) and language (xml:lang attribute) XML_LANGUAGE XML_LANGUAGE is optional can can be omitted.
- new_from_blank_identifier IDENTIFIER
- Create a new RDF::Redland::Node object for a blank node with the (string) identifier IDENTIFIER.
- new_from_node NODE
- Create a new RDF::Redland::Node object from existing RDF::Redland::Node NODE (copy constructor).
- uri [URI]
- Get/set the URI of the node. With no arguments, returns the current URI as an RDF::Redland::URI object otherwise sets it to RDF::Redland::URI object URI.
- blank_identifier [ID]
- Get/set the blank identifier of the node. With no arguments, returns the current blank identifier, otherwise sets it to the ID.
- type [TYPE]
- Get/set the node type. With no arguments, returns the current type, otherwise sets it to TYPE. The current list of types that are supported are:
-
$RDF::Redland::Node::Type_Resource
$RDF::Redland::Node::Type_Literal
$RDF::Redland::Node::Type_Blank
-
Example:
-
if ($node->type == $RDF::Redland::Node::Type_Resource) {
print "Node is a resource with URI ", $node->uri->as_string, "\n";
} else {
...
}
- literal_value
- Get the node literal value string as UTF-8 (when the node is of type $RDF::Redland::Node::Type_Literal)
- literal_value_as_latin1
- Get the node literal value string converted from UTF-8 to ISO Latin-1 (when the node is of type $RDF::Redland::Node::Type_Literal)
- literal_value_language
- Get the node literal XML language (when the node is of type $RDF::Redland::Node::Type_Literal) or undef if not present.
- literal_value_is_wf_xml
- Return non 0 if the literal string is well formed XML (when the node is of type $RDF::Redland::Node::Type_Literal).
- set_literal_value STRING XML_LANGUAGE IS_WF
- Set the node literal value to STRING with XML language (xml:lang attribute) XML_LANGUAGE and if content is well formed XML, when IS_WF is non 0. XML_LANGUAGE is optional and can be set to undef.
- literal_datatype
- Return the RDF::Redland::URI of the literal datatype or undef if it is not a datatype.
- as_string
- Return the RDF::Redland::Node formatted as a string (UTF-8 encoded).
- equals NODE
- Return non zero if this node is equal to NODE
the RDF::Redland::Statement manpage
Dave Beckett - http://purl.org/net/dajobe/
Copyright 2000-2003 Dave Beckett, Institute for Learning and Research Technology, University of Bristol