Debian Codegraph @

docs/pod/RDF/Redland/Node.html

raw symbols SCIP
1 <?xml version="1.0" encoding="iso-8859-1"?>
2 <?xml version="1.0"?>
3 <html xmlns="http://www.w3.org/1999/xhtml">
4 <head>
5 <title>Redland RDF Application Framework - Perl RDF::Redland::Node Class</title>
6 </head>
7 <body>
8
9 <h1 style="text-align:center">Redland RDF Application Framework - Perl RDF::Redland::Node Class</h1>
10
11
12 <!-- INDEX BEGIN -->
13 <div name="index">
14 <p><a name="__index__"></a></p>
15 <!--
16
17 <ul>
18
19 <li><a href="#name">NAME</a></li>
20 <li><a href="#synopsis">SYNOPSIS</a></li>
21 <li><a href="#description">DESCRIPTION</a></li>
22 <li><a href="#constructors">CONSTRUCTORS</a></li>
23 <li><a href="#methods">METHODS</a></li>
24 <li><a href="#older_methods">OLDER METHODS</a></li>
25 <li><a href="#see_also">SEE ALSO</a></li>
26 <li><a href="#author">AUTHOR</a></li>
27 </ul>
28
29 --></div>
30 <!-- INDEX END -->
31
32 <h2><a name="name">NAME</a></h2>
33 <p>RDF::Redland::Node - Redland RDF Node (RDF Resource, Property, Literal) Class</p>
34
35 <h2><a name="synopsis">SYNOPSIS</a></h2>
36 <pre>
37 use RDF::Redland;
38 my $node1=new RDF::Redland::Node("Hello, World!");
39 my $node2=new RDF::Redland::Node($uri); # $uri is an RDF::Redland::URI
40 my $node3=$node2-&gt;clone;
41 </pre>
42 <pre>
43 my $node4=new RDF::Redland::URINode("<a href="http://example.com/&quot;">http://example.com/"</a>;);
44 my $node5=new RDF::Redland::LiteralNode("Hello, World!");
45 my $node6=new RDF::Redland::XMLLiteral("&lt;tag&gt;content&lt;/tag&gt;");
46 my $node7=new RDF::Redland::BlankNode("genid1");
47 </pre>
48 <pre>
49 # alternate more verbose ways:
50 my $node4=RDF::Redland::Node-&gt;new_from_uri("<a href="http://example.com/&quot;">http://example.com/"</a>;);
51 my $node5=RDF::Redland::Node-&gt;new_literal("Hello, World!");
52 my $node6=RDF::Redland::Node-&gt;new_xml_literal("&lt;tag&gt;content&lt;/tag&gt;");
53 my $node7=RDF::Redland::Node-&gt;new_from_blank_identifier("genid1");
54 ...
55 </pre>
56 <pre>
57 print $node4-&gt;uri-&gt;as_string,"\n"; # Using RDF::Redland::URI::as_string
58 print $node5-&gt;literal_value_as_latin1,"\n";
59 </pre>
60
61 <h2><a name="description">DESCRIPTION</a></h2>
62 <p>This class represents RDF URIs, literals and blank nodes in the RDF graph.</p>
63
64 <h2><a name="constructors">CONSTRUCTORS</a></h2>
65 <dl>
66 <dt><strong><a name="new_string_uri_node" class="item">new [STRING | URI | NODE]</a></strong></dt>
67 <dd>
68 <p>Create a new URI node, literal node or copy an existing node.</p>
69 <p>If a literal <em>STRING</em> is given, make a plain literal node. If a the argument is of type <em>URI</em> (perl URI or RDF::Redland::URI), make a resource node.</p>
70 <p>Otherwise if the argument is an RDF::Redland::Node <em>NODE</em>, copy it.</p>
71 </dd>
72 <dt><strong><a name="new_from_uri" class="item">new_from_uri URI</a></strong></dt>
73 <dd>
74 <p>Create a new URI node. <em>URI</em> can be either a RDF::Redland::URI object, a perl URI class or a literal string.</p>
75 <p>An alternative is:</p>
76 <pre>
77 new RDF::Redland::URINode("<a href="http://example.org/&quot;">http://example.org/"</a>;);
78 </pre></dd>
79 <dt><strong><a name="new_literal_string_datatype_xml_language" class="item">new_literal STRING [DATATYPE [XML_LANGUAGE]]</a></strong></dt>
80 <dd>
81 <p>Create a new literal node for a literal value <em>STRING</em>. Optional datatype URI <em>DATATYPE</em> (RDF::Redland::URI, perl URI or string) and language (xml:lang attribute) <em>XML_LANGUAGE</em> may also be given.</p>
82 <p>An alternative is:</p>
83 <pre>
84 new RDF::Redland::LiteralNode("Hello, World!");
85 new RDF::Redland::LiteralNode("Bonjour monde!", undef, "fr");
86 </pre></dd>
87 <dt><strong><a name="new_xml_literal" class="item">new_xml_literal STRING</a></strong></dt>
88 <dd>
89 <p>Create a new XML datatyped literal node for the XML in <em>STRING</em>.</p>
90 <p>An alternative is:</p>
91 <pre>
92 new RDF::Redland::XMLLiteral("&lt;tag&gt;content&lt;/tag&gt;");
93 </pre></dd>
94 <dt><strong><a name="new_from_blank_identifier" class="item">new_from_blank_identifier IDENTIFIER</a></strong></dt>
95 <dd>
96 <p>Create a new blank node with blank node identifier <em>IDENTIFIER</em>.</p>
97 <p>An alternative is:</p>
98 <pre>
99 new RDF::Redland::BlankNode("id");
100 </pre></dd>
101 <dt><strong><a name="clone" class="item">clone</a></strong></dt>
102 <dd>
103 <p>Copy a RDF::Redland::Node.</p>
104 </dd>
105 </dl>
106
107 <h2><a name="methods">METHODS</a></h2>
108 <dl>
109 <dt><strong><a name="uri" class="item">uri</a></strong></dt>
110 <dd>
111 <p>Get the current URI of the node as an RDF::Redland::URI object.</p>
112 </dd>
113 <dt><strong><a name="blank_identifier" class="item">blank_identifier</a></strong></dt>
114 <dd>
115 <p>Get the current blank identifier of the node</p>
116 </dd>
117 <dt><strong><a name="type" class="item">type</a></strong></dt>
118 <dd>
119 <p>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).</p>
120 <p>The current list of types that are supported are:</p>
121 <pre>
122 $RDF::Redland::Node::Type_Resource
123 $RDF::Redland::Node::Type_Literal
124 $RDF::Redland::Node::Type_Blank
125 </pre>
126 <p>Example:</p>
127 <pre>
128 if ($node-&gt;type == $RDF::Redland::Node::Type_Resource) {
129 print "Node is a resource with URI ", $node-&gt;uri-&gt;as_string, "\n";
130 } else {
131 ...
132 }
133 </pre></dd>
134 <dt><strong><a name="is_resource" class="item">is_resource</a></strong></dt>
135 <dd>
136 <p>Return true if node is a resource (with a URI)</p>
137 </dd>
138 <dt><strong><a name="is_literal" class="item">is_literal</a></strong></dt>
139 <dd>
140 <p>Return true if node is a literal</p>
141 </dd>
142 <dt><strong><a name="is_blank" class="item">is_blank</a></strong></dt>
143 <dd>
144 <p>Return true if node is a blank nodeID</p>
145 </dd>
146 <dt><strong><a name="literal_value" class="item">literal_value</a></strong></dt>
147 <dd>
148 <p>Get the node literal value string as UTF-8 (when the node is of type $RDF::Redland::Node::Type_Literal)</p>
149 </dd>
150 <dt><strong><a name="literal_value_as_latin1" class="item">literal_value_as_latin1</a></strong></dt>
151 <dd>
152 <p>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)</p>
153 </dd>
154 <dt><strong><a name="literal_value_language" class="item">literal_value_language</a></strong></dt>
155 <dd>
156 <p>Get the node literal XML language (when the node is of type $RDF::Redland::Node::Type_Literal) or undef if not present.</p>
157 </dd>
158 <dt><strong><a name="literal_value_is_wf_xml" class="item">literal_value_is_wf_xml</a></strong></dt>
159 <dd>
160 <p>Return non 0 if the literal string is well formed XML (when the node is of type $RDF::Redland::Node::Type_Literal).</p>
161 </dd>
162 <dt><strong><a name="literal_datatype" class="item">literal_datatype</a></strong></dt>
163 <dd>
164 <p>Return the RDF::Redland::URI of the literal datatype or undef if it is not a datatype.</p>
165 </dd>
166 <dt><strong><a name="as_string" class="item">as_string</a></strong></dt>
167 <dd>
168 <p>Return the RDF::Redland::Node formatted as a string (UTF-8 encoded).</p>
169 </dd>
170 <dt><strong><a name="equals" class="item">equals NODE</a></strong></dt>
171 <dd>
172 <p>Return non zero if this node is equal to NODE</p>
173 </dd>
174 </dl>
175
176 <h2><a name="older_methods">OLDER METHODS</a></h2>
177 <dl>
178 <dt><strong><a name="new_from_literal_string_xml_language_is_wf" class="item">new_from_literal STRING XML_LANGUAGE IS_WF</a></strong></dt>
179 <dd>
180 <p>Create a new RDF::Redland::Node object for a literal value <em>STRING</em> with XML language (xml:lang attribute) <em>XML_LANGUAGE</em> and if content is well formed XML, when <em>IS_WF</em> is non 0. <em>XML_LANGUAGE</em> is optional can can be set to undef.</p>
181 <p>This method remains but using new_literal is preferred. Instead, for plain literals use:</p>
182 <pre>
183 $node=new RDF::Redland::Node("blah")
184 </pre></dd>
185 <dt><strong><a name="new_from_typed_literal_string_datatype_xml_language" class="item">new_from_typed_literal STRING [DATATYPE [XML_LANGUAGE]]</a></strong></dt>
186 <dd>
187 <p>Renamed to new_literal with same arguments.</p>
188 </dd>
189 <dt><strong><a name="new_from_uri_string_uri_string" class="item">new_from_uri_string URI_STRING</a></strong></dt>
190 <dd>
191 <p>Create a new RDF::Redland::Node object for a resource with URI <em>URI_STRING</em>. It is equivalent to use the shorter:</p>
192 <pre>
193 $a=new RDF::Redland::Node-&gt;new_from_uri($uri_string)
194 </pre></dd>
195 <dt><strong><a name="new_from_node" class="item">new_from_node NODE</a></strong></dt>
196 <dd>
197 <p>Create a new RDF::Redland::Node object from existing RDF::Redland::Node <em>NODE</em> (copy constructor). It is equivalent to use:</p>
198 <pre>
199 $new_node=$old_node-&gt;clone
200 </pre></dd>
201 </dl>
202
203 <h2><a name="see_also">SEE ALSO</a></h2>
204 <p><a href="Statement.html">the RDF::Redland::Statement manpage</a></p>
205
206 <h2><a name="author">AUTHOR</a></h2>
207 <p>Dave Beckett - <a href="http://www.dajobe.org/">http://www.dajobe.org/</a></p>
208 <hr />
209
210 <p>(C) Copyright 2000-2014 <a href="http://www.dajobe.org/">Dave Beckett</a>, (C) Copyright 2000-2005 <a href="http://www.bristol.ac.uk/">University of Bristol</a></p>
211
212 </body>
213 </html>