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

# Attean::TripleModel(3pm)

RDF model backed by a set of triple-stores

## NAME

Attean::TripleModel - RDF model backed by a set of triple-stores

## VERSION

This document describes Attean::TripleModel version 0.035

## SYNOPSIS

```
  use v5.14;
  use Attean;
  my $model = Attean::TripleModel->new( stores => {
    'http://example.org/graph1' => $store1,
    'http://example.org/graph2' => $store2,
  } );
```

## DESCRIPTION

The Attean::TripleModel class represents a model that is backed by a set of Attean::API::TripleStore objects, identified by an IRI string. It conforms to the Attean::API::Model role.

The Attean::TripleModel constructor requires one named argument:

- stores

  A hash mapping graph IRI values to Attean::API::TripleStore objects representing the backing triple-store for that graph.

## METHODS

- "size"

  - "count\_quads"

  - "count\_quads\_estimate"

  - "holds"

  - "get\_graphs"

  - "get\_quads ( $subject, $predicate, $object, $graph )"

  Returns an Attean::API::Iterator for quads in the model that match the supplied `$subject`, `$predicate`, `$object`, and `$graph`. Any of these terms may be undefined or a Attean::API::Variable object, in which case that term will be considered as a wildcard for the purposes of matching.

  The returned iterator conforms to both Attean::API::Iterator and Attean::API::QuadIterator.

- "plans\_for\_algebra( $algebra, $planner, $active\_graphs, $default\_graphs )"

  Delegates to an underlying store if the active graph is bound to the store, and the store consumes Attean::API::CostPlanner.

- cost\_for\_plan( $plan )

  Attempts to delegate to all the underlying stores if that store consumes Attean::API::CostPlanner.

- "add\_store( $graph =\> $store )"

  Add the Attean::TripleStore `$store` object to the model using the IRI string value `$graph` as the graph name.

- create\_graph( $graph )

  Create a new Attean::TripleStore and add it to the model using the Attean::API::IRI `$graph` as the graph name.

  The store is constructed by using this object's `"store_constructor"` attribute:

  ```
    my $store = $self->store_constructor->($graph);
  ```

- drop\_graph( $graph )

  Removes the store associated with the given `$graph`.

- "add\_quad ( $quad )"

  Adds the specified `$quad` to the underlying model.

- "remove\_quad ( $quad )"

  Removes the specified `$quad` from the underlying store.

- drop\_graph( $graph )

  Removes the store associated with the given `$graph`.

- clear\_graph( $graph )

  Removes all quads with the given `$graph`.

## 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.
