NAME
RDF::Closure - pure Perl RDF inferencing
SYNOPSIS
@@TODO
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:
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 constantsFLT_NONRDF
andFLT_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 .} is boring. 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.
SEE ALSO
RDF::Closure::Engine, RDF::Closure::Model, RDF::Trine::Parser::OwlFn.
http://www.ivan-herman.net/Misc/2008/owlrl/.
AUTHOR
Toby Inkster <tobyink@cpan.org>.
COPYRIGHT
Copyright 2011 Toby Inkster
This library is free software; you can redistribute it and/or modify it under any of the following licences:
The Artistic License 1.0 http://www.perlfoundation.org/artistic_license_1_0.
The GNU General Public License Version 1 http://www.gnu.org/licenses/old-licenses/gpl-1.0.txt, or (at your option) any later version.
The W3C Software Notice and License http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231.
The Clarified Artistic License http://www.ncftp.com/ncftp/doc/LICENSE.txt.