1Attean(3) User Contributed Perl Documentation Attean(3)
2
3
4
6 Attean - A Semantic Web Framework
7
9 This document describes Attean version 0.025
10
12 use v5.14;
13 use Attean;
14 use Attean::RDF qw(iri);
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 $quads = $iter->as_quads(iri('http://graph-name/'));
23
24 $store->add_iter($quads);
25 my $model = Attean::QuadModel->new( store => $store );
26 my $iter = $model->get_quads();
27 while (my $quad = $iter->next) {
28 say $quad->object->ntriples_string;
29 }
30
32 Attean provides APIs for parsing, storing, querying, and serializing
33 Semantic Web (RDF and SPARQL) data.
34
36 "get_store( $NAME )"
37 Attempts to find a Attean::API::Store implementation with the given
38 $NAME. This is done using Module::Pluggable and will generally be
39 searching for class names "AtteanX::Store::$NAME".
40
41 Returns the full class name if a matching implementation is found,
42 otherwise returns undef.
43
44 "temporary_model"
45 Returns a temporary, mutable quad model based on a
46 AtteanX::Store::Memory store.
47
48 "get_serializer( $NAME )"
49 "get_serializer( media_type => $MEDIA_TYPE )"
50 Attempts to find a Attean::API::Serializer serializer class with
51 the given $NAME, or that can serialize files with the $MEDIA_TYPE
52 media type.
53
54 Returns the full class name if a matching implementation is found,
55 otherwise returns undef.
56
57 "get_parser( $NAME )"
58 "get_parser( filename => $FILENAME )"
59 "get_parser( media_type => $MEDIA_TYPE )"
60 Attempts to find a Attean::API::Parser parser class with the given
61 $NAME, or that can parse files with the same extension as
62 $FILENAME, or that can parse files with the $MEDIA_TYPE media type.
63
64 Returns the full class name if a matching implementation is found,
65 otherwise returns undef.
66
67 "negotiate_serializer ( request_headers => $request_headers, restrict
68 => \@serializer_names, extend => \%media_types )"
69 Returns a two-element list containing an appropriate media type and
70 Attean::API::Serializer class as decided by HTTP::Negotiate. If
71 the 'request_headers' key-value is supplied, the $request_headers
72 is passed to "HTTP::Negotiate::choose". The option 'restrict', set
73 to a list of serializer names, can be used to limit the serializers
74 to choose from. Finally, an "<'extend'"> option can be set to a
75 hashref that contains MIME-types as keys and a custom variant as
76 value. This will enable the user to use this negotiator to return a
77 type that isn't supported by any serializers. The subsequent code
78 will have to find out how to return a representation.
79
80 "acceptable_parsers ( handles => $item_role, prefer => $parser_role )"
81 Returns a string value expressing the media types that are
82 acceptable to the parsers available to the system. This string may
83 be used as an 'Accept' HTTP header value.
84
85 If a "handles" role is supplied, only parsers that produce objects
86 that conform to $item_role will be included.
87
88 If a "prefer" role is supplied, only parsers that conform to
89 $parser_role will be included.
90
91 Parsers are given a quality-value (expressing a preferred order or
92 use) based on the roles each parser consumes. Parsers consuming
93 Attean::API::PullParser are preferred, while those consuming
94 Attean::API::AtOnceParser are not preferred. An exact ordering
95 between parsers consuming similar roles is currently undefined.
96
98 Please report any bugs or feature requests to through the GitHub web
99 interface at <https://github.com/kasei/attean/issues>.
100
103 Gregory Todd Williams "<gwilliams@cpan.org>"
104
106 Copyright (c) 2014--2019 Gregory Todd Williams. This program is free
107 software; you can redistribute it and/or modify it under the same terms
108 as Perl itself.
109
110
111
112perl v5.30.1 2020-01-29 Attean(3)