Hi Andy, All,

As discussed offline.

Yes, this surfaces because my code has a bug too.

Fixed in.
https://github.com/JervenBolleman/pftools3/commit/db26152e5acdc346ccf6d81cd8c63ade62a2c1d9

So that makes it a non urgent bug.

Regards,
Jerven


On 2019-10-23 17:57, Andy Seaborne wrote:
Hi Jerven,

I can only recreate this if the data has:

PREFIX  rdf:  <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX  rdf:  <http://www.w3.org/1999/02/22-rdf-syntax-ns>

i.e. same prefix, two settings, different URiIs
and it is TDB2 specific.

In the stacktrace:
java.lang.IllegalStateException: Duplicate key rdf (attempted merging
values http://www.w3.org/1999/02/22-rdf-syntax-ns# and
http://www.w3.org/1999/02/22-rdf-syntax-ns)

the URIs are different by a #.

When run from the command line it shows as a warning and the query
does execute albeit results without prefixes.

WARN  Exception in insertPrefixes: Duplicate key ex (attempted merging
values http://example/ns1# and http://example/ns2/)

Is that what you see?

Recorded as:
https://issues.apache.org/jira/browse/JENA-1773

    Andy

On 23/10/2019 15:42, Jerven Bolleman wrote:
Hi All,

I have a set of queries and I keep on getting this kind of stacktrace with fuseki 3.13.1.

java.lang.IllegalStateException: Duplicate key rdf (attempted merging values http://www.w3.org/1999/02/22-rdf-syntax-ns# and http://www.w3.org/1999/02/22-rdf-syntax-ns)         at java.base/java.util.stream.Collectors.duplicateKeyException(Collectors.java:133)         at java.base/java.util.stream.Collectors.lambda$uniqKeysMapAccumulator$1(Collectors.java:180)         at java.base/java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169)         at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133)         at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)         at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)         at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)         at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)         at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)         at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)         at org.apache.jena.dboe.storage.prefixes.PrefixMapBase.getMappingCopy(PrefixMapBase.java:44)         at org.apache.jena.dboe.storage.prefixes.PrefixMappingOverPrefixMapI.getNsPrefixMap(PrefixMappingOverPrefixMapI.java:97)         at org.apache.jena.rdf.model.impl.ModelCom.getNsPrefixMap(ModelCom.java:1083)         at org.apache.jena.shared.impl.PrefixMappingImpl.setNsPrefixes(PrefixMappingImpl.java:138)         at org.apache.jena.rdf.model.impl.ModelCom.setNsPrefixes(ModelCom.java:1055)         at org.apache.jena.sparql.engine.QueryExecutionBase.insertPrefixesInto(QueryExecutionBase.java:611)         at org.apache.jena.sparql.engine.QueryExecutionBase.insertPrefixesInto(QueryExecutionBase.java:624)         at org.apache.jena.sparql.engine.QueryExecutionBase.execConstructDataset(QueryExecutionBase.java:272)         at org.apache.jena.sparql.engine.QueryExecutionBase.execConstructDataset(QueryExecutionBase.java:264) one of the construct queries triggering this

PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>PREFIX uniprot:<http://purl.uniprot.org/uniprot/>PREFIX sequence:<http://purl.uniprot.org/sequences/>PREFIX unirule:<http://purl.uniprot.org/unirules/>PREFIX taxon:<http://purl.uniprot.org/taxonomy/>PREFIX GO:<http://purl.obolibrary.org/obo/GO_>PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>PREFIX up:<http://purl.uniprot.org/core/>PREFIX faldo:<http://biohackathon.org/resource/faldo#>PREFIX edam:<http://edamontology.org/>PREFIX keyword:<http://purl.uniprot.org/keywords/>PREFIX owl:<http://www.w3.org/2002/07/owl#>PREFIX skos:<http://www.w3.org/2004/02/skos/core#>PREFIX proteome:<http://purl.uniprot.org/proteomes/>PREFIX signature:<http://purl.uniprot.org/hamap/>PREFIX chebi:<http://purl.obolibrary.org/obo/CHEBI_>PREFIX eco:<http://purl.obolibrary.org/obo/ECO_>PREFIX annotation:<http://purl.uniprot.org/annotation/>PREFIX isoform:<http://purl.uniprot.org/isoforms/>PREFIX xsd:<http://www.w3.org/2001/XMLSchema#>CONSTRUCT { _:167 up:source unirule:MF_00001 ._:168 up:source unirule:MF_00001 ._:169 up:source unirule:MF_00001 ._:170 up:source unirule:MF_00001 ._:171 up:source unirule:MF_00001 ._:172 up:source unirule:MF_00001 ._:173 up:source unirule:MF_00001 ._:174 up:source unirule:MF_00001 ._:175 up:source unirule:MF_00001 ._:176 up:source unirule:MF_00001 .?this up:alternativeName ?h1 ; up:annotation ?j3 , ?l5 , ?m6 ; up:classifiedWith GO:0004070 , GO:0006221 , keyword:665 , keyword:808 ; up:recommendedName ?g0 .?g0 up:ecName '2.1.3.2' ; up:fullName 'Aspartate carbamoyltransferase' ; rdf:type up:Structured_Name .?h1 up:fullName 'Aspartate transcarbamylase' ; up:shortName 'ATCase' ; rdf:type up:Structured_Name .?i2 skos:prefLabel 'pyrB' .?j3 up:activity ?k4 ; rdf:type up:Catalytic_Activity_Annotation .?k4 up:catalyticActivity <http://rdf.rhea-db.org/20013>; up:enzymeClass <http://purl.uniprot.org/enzyme/2.1.3.2>.?l5 a up:Pathway_Annotation ; rdfs:comment 'Pyrimidine metabolism; UMP biosynthesis via de novo pathway; (S)-dihydroorotate from bicarbonate: step 2/3.' .?m6 a up:Similarity_Annotation ; rdfs:comment 'Belongs to the ATCase/OTCase family.' . _:177 a rdf:Statement ; up:attribution _:167 ; rdf:subject ?this ; rdf:predicate up:recommendedName ; rdf:object ?g0 . _:178 a rdf:Statement ; up:attribution _:168 ; rdf:subject ?this ; rdf:predicate up:alternativeName ; rdf:object ?h1 . _:179 a rdf:Statement ; up:attribution _:169 ; rdf:subject ?i2 ; rdf:predicate up:encodedBy ; rdf:object ?i2 . _:180 a rdf:Statement ; up:attribution _:170 ; rdf:subject ?this ; rdf:predicate up:annotation ; rdf:object ?j3 . _:181 a rdf:Statement ; up:attribution _:171 ; rdf:subject ?this ; rdf:predicate up:annotation ; rdf:object ?l5 . _:182 a rdf:Statement ; up:attribution _:172 ; rdf:subject ?this ; rdf:predicate up:annotation ; rdf:object ?m6 . _:183 a rdf:Statement ; up:attribution _:173 ; rdf:subject ?this ; rdf:predicate up:classifiedWith ; rdf:object keyword:665 . _:184 a rdf:Statement ; up:attribution _:174 ; rdf:subject ?this ; rdf:predicate up:classifiedWith ; rdf:object keyword:808 . _:185 a rdf:Statement ; up:attribution _:175 ; rdf:subject ?this ; rdf:predicate up:classifiedWith ; rdf:object GO:0004070 . _:186 a rdf:Statement ; up:attribution _:176 ; rdf:subject ?this ; rdf:predicate up:classifiedWith ; rdf:object GO:0006221 . } WHERE { VALUES ?v88 {taxon:2 taxon:2157} ?this up:organism ?thisOrganism ; rdfs:seeAlso signature:MF_00001 .?thisOrganism rdfs:subClassOf+ ?v88 . BIND(URI(CONCAT(STR(?this), '#MF_00001a0')) AS ?g0) .BIND(URI(CONCAT(STR(?this), '#MF_00001a1')) AS ?h1) .BIND(URI(CONCAT(STR(?this), '#MF_00001a3')) AS ?j3) .BIND(URI(CONCAT(STR(?this), '#MF_00001a5')) AS ?l5) .BIND(URI(CONCAT(STR(?this), '#MF_00001a6')) AS ?m6) .OPTIONAL { ?this a up:Protein . ?this up:organism ?thisOrganism .?thisOrganism rdfs:subClassOf+ taxon:2157 . BIND(?this AS ?n7) .} }


What is the silly thing that I am doing wrong?
Explicitly binding the rdf prefix again should be ok right?

Regards,
Jerven

--
Jerven Tjalling Bolleman
SIB | Swiss Institute of Bioinformatics
CMU - 1, rue Michel Servet - 1211 Geneva 4
t: +41 22 379 58 85 - f: +41 22 379 58 58
[email protected] - http://www.sib.swiss

Reply via email to