You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Benson Margulies <bi...@gmail.com> on 2012/01/08 17:30:55 UTC

A little reification confusion

A little snippet of code follows. I'm getting an
'AlreadyReifiedException' for a statement that returned false for
'model.contains'. This doesn't strike me as plausible. I'm running
2.6.4, I'll update now and see if things improve.



            Statement stmt = null;
            if (rel.getLiteral() != null) {
                stmt = model.createStatement(subResource, relProp,
model.createLiteral(rel.getLiteral()));
            } else {
                objResource =
mentionToCrossdocMap.get(rel.getObjectEntityOrdinal());
                stmt = model.createStatement(subResource, relProp,
objResource);
            }
            ReifiedStatement rstmt = null;
            if (model.contains(stmt)) {
                RSIterator reit = model.listReifiedStatements(stmt);
                rstmt = reit.nextRS();
            } else {
                model.add(stmt);
                String reUrl = RdfUtils.relationshipUri(docId, ordinal);
                rstmt = model.createReifiedStatement(reUrl, stmt);
            }

Re: load quad dump; tdb+joseki

Posted by Andy Seaborne <an...@apache.org>.
On 08/02/12 18:05, Peter Jungen wrote:
> Hello there,
>
> I need some advice..
>
> well, I loaded a quad dump from a triple store, into TDB (as the dump
> consists of multiple files, I wrote a bash loaderscript for that).

tdbloader works with quads.

Did the data have named graphs?

>
> So far, so good. I can queue the data via commandline, using tdbquery.

example?

>
> ..Still, I'm having problems hooking it up to the joseki SPARQL endpoint.

TDB version?
Fuseki is "Joseki4"

> I followed the instructions here
> http://incubator.apache.org/jena/documentation/tdb/assembler.html
> also looked here
> http://tw.rpi.edu/portal/Configuring_Joseki_%2B_Pellet_%2B_TDB#2._Install.2Fconfigure_TDB
>
> Well, joseki returns no result when I use the joseki sparql interface,
> although via tdbquery, I do get the desired result sets.
>
> Just how do I configure joseki right to handle the quads?
>
> I'll feel happy for any hint in the right direction
> sincerly Peter
>
> ...here is an extract from my joseki-config.ttl
> ------schnipp------
> [] ja:loadClass "com.hp.hpl.jena.tdb.TDB"      . ## Initialize TDB.
> tdb:DatasetTDB  rdfs:subClassOf  ja:RDFDataset .
> tdb:GraphTDB    rdfs:subClassOf  ja:Model      .
>
> <#cns-dataset>
>     a ja:RDFDataset;
>     ja:defaultGraph [
>        a ja:InfModel;
>        		a:baseModel [
>           	a tdb:GraphTDB;
>           	tdb:location "/home/pjungen/store/cns-dataset" ;
>         			];
>     		];
> .
>
> ------schnapp------

Is the location correct?

This will make the default graph of the TDB quad store available to the 
inference engine.  Any named graph will not be visible.

Is that what you intended? (where do the "quads" fit in the picture?)

	Andy

load quad dump; tdb+joseki

Posted by Peter Jungen <el...@gmx.de>.
Hello there,

I need some advice..

well, I loaded a quad dump from a triple store, into TDB (as the dump
consists of multiple files, I wrote a bash loaderscript for that).

So far, so good. I can queue the data via commandline, using tdbquery.

..Still, I'm having problems hooking it up to the joseki SPARQL endpoint.

I followed the instructions here
http://incubator.apache.org/jena/documentation/tdb/assembler.html
also looked here
http://tw.rpi.edu/portal/Configuring_Joseki_%2B_Pellet_%2B_TDB#2._Install.2Fconfigure_TDB

Well, joseki returns no result when I use the joseki sparql interface,
although via tdbquery, I do get the desired result sets.

Just how do I configure joseki right to handle the quads?

I'll feel happy for any hint in the right direction
sincerly Peter

...here is an extract from my joseki-config.ttl
------schnipp------
[] ja:loadClass "com.hp.hpl.jena.tdb.TDB"      . ## Initialize TDB.
tdb:DatasetTDB  rdfs:subClassOf  ja:RDFDataset .
tdb:GraphTDB    rdfs:subClassOf  ja:Model      .

<#cns-dataset>
   a ja:RDFDataset;
   ja:defaultGraph [
      a ja:InfModel;
      		a:baseModel [
         	a tdb:GraphTDB;
         	tdb:location "/home/pjungen/store/cns-dataset" ;
       			];
   		];
.

------schnapp------

Re: A little reification confusion

Posted by Benson Margulies <bi...@gmail.com>.
Oh, never mind. The problem was that the URI for the reification wasn't unique.

On Sun, Jan 8, 2012 at 11:30 AM, Benson Margulies <bi...@gmail.com> wrote:
> A little snippet of code follows. I'm getting an
> 'AlreadyReifiedException' for a statement that returned false for
> 'model.contains'. This doesn't strike me as plausible. I'm running
> 2.6.4, I'll update now and see if things improve.
>
>
>
>            Statement stmt = null;
>            if (rel.getLiteral() != null) {
>                stmt = model.createStatement(subResource, relProp,
> model.createLiteral(rel.getLiteral()));
>            } else {
>                objResource =
> mentionToCrossdocMap.get(rel.getObjectEntityOrdinal());
>                stmt = model.createStatement(subResource, relProp,
> objResource);
>            }
>            ReifiedStatement rstmt = null;
>            if (model.contains(stmt)) {
>                RSIterator reit = model.listReifiedStatements(stmt);
>                rstmt = reit.nextRS();
>            } else {
>                model.add(stmt);
>                String reUrl = RdfUtils.relationshipUri(docId, ordinal);
>                rstmt = model.createReifiedStatement(reUrl, stmt);
>            }