| 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::Model Class</title> |
| 6 |
</head> |
| 7 |
<body> |
| 8 |
|
| 9 |
<h1 style="text-align:center">Redland RDF Application Framework - Perl RDF::Redland::Model Class</h1> |
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
<div name="index"> |
| 14 |
<p><a name="__index__"></a></p> |
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
</div> |
| 30 |
|
| 31 |
|
| 32 |
<h2><a name="name">NAME</a></h2> |
| 33 |
<p>RDF::Redland::Model - Redland RDF Model Class</p> |
| 34 |
|
| 35 |
<h2><a name="synopsis">SYNOPSIS</a></h2> |
| 36 |
<pre> |
| 37 |
use RDF::Redland; |
| 38 |
my $storage=new RDF::Redland::Storage("hashes", "test", "new='yes',hash-type='memory'"); |
| 39 |
my $model=new RDF::Redland::Model($storage, ""); |
| 40 |
... |
| 41 |
</pre> |
| 42 |
<pre> |
| 43 |
my(@sources)=$model->targets($predicate_node, $object_node); |
| 44 |
</pre> |
| 45 |
<pre> |
| 46 |
... |
| 47 |
</pre> |
| 48 |
|
| 49 |
<h2><a name="description">DESCRIPTION</a></h2> |
| 50 |
<p>Manipulate the RDF model.</p> |
| 51 |
|
| 52 |
<h2><a name="constructors">CONSTRUCTORS</a></h2> |
| 53 |
<dl> |
| 54 |
<dt><strong><a name="new_storage_options_string" class="item">new STORAGE OPTIONS_STRING</a></strong></dt> |
| 55 |
<dt><strong><a name="new_with_options_storage_options_hash" class="item">new_with_options STORAGE OPTIONS_HASH</a></strong></dt> |
| 56 |
<dd> |
| 57 |
<p>Create a new RDF::Redland::Model object using RDF::Redland::Storage object <em>STORAGE</em> with a options. The options can be given either as a string in the first form as <em>OPTIONS_STRING</em>. The options take the form key1='value1',key2='value2'. The quotes are required. In the second case <em>OPTIONS_HASH</em> is a reference to a Perl hash of options.</p> |
| 58 |
</dd> |
| 59 |
<dt><strong><a name="new_from_model" class="item">new_from_model MODEL</a></strong></dt> |
| 60 |
<dd> |
| 61 |
<p>Create a new model from an existing RDF::Redland::Model <em>MODEL</em> (copy constructor).</p> |
| 62 |
</dd> |
| 63 |
</dl> |
| 64 |
|
| 65 |
<h2><a name="methods">METHODS</a></h2> |
| 66 |
<dl> |
| 67 |
<dt><strong><a name="size" class="item">size</a></strong></dt> |
| 68 |
<dd> |
| 69 |
<p>Return the size of the model (number of statements).</p> |
| 70 |
</dd> |
| 71 |
<dt><strong><a name="sync" class="item">sync</a></strong></dt> |
| 72 |
<dd> |
| 73 |
<p>Synchronise the model to the underlying storage.</p> |
| 74 |
</dd> |
| 75 |
<dt><strong><a name="add" class="item">add SUBJECT PREDICATE OBJECT</a></strong></dt> |
| 76 |
<dd> |
| 77 |
<p>Add a new statement to the model with <em>SUBJECT</em>, <em>PREDICATE</em> and <em>OBJECT</em>. These can be RDF::Redland::Node, RDF::Redland::URI or perl URI objects.</p> |
| 78 |
</dd> |
| 79 |
<dt><strong><a name="add_typed_literal_statement_subject_predicate_string_xml_language_datatype" class="item">add_typed_literal_statement SUBJECT PREDICATE STRING [XML_LANGUAGE [DATATYPE]]</a></strong></dt> |
| 80 |
<dd> |
| 81 |
<p>Add a new statement to the model containing a typed literal string object <em>STRING</em> with (optional) XML language (xml:lang attribute) <em>XML_LANGUAGE</em> and (optional) datatype URI <em>DATATYPE</em>. <em>XML_LANGUAGE</em> or <em>DATATYPE</em> can either or both be set to undef.</p> |
| 82 |
</dd> |
| 83 |
<dt><strong><a name="add_statement_statement_context_node_node_node_context" class="item">add_statement STATEMENT [CONTEXT] | NODE NODE NODE [CONTEXT]</a></strong></dt> |
| 84 |
<dd> |
| 85 |
<p>Add RDF::Redland::Statement <em>STATEMENT</em> or the statement formed by <em>NODE NODE NODE</em> to the model. If the optional <em>CONTEXT</em> is given, associate it with that context. Any of <em>NODE</em> or <em>CONTEXT</em> can be a RDF::Redland::Node, RDF::Redland::URI or perl URI object.</p> |
| 86 |
</dd> |
| 87 |
<dt><strong><a name="add_statements_stream_context" class="item">add_statements STREAM [CONTEXT]</a></strong></dt> |
| 88 |
<dd> |
| 89 |
<p>Add the statements from the RDF::Redland::Stream <em>STREAM</em> to the model. If the optional <em>CONTEXT</em> is given, associate it with that context. <em>CONTEXT</em> can be a RDF::Redland::Node, RDF::Redland::URI or perl URI object.</p> |
| 90 |
</dd> |
| 91 |
<dt><strong><a name="remove_statement_statement_context_node_node_node_context" class="item">remove_statement STATEMENT [CONTEXT] | NODE NODE NODE [CONTEXT]</a></strong></dt> |
| 92 |
<dd> |
| 93 |
<p>Remove RDF::Redland::Statement <em>STATEMENT</em> or the statement formed by <em>NODE NODE NODE</em> from the model. If the optional <em>CONTEXT</em> is given, remove only the statement stored with that context. Any of <em>NODE</em> or <em>CONTEXT</em> can be a RDF::Redland::Node, RDF::Redland::URI or perl URI object.</p> |
| 94 |
</dd> |
| 95 |
<dt><strong><a name="remove_context_statements" class="item">remove_context_statements CONTEXT</a></strong></dt> |
| 96 |
<dd> |
| 97 |
<p>Remove all RDF::Redland::Statement <em>STATEMENT</em>s from the model with the given <em>CONTEXT</em> context. <em>CONTEXT</em> can be a RDF::Redland::Node, RDF::Redland::URI or perl URI object.</p> |
| 98 |
</dd> |
| 99 |
<dt><strong><a name="contains_statement" class="item">contains_statement STATEMENT</a></strong></dt> |
| 100 |
<dd> |
| 101 |
<p>Return non 0 if the model contains RDF::Redland::Statement <em>STATEMENT</em>.</p> |
| 102 |
</dd> |
| 103 |
<dt><strong><a name="as_stream_context" class="item">as_stream [CONTEXT]</a></strong></dt> |
| 104 |
<dd> |
| 105 |
<p>Return a new RDF::Redland::Stream object seralising the entire model, or just those statements with <em>CONTEXT</em>, as RDF::Redland::Statement objects. If given, <em>CONTEXT</em> can be a RDF::Redland::Node, RDF::Redland::URI or perl URI object.</p> |
| 106 |
</dd> |
| 107 |
<dt><strong><a name="find_statements_statement_context" class="item">find_statements STATEMENT [CONTEXT]</a></strong></dt> |
| 108 |
<dd> |
| 109 |
<p>Find all matching statements in the model matching partial RDF::Redland::Statement <em>STATEMENT</em> (any of the subject, predicate, object RDF::Redland::Node can be undef). If <em>CONTEXT</em> is given, finds statements only in that context.</p> |
| 110 |
<p>In an array context, returns an array of the matching RDF::Redland::Statement objects. In a scalar context, returns the RDF::Redland::Stream object representing the results.</p> |
| 111 |
</dd> |
| 112 |
<dt><strong><a name="sources" class="item">sources ARC TARGET</a></strong></dt> |
| 113 |
<dd> |
| 114 |
<p>Get all source RDF::Redland::Node objects for a given arc <em>ARC</em>, target <em>TARGET</em>> RDF::Redland::Node objects as a list of RDF::Redland::Node objects.</p> |
| 115 |
</dd> |
| 116 |
<dt><strong><a name="arcs" class="item">arcs SOURCE TARGET</a></strong></dt> |
| 117 |
<dd> |
| 118 |
<p>Get all arc RDF::Redland::Node objects for a given source <em>SOURCE</em>, target <em>TARGET</em> RDF::Redland::Node objects as a list of RDF::Redland::Node objects.</p> |
| 119 |
</dd> |
| 120 |
<dt><strong><a name="targets" class="item">targets SOURCE ARC</a></strong></dt> |
| 121 |
<dd> |
| 122 |
<p>Get all target RDF::Redland::Node objects for a given source <em>SOURCE</em>, arc <em>ARC</em> RDF::Redland::Node objects as a list of RDF::Redland::Node objects.</p> |
| 123 |
</dd> |
| 124 |
<dt><strong><a name="sources_iterator" class="item">sources_iterator ARC TARGET</a></strong></dt> |
| 125 |
<dd> |
| 126 |
<p>Get all source RDF::Redland::Node objects for a given arc <em>ARC</em>, target <em>TARGET</em> RDF::Redland::Node objects as an RDF::Redland::Iterator or undef on failure.</p> |
| 127 |
</dd> |
| 128 |
<dt><strong><a name="arcs_iterator" class="item">arcs_iterator SOURCE TARGET</a></strong></dt> |
| 129 |
<dd> |
| 130 |
<p>Get all arc RDF::Redland::Node objects for a given source <em>SOURCE</em>, target <em>TARGET</em> RDF::Redland::Node objects as an RDF::Redland::Iterator or undef on failure.</p> |
| 131 |
</dd> |
| 132 |
<dt><strong><a name="targets_iterator" class="item">targets_iterator SOURCE ARC</a></strong></dt> |
| 133 |
<dd> |
| 134 |
<p>Get all target RDF::Redland::Node objects for a given source <em>SOURCE</em>, arc <em>ARC</em> RDF::Redland::Node objects as an RDF::Redland::Iterator or undef on failure.</p> |
| 135 |
</dd> |
| 136 |
<dt><strong><a name="source" class="item">source ARC TARGET</a></strong></dt> |
| 137 |
<dd> |
| 138 |
<p>Get one source RDF::Redland::Node object that matches a given arc <em>ARC</em>, target <em>TARGET</em> RDF::Redland::Node objects or undef if there is no match.</p> |
| 139 |
</dd> |
| 140 |
<dt><strong><a name="arc" class="item">arc SOURCE TARGET</a></strong></dt> |
| 141 |
<dd> |
| 142 |
<p>Get one arc RDF::Redland::Node object that matches a given source <em>SOURCE</em>, target <em>TARGET</em> RDF::Redland::Node objects or undef if there is no match.</p> |
| 143 |
</dd> |
| 144 |
<dt><strong><a name="target" class="item">target SOURCE ARC</a></strong></dt> |
| 145 |
<dd> |
| 146 |
<p>Get one target RDF::Redland::Node object that matches a given source <em>SOURCE</em>, arc <em>ARC</em> RDF::Redland::Node objects or undef if there is no match.</p> |
| 147 |
</dd> |
| 148 |
<dt><strong><a name="contexts" class="item">contexts</a></strong></dt> |
| 149 |
<dd> |
| 150 |
<p>Get all context RDF::Redland::Node objects in the model</p> |
| 151 |
</dd> |
| 152 |
<dt><strong><a name="feature_uri_value" class="item">feature URI [VALUE]</a></strong></dt> |
| 153 |
<dd> |
| 154 |
<p>Get/set a model feature. The feature is named via RDF::Redland::URI <em>URI</em> and the value is a RDF::Redland::Node. If <em>VALUE</em> is given, the feature is set to that value, otherwise the current value is returned.</p> |
| 155 |
</dd> |
| 156 |
<dt><strong><a name="query_execute" class="item">query_execute QUERY</a></strong></dt> |
| 157 |
<dd> |
| 158 |
<p>Execute the <em>QUERY</em> RDF::Redland::Query against the model returning a result set RDF::Redland::QueryResults or undef on failure.</p> |
| 159 |
</dd> |
| 160 |
<dt><strong><a name="load_uri_syntax_name_mime_type_syntax_uri_handler" class="item">load URI [SYNTAX-NAME [ MIME-TYPE [SYNTAX-URI [HANDLER ]]]</a></strong></dt> |
| 161 |
<dd> |
| 162 |
<p>Load content from <em>URI</em> into the model, guessing the parser.</p> |
| 163 |
</dd> |
| 164 |
<dt><strong><a name="to_string_base_uri_syntax_name_mime_type_syntax_uri" class="item">to_string [BASE-URI [SYNTAX-NAME [ MIME-TYPE [SYNTAX-URI]]]</a></strong></dt> |
| 165 |
<dd> |
| 166 |
<p>Serialize the model to a syntax. If no serializer name is given, the default serializer RDF/XML is used.</p> |
| 167 |
</dd> |
| 168 |
</dl> |
| 169 |
|
| 170 |
<h2><a name="older_methods">OLDER METHODS</a></h2> |
| 171 |
<dl> |
| 172 |
<dt><strong><a name="serialise" class="item">serialise</a></strong></dt> |
| 173 |
<dt><strong><a name="serialize" class="item">serialize</a></strong></dt> |
| 174 |
<dd> |
| 175 |
<p>Return a new RDF::Redland::Stream object seralising the model as RDF::Redland::Statement objects. Replaced by as_stream to reduce confusion with the RDF::Redland::Serializer class.</p> |
| 176 |
</dd> |
| 177 |
</dl> |
| 178 |
|
| 179 |
<h2><a name="see_also">SEE ALSO</a></h2> |
| 180 |
<p><a href="Storage.html">the RDF::Redland::Storage manpage</a>, <a href="Node.html">the RDF::Redland::Node manpage</a> and <a href="Statement.html">the RDF::Redland::Statement manpage</a></p> |
| 181 |
|
| 182 |
<h2><a name="author">AUTHOR</a></h2> |
| 183 |
<p>Dave Beckett - <a href="http://www.dajobe.org/">http://www.dajobe.org/</a></p> |
| 184 |
<hr /> |
| 185 |
|
| 186 |
<p>(C) Copyright 2000-2011 <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> |
| 187 |
|
| 188 |
</body> |
| 189 |
</html> |