Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

rdf::closure::model(3pm) [debian man page]

RDF::Closure::Model(3pm)				User Contributed Perl Documentation				  RDF::Closure::Model(3pm)

NAME
RDF::Closure::Model - RDF::Trine::Model-compatible inferface DESCRIPTION
This module provides a subclass of RDF::Trine::Model allowing you to dollop some reasoning into existing RDF::Trine code very easily. While RDF::Closure::Engine allows you to infer lots of new statements from an existing model, this class also allows you to add and remove statements from the reasoned model with new inferences calculated on-the-fly. Removing a statement is much slower than adding one, though adding a statement isn't what you'd call fast. Juditious use of "begin_bulk_ops" and "end_bulk_ops" is recomnmended. If a lot of statements have been added and removed from a model since it was created, then it's theoretically possible for the inferred data to contain statements which are no longer entailed by the explicit data, or for the inferred data to be missing some inferences. A "recalculate" method is provided which allows you to re-run the inference from scratch. Constructor o "new($input, [, engine => $engine ] [, store => $store ])" Instantiates a module. $input may be undef, an existing RDF::Trine::Model or an RDF::Trine::Store. The input will not be modified. $engine is the inference engine to use; a string suitable for passing to "RDF::Closure::Engine->new"; defaults to 'RDFS'. $store is an RDF::Trine::Store to use to build the inferred model in; defaults to a new, temporary store. Methods This package inherits from RDF::Trine::Model and provides all the methods it does. It additionally provides: o "entailment_regime" Returns a URI string identifying the type of inference in use. o "recalculate" Drops and re-infers all inferred data. SEE ALSO
RDF::Closure, RDF::Closure::Engine, RDF::Trine::Model. Take careful note of the "begin_bulk_ops" and "end_bulk_ops" methods present in RDF::Trine::Model. Judicious use of them can seriously speed up this module. <http://www.perlrdf.org/>. AUTHOR
Toby Inkster <tobyink@cpan.org>. COPYRIGHT
Copyright 2011-2012 Toby Inkster This library is free software; you can redistribute it and/or modify it under any of the following licences: o The Artistic License 1.0 <http://www.perlfoundation.org/artistic_license_1_0>. o The GNU General Public License Version 1 http://www.gnu.org/licenses/old-licenses/gpl-1.0.txt <http://www.gnu.org/licenses/old- licenses/gpl-1.0.txt>, or (at your option) any later version. o The W3C Software Notice and License http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 <http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231>. o The Clarified Artistic License <http://www.ncftp.com/ncftp/doc/LICENSE.txt>. DISCLAIMER OF WARRANTIES
THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. perl v5.14.2 2012-06-28 RDF::Closure::Model(3pm)

Check Out this Related Man Page

RDF::Closure(3pm)					User Contributed Perl Documentation					 RDF::Closure(3pm)

NAME
RDF::Closure - pure Perl RDF inferencing SYNOPSIS
use RDF::Trine::Iterator qw[sgrep]; use RDF::Closure qw[iri mk_filter FLT_NONRDF FLT_BORING]; my $data = iri('http://bloggs.example.com/foaf.rdf'); my $foaf = iri('http://xmlns.com/foaf/0.1/index.rdf'); my $model = RDF::Trine::Model->temporary_model; my $p = 'RDF::Trine::Parser'; $p->parse_url_into_model($data->uri, $model, context => $data->uri); $p->parse_url_into_model($foaf->uri, $model, context => $foaf->uri); my $cl = RDF::Closure::Engine->new('rdfs', $model); $cl->closure; my $filter = mk_filter(FLT_NONRDF|FLT_BORING, [$foaf]); my $output = &sgrep($filter, $model->as_stream); print RDF::Trine::Serializer ->new('RDFXML') ->serialize_iterator_to_string($output); DESCRIPTION
This distribution is a pure Perl RDF inference engine designed as an add-in for RDF::Trine. It is largely a port of Ivan Herman's Python RDFClosure library, though there has been some restructuing, and there are a few extras thrown in. Where one of the Perl modules has a direct equivalent in Ivan's library, this is noted in the POD. Functions This package inherits from RDF::Trine and exports the same functions, plus: o "mk_filter($basic_filters, $ignore_contexts)" Creates a filter (coderef) suitable for use with "sgrep" from RDF::Trine::Iterator. $basic_filters is an integer which can be assembled by bitwise-OR-ing the constants "FLT_NONRDF" and "FLT_BORING". $ignore_contexts is an arrayref of RDF::Trine::Node objects, each of which represents a context that should be filtered out. use RDF::Trine::Iterator qw[sgrep]; use RDF::Closure qw[iri mk_filter FLT_NONRDF FLT_BORING]; my $foaf = iri('http://xmlns.com/foaf/0.1/index.rdf'); my $filter = mk_filter(FLT_NONRDF|FLT_BORING, [$foaf]); my $remaining = &sgrep($filter, $model->as_stream); # $remaining is now an iterator which will return all triples # from $model except: those in the FOAF named graph, those which # are non-RDF (e.g. literal subject) and those which are boring. Which triples are boring? Any triple of the form { ?x owl:sameAs ?x .}, { ?x owl:equivalentProperty ?x .}, { ?x owl:equivalentClass ?x .}, { ?x rdfs:subPropertyOf ?x .} or { ?x rdfs:subClassOf ?x .} is boring (i.e. where these statements have the same term in subject and object position). Any triple where the subject, predicate and object nodes are all in the RDF, RDFS, OWL or XSD namespaces is boring. Other triples are not boring. For convenience, "RDF::Closure" also exports variables called $RDF, $RDFS, $OWL and $XSD which are RDF::Trine::Namespace objects. SEE ALSO
RDF::Closure::Engine, RDF::Closure::Model, RDF::Trine::Parser::OwlFn. RDF::Trine, RDF::Query. <http://www.perlrdf.org/>. http://www.ivan-herman.net/Misc/2008/owlrl/ <http://www.ivan-herman.net/Misc/2008/owlrl/>. AUTHOR
Toby Inkster <tobyink@cpan.org>. COPYRIGHT
Copyright 2011-2012 Toby Inkster This library is free software; you can redistribute it and/or modify it under any of the following licences: o The Artistic License 1.0 <http://www.perlfoundation.org/artistic_license_1_0>. o The GNU General Public License Version 1 http://www.gnu.org/licenses/old-licenses/gpl-1.0.txt <http://www.gnu.org/licenses/old- licenses/gpl-1.0.txt>, or (at your option) any later version. o The W3C Software Notice and License http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 <http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231>. o The Clarified Artistic License <http://www.ncftp.com/ncftp/doc/LICENSE.txt>. DISCLAIMER OF WARRANTIES
THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. perl v5.14.2 2012-06-28 RDF::Closure(3pm)
Man Page