1Attean(3)             User Contributed Perl Documentation            Attean(3)
2
3
4

NAME

6       Attean - A Semantic Web Framework
7

VERSION

9       This document describes Attean version 0.030
10

SYNOPSIS

12         use Attean;
13         use Attean::RDF qw(iri);
14
15         my $store = Attean->get_store('Memory')->new();
16         my $parser = Attean->get_parser('NTriples')->new();
17
18         # iterator of triples and quads
19         my $iter = $parser->parse_iter_from_io(\*STDIN);
20
21         # add a graph name to all triples
22         my $graph = iri('http://graph-name/');
23         my $quads = $iter->as_quads($graph);
24
25         $store->add_iter($quads);
26         my $model = Attean::QuadModel->new( store => $store );
27         my $iter = $model->get_quads();
28         while (my $quad = $iter->next) {
29           say $quad->object->ntriples_string;
30         }
31
32         # run a SPARQL query and iterate over the results
33         my $sparql = 'SELECT * WHERE { ?s ?p ?o }';
34         my $s = Attean->get_parser('SPARQL')->new();
35         my ($algebra) = $s->parse($sparql);
36         my $results = $model->evaluate($algebra, $graph);
37         while (my $r = $results->next) {
38           say $r->as_string;
39         }
40

DESCRIPTION

42       Attean provides APIs for parsing, storing, querying, and serializing
43       Semantic Web (RDF and SPARQL) data.
44

METHODS

46       "get_store( $NAME )"
47           Attempts to find a Attean::API::Store implementation with the given
48           $NAME. This is done using Module::Pluggable and will generally be
49           searching for class names "AtteanX::Store::$NAME".
50
51           Returns the full class name if a matching implementation is found,
52           otherwise returns undef.
53
54       "temporary_model"
55           Returns a temporary, mutable quad model based on a
56           AtteanX::Store::Memory store.
57
58       "get_serializer( $NAME )"
59       "get_serializer( filename => $FILENAME )"
60       "get_serializer( media_type => $MEDIA_TYPE )"
61           Attempts to find a Attean::API::Serializer serializer class with
62           the given $NAME, or that can serialize files with the $MEDIA_TYPE
63           media type.
64
65           Returns the full class name if a matching implementation is found,
66           otherwise returns undef.
67
68       "get_parser( $NAME )"
69       "get_parser( filename => $FILENAME )"
70       "get_parser( media_type => $MEDIA_TYPE )"
71           Attempts to find a Attean::API::Parser parser class with the given
72           $NAME, or that can parse files with the same extension as
73           $FILENAME, or that can parse files with the $MEDIA_TYPE media type.
74
75           Returns the full class name if a matching implementation is found,
76           otherwise returns undef.
77
78       "negotiate_serializer ( request_headers => $request_headers, restrict
79       => \@serializer_names, extend => \%media_types )"
80           Returns a two-element list containing an appropriate media type and
81           Attean::API::Serializer class as decided by HTTP::Negotiate.  If
82           the 'request_headers' key-value is supplied, the $request_headers
83           is passed to "HTTP::Negotiate::choose".  The option 'restrict', set
84           to a list of serializer names, can be used to limit the serializers
85           to choose from.  Finally, an "<'extend'"> option can be set to a
86           hashref that contains MIME-types as keys and a custom variant as
87           value. This will enable the user to use this negotiator to return a
88           type that isn't supported by any serializers.  The subsequent code
89           will have to find out how to return a representation.
90
91       "acceptable_parsers ( handles => $item_role, prefer => $parser_role )"
92           Returns a string value expressing the media types that are
93           acceptable to the parsers available to the system. This string may
94           be used as an 'Accept' HTTP header value.
95
96           If a "handles" role is supplied, only parsers that produce objects
97           that conform to $item_role will be included.
98
99           If a "prefer" role is supplied, only parsers that conform to
100           $parser_role will be included.
101
102           Parsers are given a quality-value (expressing a preferred order or
103           use) based on the roles each parser consumes. Parsers consuming
104           Attean::API::PullParser are preferred, while those consuming
105           Attean::API::AtOnceParser are not preferred. An exact ordering
106           between parsers consuming similar roles is currently undefined.
107

BUGS

109       Please report any bugs or feature requests to through the GitHub web
110       interface at <https://github.com/kasei/attean/issues>.
111

SEE ALSO

AUTHOR

114       Gregory Todd Williams  "<gwilliams@cpan.org>"
115
117       Copyright (c) 2014--2020 Gregory Todd Williams.  This program is free
118       software; you can redistribute it and/or modify it under the same terms
119       as Perl itself.
120
121
122
123perl v5.34.0                      2021-07-22                         Attean(3)
Impressum