AtteanX-Store-LDF

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

NAME
    AtteanX::Store::LDF - Linked Data Fragment RDF store

SYNOPSIS
        use v5.14;
        use Attean;
        use Attean::RDF qw(iri blank literal);
        use AtteanX::Store::LDF;

        my $uri   = 'http://fragments.dbpedia.org/2014/en';
        my $store = Attean->get_store('LDF')->new(start_url => $uri);

        my $iter = $store->get_triples(undef,undef,literal("Albert Einstein"));

        while (my $triple = $iter->next) {
         say $triple->subject->ntriples_string .
           " " .
           $triple->predicate->ntriples_string . 
           " " .
           $triple->object->ntriples_string  .
           " .";
        }

DESCRIPTION
    AtteanX::Store::LDF provides a triple-store connected to a Linked Data
    Fragment server. For more information on Triple Pattern Fragments consult
    <http://linkeddatafragments.org/>

METHODS
    Beyond the methods documented below, this class inherits methods from the
    Attean::API::TripleStore class.

    new( start_url => $start_url )
        Returns a new LDF-backed storage object. The required `start_url`
        argument is a URL pointing at any Linked Data Fragment. The attribure
        will be coerced, so it can be a string, a URI object, etc.

demo/README  view on Meta::CPAN

To create an LDF server change the test.json file to set up a correct path to a Turtle file,
then run:

 $ ./boot.sh

A LDF endpoint should now be available at http://localhost:8000/fragments

 $ curl -H "Accept: text/turtle" http://localhost:8000/fragments

demo/test.json  view on Meta::CPAN

{
    "base_uri"  : "http://localhost/",
    "store" : {
        "storetype"     : "Memory",
        "sources" : [ { 
            "file" : "/tmp/test.ttl",
            "syntax" : "turtle"
        } ]
    },
 
    "fragments" : { 
      "fragments_path" : "/fragments" ,
      "allow_dump_dataset" : "1"
    } ,

    "void": {
        "urispace" : "http://localhost"
    }
}

demo/test.pl  view on Meta::CPAN

use v5.14;
use Attean;
use Attean::RDF qw(iri blank literal);
use AtteanX::Store::LDF;

my $uri   = 'http://fragments.dbpedia.org/2014/en';
my $store = Attean->get_store('LDF')->new(start_url => $uri);

my $num  = $store->count_triples(iri('http://example.org/UNEXPECTED'));

warn "num: $num";

my $iter = $store->get_triples(iri('http://example.org/UNEXPECTED'));

while (my $triple = $iter->next) {
 say $triple->subject->ntriples_string .

demo/test.ttl  view on Meta::CPAN

@base <http://localhost:8000/fragments> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
 
</foo> rdfs:label "This is a test"@en ;
       <http://xmlns.com/foaf/0.1/page> <http://en.wikipedia.org/wiki/Foo> .
</bar/baz/bing> rdfs:label "Testing with longer URI."@en .

lib/AtteanX/Store/LDF.pm  view on Meta::CPAN


=end markdown

=head1 SYNOPSIS

    use v5.14;
    use Attean;
    use Attean::RDF qw(iri blank literal);
    use AtteanX::Store::LDF;

    my $uri   = 'http://fragments.dbpedia.org/2014/en';
    my $store = Attean->get_store('LDF')->new(start_url => $uri);

    my $iter = $store->get_triples(undef,undef,literal("Albert Einstein"));

    while (my $triple = $iter->next) {
     say $triple->subject->ntriples_string .
       " " .
       $triple->predicate->ntriples_string . 
       " " .
       $triple->object->ntriples_string  .
       " .";
    }

=head1 DESCRIPTION

AtteanX::Store::LDF provides a triple-store connected to a Linked Data Fragment server.
For more information on Triple Pattern Fragments consult L<http://linkeddatafragments.org/>

=cut

use v5.14;
use warnings;

package AtteanX::Store::LDF;

our $AUTHORITY = 'cpan:KJETILK';
our $VERSION = '0.04';

lib/Test/Attean/Store/LDF/Role/CreateStore.pm  view on Meta::CPAN

		}
		$model->add_statement(statement($s, $p, $o));
	}

	my $ld = RDF::LinkedData->new(
		model            => $model ,
		base_uri         => 'http://example.org' ,
		void_config      => { 
			urispace => 'http://example.org/' 
		} ,
		fragments_config => { 
			fragments_path => '/fragments' ,
			allow_dump_dataset => 1,
		} ,
	);

	my $endpoint = 'http://example.org/fragments';

	my $useragent = Test::LWP::UserAgent->new;
	$useragent->register_psgi('example.org', sub {
	    my $env = shift;
	    $ld->request(Plack::Request->new($env));
		my $uri = $endpoint;
	   	$uri .= sprintf "?%s" , $env->{QUERY_STRING} if length $env->{QUERY_STRING};
		return $ld->response($uri)->finalize;
	});



( run in 1.685 second using v1.01-cache-2.11-cpan-364913b4093 )