Skip to content

Instantly share code, notes, and snippets.

@kjetilk
Created December 14, 2015 23:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kjetilk/947555d19bcae13fabd0 to your computer and use it in GitHub Desktop.
Save kjetilk/947555d19bcae13fabd0 to your computer and use it in GitHub Desktop.
test script for BGP rotating
1117 - Hash Join { s }
- SPARQLBGP
- Quad { ?s, <q>, ?.blank-0, <http://test.invalid/graph> }
- Quad { ?s, <q>, <a>, <http://test.invalid/graph> }
- Hash Join { s }
- SPARQLBGP
- Quad { ?s, <p>, "1", <http://test.invalid/graph> }
- Quad { ?a, <b>, <c>, <http://test.invalid/graph> }
- Quad { ?s, <p>, ?o, <http://test.invalid/graph> }
1117 - Hash Join { s }
- Hash Join { s }
- SPARQLBGP
- Quad { ?s, <p>, "1", <http://test.invalid/graph> }
- Quad { ?a, <b>, <c>, <http://test.invalid/graph> }
- Quad { ?s, <p>, ?o, <http://test.invalid/graph> }
- SPARQLBGP
- Quad { ?s, <q>, ?.blank-0, <http://test.invalid/graph> }
- Quad { ?s, <q>, <a>, <http://test.invalid/graph> }
1117 - Hash Join { s }
- SPARQLBGP
- Quad { ?s, <q>, ?.blank-0, <http://test.invalid/graph> }
- Quad { ?s, <q>, <a>, <http://test.invalid/graph> }
- Hash Join { s }
- Quad { ?s, <p>, ?o, <http://test.invalid/graph> }
- SPARQLBGP
- Quad { ?s, <p>, "1", <http://test.invalid/graph> }
- Quad { ?a, <b>, <c>, <http://test.invalid/graph> }
1117 - Hash Join { s }
- Hash Join { s }
- Quad { ?s, <p>, ?o, <http://test.invalid/graph> }
- SPARQLBGP
- Quad { ?s, <p>, "1", <http://test.invalid/graph> }
- Quad { ?a, <b>, <c>, <http://test.invalid/graph> }
- SPARQLBGP
- Quad { ?s, <q>, ?.blank-0, <http://test.invalid/graph> }
- Quad { ?s, <q>, <a>, <http://test.invalid/graph> }
1117 - Hash Join { s }
- Hash Join { s }
- Quad { ?s, <p>, ?o, <http://test.invalid/graph> }
- SPARQLBGP
- Quad { ?s, <q>, ?.blank-0, <http://test.invalid/graph> }
- Quad { ?s, <q>, <a>, <http://test.invalid/graph> }
- SPARQLBGP
- Quad { ?s, <p>, "1", <http://test.invalid/graph> }
- Quad { ?a, <b>, <c>, <http://test.invalid/graph> }
use v5.14;
use autodie;
use utf8;
use Digest::SHA qw(sha1_hex);
use CHI;
use Attean;
use Attean::RDF;
use AtteanX::IDPQueryPlanner::Cache;
use AtteanX::Store::Memory;
#use Carp::Always;
use Data::Dumper;
use AtteanX::Store::SPARQL;
use AtteanX::Model::SPARQLCache;
my $cache = CHI->new( driver => 'Memory', global => 1 );
my $p = AtteanX::IDPQueryPlanner::Cache->new;
my $store = Attean->get_store('SPARQL')->new('endpoint_url' => iri('http://test.invalid/'));
my $model = AtteanX::Model::SPARQLCache->new( store => $store, cache => $cache );
my $graph = iri('http://test.invalid/graph');
my $t = triple(variable('s'), iri('p'), literal('1'));
my $u = triple(variable('s'), iri('p'), variable('o'));
my $v = triple(variable('s'), iri('q'), blank('xyz'));
my $w = triple(variable('a'), iri('b'), iri('c'));
my $x = triple(variable('s'), iri('q'), iri('a'));
my $y = triple(variable('o'), iri('b'), literal('2'));
my $z = triple(variable('a'), iri('c'), variable('s'));
my $s = triple(iri('a'), variable('p'), variable('o'));
my $bgp = Attean::Algebra::BGP->new(triples => [$t, $u, $v, $w, $x]);
my @plans = $p->plans_for_algebra($bgp, $model, [$graph]);
foreach my $plan (@plans) {
warn $plan->cost ."\t".$plan->as_string . "\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment