Attean(3pm) | User Contributed Perl Documentation | Attean(3pm) |
Attean - A Semantic Web Framework
This document describes Attean version 0.033
use Attean; use Attean::RDF qw(iri); my $store = Attean->get_store('Memory')->new(); my $parser = Attean->get_parser('NTriples')->new(); # iterator of triples and quads my $iter = $parser->parse_iter_from_io(\*STDIN); # add a graph name to all triples my $graph = iri('http://graph-name/'); my $quads = $iter->as_quads($graph); $store->add_iter($quads); my $model = Attean::QuadModel->new( store => $store ); my $iter = $model->get_quads(); while (my $quad = $iter->next) { say $quad->object->ntriples_string; } # run a SPARQL query and iterate over the results my $sparql = 'SELECT * WHERE { ?s ?p ?o }'; my $s = Attean->get_parser('SPARQL')->new(); my ($algebra) = $s->parse($sparql); my $results = $model->evaluate($algebra, $graph); while (my $r = $results->next) { say $r->as_string; }
Attean provides APIs for parsing, storing, querying, and serializing Semantic Web (RDF and SPARQL) data.
Returns the full class name if a matching implementation is found, otherwise returns undef.
Returns the full class name if a matching implementation is found, otherwise returns undef.
Returns the full class name if a matching implementation is found, otherwise returns undef.
If a "handles" role is supplied, only parsers that produce objects that conform to $item_role will be included.
If a "prefer" role is supplied, only parsers that conform to $parser_role will be included.
Parsers are given a quality-value (expressing a preferred order or use) based on the roles each parser consumes. Parsers consuming Attean::API::PullParser are preferred, while those consuming Attean::API::AtOnceParser are not preferred. An exact ordering between parsers consuming similar roles is currently undefined.
Please report any bugs or feature requests to through the GitHub web interface at <https://github.com/kasei/attean/issues>.
Gregory Todd Williams "<gwilliams@cpan.org>"
Copyright (c) 2014--2022 Gregory Todd Williams. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
2022-10-06 | perl v5.34.0 |