You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Petr Křemen <pe...@gmail.com> on 2012/03/11 10:05:20 UTC
SDB load prefixes
Hi to all,
I have a single store and two named models opened on top of it, say
model1 and model2. When reading data using
model1.read(...,BASE1)
model2.read(...,BASE2)
the second command fails with
ERROR: duplicate key value violates unique constraint "prefixes_pk"
INSERT INTO Prefixes
VALUES (':', NSOFTHESECOND)
I understand, that a single prefix should not be set to different
mapping within a single SDB store.
My question is - is there a possibility to throw away all prefix
information from the RDF/XMLs and to load the documents with no (or
artifically generated) prefixes, such that the above error disappears
?
Thanks,
Petr
SDB load prefixes
Posted by Petr Křemen <pe...@gmail.com>.
Hi to all,
I have a single store and two named models opened on top of it, say
model1 and model2. When reading data using
model1.read(...,BASE1)
model2.read(...,BASE2)
the second command fails with
ERROR: duplicate key value violates unique constraint "prefixes_pk"
INSERT INTO Prefixes
VALUES (':', NSOFTHESECOND)
I understand, that a single prefix should not be set to different
mapping within a single SDB store.
My question is - is there a possibility to throw away all prefix
information from the RDF/XMLs and to load the documents with no (or
artifically generated) prefixes, such that the above error disappears
?
Thanks,
Petr
--
Petr Křemen
Petr.Kremen@gmail.com
Re: SDB load prefixes
Posted by Petr Křemen <pe...@gmail.com>.
Hi Andy,
thanks for your answer.
> Which version of SDB and which database are you using? (It looks like
> posgresql) What would be helpful is a complete, minimal example, especially
> if it works on one of the embedded DBs like H2 or Derby.
SDB maven artifact ver.1.3.4, PostgreSQL DB.
Regarding per-graph (TDB) and overall (SDB) prefixes storing, it is
indeed a bit strange - although TDB and SDB are "just 2 different
backends", the semantics of model.read are so different in each case.
In my view, per-graph prefix storing for SDB would definitely be less
confusing.
> The prefixes are being set because you are parsing directly into database
> backed models. If you read into a memory model then add that , the prefixes
> aren't copied over.
>
> Model m = FileManager.get().read(..)
> model1.add(m) ;
> m = FileManager.get().read(..)
> model2.add(m) ;
>
This works like a charm for me. Thanks for your help
Petr
Re: SDB load prefixes
Posted by Andy Seaborne <an...@apache.org>.
On 11/03/12 09:05, Petr Křemen wrote:
> Hi to all,
Hi Petr,
Which version of SDB and which database are you using? (It looks like
posgresql) What would be helpful is a complete, minimal example,
especially if it works on one of the embedded DBs like H2 or Derby.
Unlike TDB, SDB stores prefixes on a dataset basis, not a per-graph
basis. Changing this would need a change to the on-disk formats so
while it is desirable to do, it's also not insignificant.
> I have a single store and two named models opened on top of it, say
> model1 and model2. When reading data using
>
> model1.read(...,BASE1)
> model2.read(...,BASE2)
>
> the second command fails with
>
> ERROR: duplicate key value violates unique constraint "prefixes_pk"
> INSERT INTO Prefixes
> VALUES (':', NSOFTHESECOND)
>
> I understand, that a single prefix should not be set to different
> mapping within a single SDB store.
>
> My question is - is there a possibility to throw away all prefix
> information from the RDF/XMLs and to load the documents with no (or
> artifically generated) prefixes, such that the above error disappears
The prefixes are being set because you are parsing directly into
database backed models. If you read into a memory model then add that ,
the prefixes aren't copied over.
Model m = FileManager.get().read(..)
model1.add(m) ;
m = FileManager.get().read(..)
model2.add(m) ;
As a bonus, if there is a problem due to some data error, you only add
data to the database if it was completely readable.
Andy
> ?
>
> Thanks,
> Petr