.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28) .\" .\" 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 .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . 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 turned on, 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 .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "RDF::Redland::Node 3pm" .TH RDF::Redland::Node 3pm "2014-05-10" "perl v5.20.0" "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 \s-1RDF\s0 URIs, literals and blank nodes in the \s-1RDF\s0 graph. .SH "CONSTRUCTORS" .IX Header "CONSTRUCTORS" .IP "new [\s-1STRING\s0 | \s-1URI\s0 | \s-1NODE\s0]" 4 .IX Item "new [STRING | URI | NODE]" Create a new \s-1URI\s0 node, literal node or copy an existing node. .Sp If a literal \fI\s-1STRING\s0\fR is given, make a plain literal node. If a the argument is of type \fI\s-1URI\s0\fR (perl \s-1URI\s0 or RDF::Redland::URI), make a resource node. .Sp Otherwise if the argument is an RDF::Redland::Node \fI\s-1NODE\s0\fR, copy it. .IP "new_from_uri \s-1URI\s0" 4 .IX Item "new_from_uri URI" Create a new \s-1URI\s0 node. \fI\s-1URI\s0\fR can be either a RDF::Redland::URI object, a perl \s-1URI\s0 class or a literal string. .Sp An alternative is: .Sp .Vb 1 \& new RDF::Redland::URINode("http://example.org/"); .Ve .IP "new_literal \s-1STRING\s0 [\s-1DATATYPE\s0 [\s-1XML_LANGUAGE\s0]]" 4 .IX Item "new_literal STRING [DATATYPE [XML_LANGUAGE]]" Create a new literal node for a literal value \fI\s-1STRING\s0\fR. Optional datatype \s-1URI \s0\fI\s-1DATATYPE\s0\fR (RDF::Redland::URI, perl \s-1URI\s0 or string) and language (xml:lang attribute) \fI\s-1XML_LANGUAGE\s0\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 \s-1STRING\s0" 4 .IX Item "new_xml_literal STRING" Create a new \s-1XML\s0 datatyped literal node for the \s-1XML\s0 in \fI\s-1STRING\s0\fR. .Sp An alternative is: .Sp .Vb 1 \& new RDF::Redland::XMLLiteral("content"); .Ve .IP "new_from_blank_identifier \s-1IDENTIFIER\s0" 4 .IX Item "new_from_blank_identifier IDENTIFIER" Create a new blank node with blank node identifier \fI\s-1IDENTIFIER\s0\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 \s-1URI\s0 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 \s-1URI\s0) .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 \s-1UTF\-8 \s0(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 \s-1UTF\-8\s0 to \s-1ISO\s0 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 \s-1XML\s0 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 \s-1XML \s0(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 (\s-1UTF\-8\s0 encoded). .IP "equals \s-1NODE\s0" 4 .IX Item "equals NODE" Return non zero if this node is equal to \s-1NODE\s0 .SH "OLDER METHODS" .IX Header "OLDER METHODS" .IP "new_from_literal \s-1STRING XML_LANGUAGE IS_WF\s0" 4 .IX Item "new_from_literal STRING XML_LANGUAGE IS_WF" Create a new RDF::Redland::Node object for a literal value \fI\s-1STRING\s0\fR with \s-1XML\s0 language (xml:lang attribute) \fI\s-1XML_LANGUAGE\s0\fR and if content is well formed \s-1XML,\s0 when \fI\s-1IS_WF\s0\fR is non 0. \fI\s-1XML_LANGUAGE\s0\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 \s-1STRING\s0 [\s-1DATATYPE\s0 [\s-1XML_LANGUAGE\s0]]" 4 .IX Item "new_from_typed_literal STRING [DATATYPE [XML_LANGUAGE]]" Renamed to new_literal with same arguments. .IP "new_from_uri_string \s-1URI_STRING\s0" 4 .IX Item "new_from_uri_string URI_STRING" Create a new RDF::Redland::Node object for a resource with \s-1URI \s0\fI\s-1URI_STRING\s0\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 \s-1NODE\s0" 4 .IX Item "new_from_node NODE" Create a new RDF::Redland::Node object from existing RDF::Redland::Node \fI\s-1NODE\s0\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/