.\" -*- 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::Model 3pm" .TH RDF::Redland::Model 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::Model \- Redland RDF Model Class .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 4 \& use RDF::Redland; \& my $storage=new RDF::Redland::Storage("hashes", "test", "new=\*(Aqyes\*(Aq,hash\-type=\*(Aqmemory\*(Aq"); \& my $model=new RDF::Redland::Model($storage, ""); \& ... \& \& my(@sources)=$model\->targets($predicate_node, $object_node); \& \& ... .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" Manipulate the RDF model. .SH CONSTRUCTORS .IX Header "CONSTRUCTORS" .IP "new STORAGE OPTIONS_STRING" 4 .IX Item "new STORAGE OPTIONS_STRING" .PD 0 .IP "new_with_options STORAGE OPTIONS_HASH" 4 .IX Item "new_with_options STORAGE OPTIONS_HASH" .PD Create a new RDF::Redland::Model object using RDF::Redland::Storage object \fISTORAGE\fR with a options. The options can be given either as a string in the first form as \fIOPTIONS_STRING\fR. The options take the form key1='value1',key2='value2'. The quotes are required. In the second case \fIOPTIONS_HASH\fR is a reference to a Perl hash of options. .IP "new_from_model MODEL" 4 .IX Item "new_from_model MODEL" Create a new model from an existing RDF::Redland::Model \fIMODEL\fR (copy constructor). .SH METHODS .IX Header "METHODS" .IP size 4 .IX Item "size" Return the size of the model (number of statements). .IP sync 4 .IX Item "sync" Synchronise the model to the underlying storage. .IP "add SUBJECT PREDICATE OBJECT" 4 .IX Item "add SUBJECT PREDICATE OBJECT" Add a new statement to the model with \fISUBJECT\fR, \&\fIPREDICATE\fR and \fIOBJECT\fR. These can be RDF::Redland::Node, RDF::Redland::URI or perl URI objects. .IP "add_typed_literal_statement SUBJECT PREDICATE STRING [XML_LANGUAGE [DATATYPE]]" 4 .IX Item "add_typed_literal_statement SUBJECT PREDICATE STRING [XML_LANGUAGE [DATATYPE]]" Add a new statement to the model containing a typed literal string object \&\fISTRING\fR with (optional) XML language (xml:lang attribute) \fIXML_LANGUAGE\fR and (optional) datatype URI \fIDATATYPE\fR. \fIXML_LANGUAGE\fR or \fIDATATYPE\fR can either or both be set to undef. .IP "add_statement STATEMENT [CONTEXT] | NODE NODE NODE [CONTEXT]" 4 .IX Item "add_statement STATEMENT [CONTEXT] | NODE NODE NODE [CONTEXT]" Add RDF::Redland::Statement \fISTATEMENT\fR or the statement formed by \fINODE NODE NODE\fR to the model. If the optional \fICONTEXT\fR is given, associate it with that context. Any of \fINODE\fR or \fICONTEXT\fR can be a RDF::Redland::Node, RDF::Redland::URI or perl URI object. .IP "add_statements STREAM [CONTEXT]" 4 .IX Item "add_statements STREAM [CONTEXT]" Add the statements from the RDF::Redland::Stream \fISTREAM\fR to the model. If the optional \fICONTEXT\fR is given, associate it with that context. \&\fICONTEXT\fR can be a RDF::Redland::Node, RDF::Redland::URI or perl URI object. .IP "remove_statement STATEMENT [CONTEXT] | NODE NODE NODE [CONTEXT]" 4 .IX Item "remove_statement STATEMENT [CONTEXT] | NODE NODE NODE [CONTEXT]" Remove RDF::Redland::Statement \fISTATEMENT\fR or the statement formed by \fINODE NODE NODE\fR from the model. If the optional \fICONTEXT\fR is given, remove only the statement stored with that context. Any of \fINODE\fR or \fICONTEXT\fR can be a RDF::Redland::Node, RDF::Redland::URI or perl URI object. .IP "remove_context_statements CONTEXT" 4 .IX Item "remove_context_statements CONTEXT" Remove all RDF::Redland::Statement \fISTATEMENT\fRs from the model with the given \fICONTEXT\fR context. \&\fICONTEXT\fR can be a RDF::Redland::Node, RDF::Redland::URI or perl URI object. .IP "contains_statement STATEMENT" 4 .IX Item "contains_statement STATEMENT" Return non 0 if the model contains RDF::Redland::Statement \fISTATEMENT\fR. .IP "as_stream [CONTEXT]" 4 .IX Item "as_stream [CONTEXT]" Return a new RDF::Redland::Stream object seralising the entire model, or just those statements with \fICONTEXT\fR, as RDF::Redland::Statement objects. If given, \fICONTEXT\fR can be a RDF::Redland::Node, RDF::Redland::URI or perl URI object. .IP "find_statements STATEMENT [CONTEXT]" 4 .IX Item "find_statements STATEMENT [CONTEXT]" Find all matching statements in the model matching partial RDF::Redland::Statement \&\fISTATEMENT\fR (any of the subject, predicate, object RDF::Redland::Node can be undef). If \fICONTEXT\fR is given, finds statements only in that context. .Sp 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. .IP "sources ARC TARGET" 4 .IX Item "sources ARC TARGET" Get all source RDF::Redland::Node objects for a given arc \fIARC\fR, target \fITARGET\fR> RDF::Redland::Node objects as a list of RDF::Redland::Node objects. .IP "arcs SOURCE TARGET" 4 .IX Item "arcs SOURCE TARGET" Get all arc RDF::Redland::Node objects for a given source \fISOURCE\fR, target \fITARGET\fR RDF::Redland::Node objects as a list of RDF::Redland::Node objects. .IP "targets SOURCE ARC" 4 .IX Item "targets SOURCE ARC" Get all target RDF::Redland::Node objects for a given source \fISOURCE\fR, arc \fIARC\fR RDF::Redland::Node objects as a list of RDF::Redland::Node objects. .IP "sources_iterator ARC TARGET" 4 .IX Item "sources_iterator ARC TARGET" Get all source RDF::Redland::Node objects for a given arc \fIARC\fR, target \&\fITARGET\fR RDF::Redland::Node objects as an RDF::Redland::Iterator or undef on failure. .IP "arcs_iterator SOURCE TARGET" 4 .IX Item "arcs_iterator SOURCE TARGET" Get all arc RDF::Redland::Node objects for a given source \fISOURCE\fR, target \&\fITARGET\fR RDF::Redland::Node objects as an RDF::Redland::Iterator or undef on failure. .IP "targets_iterator SOURCE ARC" 4 .IX Item "targets_iterator SOURCE ARC" Get all target RDF::Redland::Node objects for a given source \fISOURCE\fR, arc \fIARC\fR RDF::Redland::Node objects as an RDF::Redland::Iterator or undef on failure. .IP "source ARC TARGET" 4 .IX Item "source ARC TARGET" Get one source RDF::Redland::Node object that matches a given arc \fIARC\fR, target \fITARGET\fR RDF::Redland::Node objects or undef if there is no match. .IP "arc SOURCE TARGET" 4 .IX Item "arc SOURCE TARGET" Get one arc RDF::Redland::Node object that matches a given source \fISOURCE\fR, target \fITARGET\fR RDF::Redland::Node objects or undef if there is no match. .IP "target SOURCE ARC" 4 .IX Item "target SOURCE ARC" Get one target RDF::Redland::Node object that matches a given source \&\fISOURCE\fR, arc \fIARC\fR RDF::Redland::Node objects or undef if there is no match. .IP contexts 4 .IX Item "contexts" Get all context RDF::Redland::Node objects in the model .IP "feature URI [VALUE]" 4 .IX Item "feature URI [VALUE]" Get/set a model feature. The feature is named via RDF::Redland::URI \&\fIURI\fR and the value is a RDF::Redland::Node. If \fIVALUE\fR is given, the feature is set to that value, otherwise the current value is returned. .IP "query_execute QUERY" 4 .IX Item "query_execute QUERY" Execute the \fIQUERY\fR RDF::Redland::Query against the model returning a result set RDF::Redland::QueryResults or undef on failure. .IP "load URI [SYNTAX\-NAME [ MIME-TYPE [SYNTAX\-URI [HANDLER ]]]" 4 .IX Item "load URI [SYNTAX-NAME [ MIME-TYPE [SYNTAX-URI [HANDLER ]]]" Load content from \fIURI\fR into the model, guessing the parser. .IP "to_string [BASE\-URI [SYNTAX\-NAME [ MIME-TYPE [SYNTAX\-URI]]]" 4 .IX Item "to_string [BASE-URI [SYNTAX-NAME [ MIME-TYPE [SYNTAX-URI]]]" Serialize the model to a syntax. If no serializer name is given, the default serializer RDF/XML is used. .SH "OLDER METHODS" .IX Header "OLDER METHODS" .IP serialise 4 .IX Item "serialise" .PD 0 .IP serialize 4 .IX Item "serialize" .PD 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. .SH "SEE ALSO" .IX Header "SEE ALSO" RDF::Redland::Storage, RDF::Redland::Node and RDF::Redland::Statement .SH AUTHOR .IX Header "AUTHOR" Dave Beckett \- http://www.dajobe.org/