.\" -*- mode: troff; coding: utf-8 -*-
.\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
.ie n \{\
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds C`
. ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\"
.\" If the F register is >0, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{\
. if \nF \{\
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. if !\nF==2 \{\
. nr % 0
. nr F 2
. \}
. \}
.\}
.rr rF
.\" ========================================================================
.\"
.IX Title "RDF::Redland::Node 3pm"
.TH RDF::Redland::Node 3pm 2024-03-17 "perl v5.38.2" "User Contributed Perl Documentation"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH NAME
RDF::Redland::Node \- Redland RDF Node (RDF Resource, Property, Literal) Class
.SH SYNOPSIS
.IX Header "SYNOPSIS"
.Vb 4
\& use RDF::Redland;
\& my $node1=new RDF::Redland::Node("Hello, World!");
\& my $node2=new RDF::Redland::Node($uri); # $uri is an RDF::Redland::URI
\& my $node3=$node2\->clone;
\&
\& my $node4=new RDF::Redland::URINode("http://example.com/");
\& my $node5=new RDF::Redland::LiteralNode("Hello, World!");
\& my $node6=new RDF::Redland::XMLLiteral("content");
\& my $node7=new RDF::Redland::BlankNode("genid1");
\&
\& # alternate more verbose ways:
\& my $node4=RDF::Redland::Node\->new_from_uri("http://example.com/");
\& my $node5=RDF::Redland::Node\->new_literal("Hello, World!");
\& my $node6=RDF::Redland::Node\->new_xml_literal("content");
\& my $node7=RDF::Redland::Node\->new_from_blank_identifier("genid1");
\& ...
\&
\& print $node4\->uri\->as_string,"\en"; # Using RDF::Redland::URI::as_string
\& print $node5\->literal_value_as_latin1,"\en";
.Ve
.SH DESCRIPTION
.IX Header "DESCRIPTION"
This class represents RDF URIs, literals and blank nodes in the RDF graph.
.SH CONSTRUCTORS
.IX Header "CONSTRUCTORS"
.IP "new [STRING | URI | NODE]" 4
.IX Item "new [STRING | URI | NODE]"
Create a new URI node, literal node or copy an existing node.
.Sp
If a literal \fISTRING\fR is given, make a plain literal node. If a
the argument is of type \fIURI\fR (perl URI or RDF::Redland::URI),
make a resource node.
.Sp
Otherwise if the argument is an RDF::Redland::Node \fINODE\fR, copy it.
.IP "new_from_uri URI" 4
.IX Item "new_from_uri URI"
Create a new URI node. \fIURI\fR can be either a RDF::Redland::URI
object, a perl URI class or a literal string.
.Sp
An alternative is:
.Sp
.Vb 1
\& new RDF::Redland::URINode("http://example.org/");
.Ve
.IP "new_literal STRING [DATATYPE [XML_LANGUAGE]]" 4
.IX Item "new_literal STRING [DATATYPE [XML_LANGUAGE]]"
Create a new literal node for a literal value \fISTRING\fR.
Optional datatype URI \fIDATATYPE\fR (RDF::Redland::URI, perl URI or string)
and language (xml:lang attribute) \fIXML_LANGUAGE\fR may also be given.
.Sp
An alternative is:
.Sp
.Vb 2
\& new RDF::Redland::LiteralNode("Hello, World!");
\& new RDF::Redland::LiteralNode("Bonjour monde!", undef, "fr");
.Ve
.IP "new_xml_literal STRING" 4
.IX Item "new_xml_literal STRING"
Create a new XML datatyped literal node for the XML in \fISTRING\fR.
.Sp
An alternative is:
.Sp
.Vb 1
\& new RDF::Redland::XMLLiteral("content");
.Ve
.IP "new_from_blank_identifier IDENTIFIER" 4
.IX Item "new_from_blank_identifier IDENTIFIER"
Create a new blank node with blank node identifier \fIIDENTIFIER\fR.
.Sp
An alternative is:
.Sp
.Vb 1
\& new RDF::Redland::BlankNode("id");
.Ve
.IP clone 4
.IX Item "clone"
Copy a RDF::Redland::Node.
.SH METHODS
.IX Header "METHODS"
.IP uri 4
.IX Item "uri"
Get the current URI of the node as an RDF::Redland::URI object.
.IP blank_identifier 4
.IX Item "blank_identifier"
Get the current blank identifier of the node
.IP type 4
.IX Item "type"
Get the node type. It is recommended to use the is_resource, is_literal
or is_blank methods in preference to this (both simpler and quicker).
.Sp
The current list of types that are supported are:
.Sp
.Vb 3
\& $RDF::Redland::Node::Type_Resource
\& $RDF::Redland::Node::Type_Literal
\& $RDF::Redland::Node::Type_Blank
.Ve
.Sp
Example:
.Sp
.Vb 5
\& if ($node\->type == $RDF::Redland::Node::Type_Resource) {
\& print "Node is a resource with URI ", $node\->uri\->as_string, "\en";
\& } else {
\& ...
\& }
.Ve
.IP is_resource 4
.IX Item "is_resource"
Return true if node is a resource (with a URI)
.IP is_literal 4
.IX Item "is_literal"
Return true if node is a literal
.IP is_blank 4
.IX Item "is_blank"
Return true if node is a blank nodeID
.IP literal_value 4
.IX Item "literal_value"
Get the node literal value string as UTF\-8 (when the node is of type
\&\f(CW$RDF::Redland::Node::Type_Literal\fR)
.IP literal_value_as_latin1 4
.IX Item "literal_value_as_latin1"
Get the node literal value string converted from UTF\-8 to ISO Latin\-1
(when the node is of type \f(CW$RDF::Redland::Node::Type_Literal\fR)
.IP literal_value_language 4
.IX Item "literal_value_language"
Get the node literal XML language (when the node is of type
\&\f(CW$RDF::Redland::Node::Type_Literal\fR) or undef if not present.
.IP literal_value_is_wf_xml 4
.IX Item "literal_value_is_wf_xml"
Return non 0 if the literal string is well formed XML (when the node
is of type \f(CW$RDF::Redland::Node::Type_Literal\fR).
.IP literal_datatype 4
.IX Item "literal_datatype"
Return the RDF::Redland::URI of the literal datatype or undef if it
is not a datatype.
.IP as_string 4
.IX Item "as_string"
Return the RDF::Redland::Node formatted as a string (UTF\-8 encoded).
.IP "equals NODE" 4
.IX Item "equals NODE"
Return non zero if this node is equal to NODE
.SH "OLDER METHODS"
.IX Header "OLDER METHODS"
.IP "new_from_literal STRING XML_LANGUAGE IS_WF" 4
.IX Item "new_from_literal STRING XML_LANGUAGE IS_WF"
Create a new RDF::Redland::Node object for a literal value \fISTRING\fR with XML
language (xml:lang attribute) \fIXML_LANGUAGE\fR
and if content is well formed XML, when \fIIS_WF\fR is non
0. \fIXML_LANGUAGE\fR is optional can can be set to undef.
.Sp
This method remains but using new_literal is preferred.
Instead, for plain literals use:
.Sp
.Vb 1
\& $node=new RDF::Redland::Node("blah")
.Ve
.IP "new_from_typed_literal STRING [DATATYPE [XML_LANGUAGE]]" 4
.IX Item "new_from_typed_literal STRING [DATATYPE [XML_LANGUAGE]]"
Renamed to new_literal with same arguments.
.IP "new_from_uri_string URI_STRING" 4
.IX Item "new_from_uri_string URI_STRING"
Create a new RDF::Redland::Node object for a resource with URI \fIURI_STRING\fR.
It is equivalent to use the shorter:
.Sp
.Vb 1
\& $a=new RDF::Redland::Node\->new_from_uri($uri_string)
.Ve
.IP "new_from_node NODE" 4
.IX Item "new_from_node NODE"
Create a new RDF::Redland::Node object from existing
RDF::Redland::Node \fINODE\fR (copy constructor).
It is equivalent to use:
.Sp
.Vb 1
\& $new_node=$old_node\->clone
.Ve
.SH "SEE ALSO"
.IX Header "SEE ALSO"
RDF::Redland::Statement
.SH AUTHOR
.IX Header "AUTHOR"
Dave Beckett \- http://www.dajobe.org/