---
name: "Attean"
section: "3pm"
platform: "linux"
package: "libattean-perl"
version: "0.035-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/Attean"
---

# Attean(3pm)

A Semantic Web Framework

## NAME

Attean - A Semantic Web Framework

## VERSION

This document describes Attean version 0.035

## SYNOPSIS

```
  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;
  }
```

## DESCRIPTION

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

## METHODS

- get\_store( $NAME )

  Attempts to find a Attean::API::Store implementation with the given `$NAME`. This is done using Module::Pluggable and will generally be searching for class names `"AtteanX::Store::$NAME"`.

  Returns the full class name if a matching implementation is found, otherwise returns undef.

- "temporary\_model"

  Returns a temporary, mutable quad model based on a AtteanX::Store::Memory store.

- get\_serializer( $NAME )

  - "get\_serializer( filename =\> $FILENAME )"

  - "get\_serializer( media\_type =\> $MEDIA\_TYPE )"

  Attempts to find a Attean::API::Serializer serializer class with the given `$NAME`, or that can serialize files with the `$MEDIA_TYPE` media type.

  Returns the full class name if a matching implementation is found, otherwise returns undef.

- get\_parser( $NAME )

  - "get\_parser( filename =\> $FILENAME )"

  - "get\_parser( media\_type =\> $MEDIA\_TYPE )"

  Attempts to find a Attean::API::Parser parser class with the given `$NAME`, or that can parse files with the same extension as `$FILENAME`, or that can parse files with the `$MEDIA_TYPE` media type.

  Returns the full class name if a matching implementation is found, otherwise returns undef.

- "negotiate\_serializer ( request\_headers =\> $request\_headers, restrict =\> \\@serializer\_names, extend =\> \\%media\_types )"

  Returns a two-element list containing an appropriate media type and Attean::API::Serializer class as decided by HTTP::Negotiate.  If the `'request_headers'` key-value is supplied, the `$request_headers` is passed to `"HTTP::Negotiate::choose"`.  The option `'restrict'`, set to a list of serializer names, can be used to limit the serializers to choose from. Finally, an `"<'extend'"`\> option can be set to a hashref that contains MIME-types as keys and a custom variant as value. This will enable the user to use this negotiator to return a type that isn't supported by any serializers. The subsequent code will have to find out how to return a representation.

- "acceptable\_parsers ( handles =\> $item\_role, prefer =\> $parser\_role )"

  Returns a string value expressing the media types that are acceptable to the parsers available to the system. This string may be used as an 'Accept' HTTP header value.

  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.

- register\_global\_function( %uri\_to\_func )

  - get\_global\_function( $uri )

  - register\_global\_functional\_form( %uri\_to\_func )

  - get\_global\_functional\_form( $uri )

  - register\_global\_aggregate( %uri\_to\_hash )

  - get\_global\_aggregate( $uri )

  - register\_datatype\_role( %uri\_to\_role )

  - get\_datatype\_role( $uri )

  ## BUGS

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

## SEE ALSO

## AUTHOR

Gregory Todd Williams  `"<gwilliams@cpan.org>"`

## COPYRIGHT

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.
