RDF::R...::Model(3pm)
π RDF::R...::Model π
okay bestie, so this is the RDF::Redland::Model page from the Perl docs β the Redland RDF Model Class. it's giving structured data, but make it fashion. it ships with perl v5.42.3, dated 2026-08-20, and honestly? she ate.
β¨ NAME β¨
RDF::Redland::Model β the Redland RDF Model Class, no cap.
πΈ SYNOPSIS πΈ
use RDF::Redland;
my $storage=new RDF::Redland::Storage("hashes", "test", "new='yes',hash-type='memory'");
my $model=new RDF::Redland::Model($storage, "");
...
my(@sources)=$model->targets($predicate_node, $object_node);
...
like, that's the whole vibe. make a storage, make a model, do model things. π
π¦ DESCRIPTION π¦
you manipulate the RDF model. that's it, that's the whole description. literally. the original said exactly that much and we're respecting the brevity era. β¨
π CONSTRUCTORS π
new STORAGE OPTIONS_STRINGβ the classic. spin up a brand newRDF::Redland::Modelobject using aRDF::Redland::Storageobject named STORAGE, plus options passed as OPTIONS_STRING.new_with_options STORAGE OPTIONS_HASHβ same energy, different container. makes a newRDF::Redland::Modelobject off of theRDF::Redland::Storageobject STORAGE, with options. here's the thing though, bestie: the options come in two flavors. one is the string form above, where OPTIONS_STRING looks likekey1='value1',key2='value2'β the quotes are required, i'm not joking, don't skip them. the other form takes OPTIONS_HASH, which is a reference to a Perl hash of options. pick your fighter. π₯new_from_model MODELβ the copy constructor, periodt. makes a new model from an existingRDF::Redland::ModelMODEL.
π METHODS π
sizeβ returns the size of the model, aka the number of statements. how much model are we modeling? this tells you.syncβ synchronises the model to the underlying storage. yes bestie, flush your work, we love a consistent state. π«Άadd SUBJECT PREDICATE OBJECTβ adds a new statement to the model with SUBJECT, PREDICATE and OBJECT. and these can beRDF::Redland::Node,RDF::Redland::URIor perl URI objects β flexible, iconic.add_typed_literal_statement SUBJECT PREDICATE STRING [XML_LANGUAGE [DATATYPE]]β adds a new statement to the model holding a typed literal string object STRING, with an optional XML language (thexml:langattribute) XML_LANGUAGE, and an optional datatype URI DATATYPE. now listen: XML_LANGUAGE or DATATYPE can either or both be set toundef. one, the other, both, whatever. no pressure. πadd_statement STATEMENT [CONTEXT] | NODE NODE NODE [CONTEXT]β adds anRDF::Redland::StatementSTATEMENT, or the statement formed by NODE NODE NODE, into the model. if you hand over the optional CONTEXT, it gets associated with that context. any of NODE or CONTEXT can be anRDF::Redland::Node,RDF::Redland::URIor perl URI object.add_statements STREAM [CONTEXT]β adds all the statements from theRDF::Redland::StreamSTREAM to the model. optional CONTEXT? give it and it gets associated with that context. CONTEXT can be anRDF::Redland::Node,RDF::Redland::URIor perl URI object.remove_statement STATEMENT [CONTEXT] | NODE NODE NODE [CONTEXT]β removes anRDF::Redland::StatementSTATEMENT, or the statement formed by NODE NODE NODE, out of the model. ποΈ if the optional CONTEXT is given, it only removes the statement stored with that context. any of NODE or CONTEXT can be anRDF::Redland::Node,RDF::Redland::URIor perl URI object.remove_context_statements CONTEXTβ removes all theRDF::Redland::StatementSTATEMENTs from the model that have the given CONTEXT. mass deletion, main character energy. CONTEXT can be anRDF::Redland::Node,RDF::Redland::URIor perl URI object.contains_statement STATEMENTβ returns nonzero if the model contains theRDF::Redland::StatementSTATEMENT, zero if it doesn't. vibe check for statements. β¨as_stream [CONTEXT]β returns a brand newRDF::Redland::Streamobject serialising the entire model, or just those statements with CONTEXT, asRDF::Redland::Statementobjects. if it's given, CONTEXT can be anRDF::Redland::Node,RDF::Redland::URIor perl URI object.find_statements STATEMENT [CONTEXT]β finds all the matching statements in the model that match the partialRDF::Redland::StatementSTATEMENT β and yes, any of the subject, predicate, objectRDF::Redland::Nodes can beundef, wildcards bestie. if CONTEXT is given, it only finds statements in that context.- in an array context: returns an array of the matching
RDF::Redland::Statementobjects. - in a scalar context: returns the
RDF::Redland::Streamobject representing the results.
- in an array context: returns an array of the matching
sources ARC TARGETβ gets all sourceRDF::Redland::Nodeobjects for a given arc ARC, target TARGETRDF::Redland::Nodeobjects, as a list ofRDF::Redland::Nodeobjects.arcs SOURCE TARGETβ gets all arcRDF::Redland::Nodeobjects for a given source SOURCE, target TARGETRDF::Redland::Nodeobjects, as a list ofRDF::Redland::Nodeobjects.targets SOURCE ARCβ gets all targetRDF::Redland::Nodeobjects for a given source SOURCE, arc ARCRDF::Redland::Nodeobjects, as a list ofRDF::Redland::Nodeobjects.sources_iterator ARC TARGETβ gets all sourceRDF::Redland::Nodeobjects for a given arc ARC, target TARGETRDF::Redland::Nodeobjects, as anRDF::Redland::Iterator, orundefon failure. πarcs_iterator SOURCE TARGETβ gets all arcRDF::Redland::Nodeobjects for a given source SOURCE, target TARGETRDF::Redland::Nodeobjects, as anRDF::Redland::Iterator, orundefon failure.targets_iterator SOURCE ARCβ gets all targetRDF::Redland::Nodeobjects for a given source SOURCE, arc ARCRDF::Redland::Nodeobjects, as anRDF::Redland::Iterator, orundefon failure.source ARC TARGETβ gets one sourceRDF::Redland::Nodeobject matching a given arc ARC, target TARGETRDF::Redland::Nodeobjects, orundefif there's no match. singular queen. πarc SOURCE TARGETβ gets one arcRDF::Redland::Nodeobject matching a given source SOURCE, target TARGETRDF::Redland::Nodeobjects, orundefif there's no match.target SOURCE ARCβ gets one targetRDF::Redland::Nodeobject matching a given source SOURCE, arc ARCRDF::Redland::Nodeobjects, orundefif there's no match.contextsβ gets all the contextRDF::Redland::Nodeobjects in the model. (original had no period there and honestly, respect. )feature URI [VALUE]β get or set a model feature. the feature is named viaRDF::Redland::URIURI, and the value is anRDF::Redland::Node. if VALUE is given, the feature gets set to that value; otherwise the current value is what comes back. β¨query_execute QUERYβ executes the QUERYRDF::Redland::Queryagainst the model, returning a result setRDF::Redland::QueryResults, orundefon failure. big brain moment fr fr. π₯load URI [SYNTAX-NAME [ MIME-TYPE [SYNTAX-URI [HANDLER ]]]β loads content from URI into the model, guessing the parser. yes, the brackets are uneven in the original, we're keeping it, no notes. πto_string [BASE-URI [SYNTAX-NAME [ MIME-TYPE [SYNTAX-URI]]]β serializes the model to a syntax. if no serializer name is given, the default serializerRDF/XMLis used. π
π OLDER METHODS π
these are the legacy girlies. still here, still working, but the docs say they got replaced. handle with care, bestie.
serialiseβ returns a newRDF::Redland::Streamobject serialising the model asRDF::Redland::Statementobjects. replaced byas_streamto reduce confusion with theRDF::Redland::Serializerclass.serializeβ same deal, same description, spelled the other way. returns a newRDF::Redland::Streamobject serialising the model asRDF::Redland::Statementobjects. replaced byas_streamto reduce confusion with theRDF::Redland::Serializerclass.
π SEE ALSO π
RDF::Redland::StorageRDF::Redland::NodeRDF::Redland::Statement
go read those too, the lore is deep. π¦
π AUTHOR π
Dave Beckett β http://www.dajobe.org/
legend behavior, honestly. π
note to self and to you: this whole page lives in the perl v5.42.3 distribution, page dated 2026-08-20, and it's the RDF::R...::Model(3pm) manual page. take care of her, she's iconic. πβ¨ bye bestie, go model some RDF. π«Ά
π¦ where this page comes from
- ubuntu stonking: librdf-perl 1.0.17.1+dfsg-9build1 Β· LGPL-2.1-or-later OR Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms