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.020
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 "get_serializer( $NAME )"
45 "get_serializer( media_type => $MEDIA_TYPE )"
46 Attempts to find a Attean::API::Serializer serializer class with
47 the given $NAME, or that can serialize files with the $MEDIA_TYPE
48 media type.
49
50 Returns the full class name if a matching implementation is found,
51 otherwise returns undef.
52
53 "get_parser( $NAME )"
54 "get_parser( filename => $FILENAME )"
55 "get_parser( media_type => $MEDIA_TYPE )"
56 Attempts to find a Attean::API::Parser parser class with the given
57 $NAME, or that can parse files with the same extension as
58 $FILENAME, or that can parse files with the $MEDIA_TYPE media type.
59
60 Returns the full class name if a matching implementation is found,
61 otherwise returns undef.
62
63 "negotiate_serializer ( request_headers => $request_headers, restrict
64 => \@serializer_names, extend => \%media_types )"
65 Returns a two-element list containing an appropriate media type and
66 Attean::API::Serializer class as decided by HTTP::Negotiate. If
67 the 'request_headers' key-value is supplied, the $request_headers
68 is passed to "HTTP::Negotiate::choose". The option 'restrict', set
69 to a list of serializer names, can be used to limit the serializers
70 to choose from. Finally, an "<'extend'"> option can be set to a
71 hashref that contains MIME-types as keys and a custom variant as
72 value. This will enable the user to use this negotiator to return a
73 type that isn't supported by any serializers. The subsequent code
74 will have to find out how to return a representation.
75
76 "acceptable_parsers ( handles => $item_role, prefer => $parser_role )"
77 Returns a string value expressing the media types that are
78 acceptable to the parsers available to the system. This string may
79 be used as an 'Accept' HTTP header value.
80
81 If a "handles" role is supplied, only parsers that produce objects
82 that conform to $item_role will be included.
83
84 If a "prefer" role is supplied, only parsers that conform to
85 $parser_role will be included.
86
87 Parsers are given a quality-value (expressing a preferred order or
88 use) based on the roles each parser consumes. Parsers consuming
89 Attean::API::PullParser are preferred, while those consuming
90 Attean::API::AtOnceParser are not preferred. An exact ordering
91 between parsers consuming similar roles is currently undefined.
92
94 Please report any bugs or feature requests to through the GitHub web
95 interface at <https://github.com/kasei/attean/issues>.
96
99 Gregory Todd Williams "<gwilliams@cpan.org>"
100
102 Copyright (c) 2014--2018 Gregory Todd Williams. This program is free
103 software; you can redistribute it and/or modify it under the same terms
104 as Perl itself.
105
106
107
108perl v5.28.1 2019-01-09 Attean(3)