On 03/10/12 20:24, Stephen Allen wrote:
All,

So I'm trying to test the streaming SPARQL Update changes I've done in
ARQ and Fuseki.  I've created a class called GraphStoreNull, which
implements the GraphStore interface.  It basically throws away all
quads that are added/removed and always answers with a null iterator
when querying.   I want to use it for stress testing the streaming
implementation by sending in a bunch of massively large SPARQL Update
requests (which jena-client can generate and stream over HTTP).

Anyway, the stumbling block I'm running into is how to create a config
file for Fuseki to use this class as the basis for a dataset.  I can't
seem to wrap my head around the whole Assembler functionality.  I've
got a config that looks like this:

=====================
@prefix :        <#> .
@prefix fuseki:  <http://jena.apache.org/fuseki#> .
@prefix rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .

@prefix rdfs:   <http://www.w3.org/2000/01/rdf-schema#> .
@prefix tdb:     <http://jena.hpl.hp.com/2008/tdb#> .
@prefix ja:      <http://jena.hpl.hp.com/2005/11/Assembler#> .

[] rdf:type fuseki:Server ;
    fuseki:services (
      <#service1>
    ) .

<#service1> rdf:type fuseki:Service ;
     fuseki:name                        "ds" ;
     fuseki:serviceQuery                "sparql" ;
     fuseki:serviceQuery                "query" ;
     fuseki:serviceUpdate               "update" ;
     fuseki:serviceUpload               "upload" ;
     fuseki:serviceReadWriteGraphStore  "data" ;
     fuseki:serviceReadGraphStore       "get" ;
     fuseki:dataset                     <#emptyDataset> ;
     .

<#emptyDataset> rdf:type ja:RDFDataset .   # this seems to make it use
an in-memory model

====================

What do I need to specify to make it use
"com.hp.hpl.jena.sparql.modify.GraphStoreNull" as the backing store
for #service1?

The internals of the assemblers are not very easy to follow. They only get touched once in a blue moon so the knowledge is in obscure bits of code.

You need to do the following

1/ Write an assembler for the new thing
2/ register it.
3/ Add a rdfs:subClassOf relationship

See DatasetAssembler for an example

== Write an assembler

public class DatasetNullAssembler extends AssemblerBase {
    @Override
    public Object open(Assembler a, Resource root, Mode mode)
    {
        return new GraphStoreNull()
    }
}

== Register an assembler

See AssemblerUtils.registerWith

has the ARQ specific registrations.

( I have just changed the name from "register" to make it accurate :-)

== subclass

Put this in the description (it should be possible to do this in code somewhere but I can't see where - if anyone finds out please say, it would be good to have elsewhere as well.).

ja:DatasetNull  rdfs:subClassOf  ja:RDFDataset .

== Testing

I did sparql --desc desc.ttl 'SELECT * { ?s ?p ?o }' and got an empty result.

I didn't test with Fuseki itself.

I have prodded Jenkins to do a complete developer build so it will be propagating to Fuseki in the next hour or so.


-- desc.ttl
--------------------
@prefix rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs:   <http://www.w3.org/2000/01/rdf-schema#> .
@prefix ja:      <http://jena.hpl.hp.com/2005/11/Assembler#> .

ja:DatasetNull  rdfs:subClassOf  ja:RDFDataset .

<#emptyDataset> rdf:type ja:DatasetNull .
--------------------


You don't need the ja:loadClass magic code to bring in custom code (as TDB does currently) because this is built into ARQ.

[] ja:loadClass "com.hp.hpl.jena.tdb.TDB" .
tdb:DatasetTDB  rdfs:subClassOf  ja:RDFDataset .
tdb:GraphTDB    rdfs:subClassOf  ja:Model .

------------------------
Before you do this, you might like to "svn update". Having had to remember how this works, I added what you might need at least as a start. Having done it, I might as well commit the changes.

        Andy


-Stephen


Reply via email to