[ https://issues.apache.org/jira/browse/RYA-30?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15095554#comment-15095554 ]
Aaron Mihalik commented on RYA-30: ---------------------------------- Darren: I was able to reproduce your issue. Unfortunately, this is an issue with the OpenRDF Update parser. The issue appears when you have the parser process an update with two literals that have the same values (e.g. '2') but the datatypes are different (e.g. "null" and "int"). The datatypes for the literals are undefined in this case. I put together a test [here|https://github.com/amihalik/incubator-rya/blob/RYA-30/sail/src/test/java/mvm/rya/RdfLiteralTest.java] that demonstrates the issue. Strangely, the unit test exhibits the opposite behavior that you noted. Both literals are marked with datatype {{http://www.w3.org/2001/XMLSchema#integer}} (not {{null}} as you demonstrated). But the rya-example-box demonstrated the same behavior that you saw. Here is the issue with the OpenRDF Parser. Note that the update: {code} insert data { <u:a> <u:p1> '2'^^<http://www.w3.org/2001/XMLSchema#integer> . <u:b> <u:p2> '2' } {code} results in the following OpenRDF {{Update}} object: {code} InsertData Reduced MultiProjection ProjectionElemList ProjectionElem "-const-u:a" AS "subject" ProjectionElem "-const-u:p1" AS "predicate" ProjectionElem "-const-2" AS "object" ProjectionElemList ProjectionElem "-const-u:b" AS "subject" ProjectionElem "-const-u:p2" AS "predicate" ProjectionElem "-const-2" AS "object" Extension ExtensionElem (-const-2) ValueConstant (value="2") ExtensionElem (-const-2) ValueConstant (value="2"^^<http://www.w3.org/2001/XMLSchema#integer>) ExtensionElem (-const-u:p1) ValueConstant (value=u:p1) ExtensionElem (-const-u:a) ValueConstant (value=u:a) ExtensionElem (-const-u:p2) ValueConstant (value=u:p2) ExtensionElem (-const-u:b) ValueConstant (value=u:b) SingletonSet {code} They key here is that the parser is producing two {{-const-2}} elements with values {{value="2"}} and {{value="2"^^<http://www.w3.org/2001/XMLSchema#integer>)}}. It appears that the last {{-const-2}} element defined is applied (in my unit test's case, that is {{value="2"^^<http://www.w3.org/2001/XMLSchema#integer>)}}. In your case (and on rya-example-box), that value is {{value="2"}}. Thanks for noting the issue, and sorry that we can't resolve it at this time. --Aaron > Literal type information lost when inserting a matching literal with a > different type > ------------------------------------------------------------------------------------- > > Key: RYA-30 > URL: https://issues.apache.org/jira/browse/RYA-30 > Project: Rya > Issue Type: Bug > Reporter: Darren Griffith > > I have 2 different SPARQL statements. > > The first inserts a triple where the object is the integer literal "2" and > a triple where the object is the string literal "2". I believe these should > be considered 2 different literals. However, when I query for the triple > with the integer literal "2", it returns a triple with the string literal "2" > (see EXAMPLE 1). > > The second inserts only a triple where the object is the integer literal > "2", which is the same triple inserted by the first statement. When I query > for this triple, it returns the triple with the integer literal "2" (see > EXAMPLE 2). > > I believe that my queries should return the same result in both cases. It > seems the Rya isn't including the type information in the symbol table and > overwriting what should be different literals. > > — EXAMPLE 1 — > > INSERT DATA { > > <http://modusoperandi.com/Archivist/detection#jakarta_001.tif_jakarta_001_000.png> > > <http://modusoperandi.com/Archivist/detection#confidence>"2"^^<http://www.w3.org/2001/XMLSchema#integer> > . > <http://modusoperandi.com/Archivist/provenance#6327df6d-79b8-48cd-a855-c7b4b77e0942> > <http://modusoperandi.com/Archivist/provenance#to> "2". > } > > > SELECT * > WHERE { > ?s <http://modusoperandi.com/Archivist/detection#confidence> ?o . > } > > > <sparql xmlns="http://www.w3.org/2005/sparql-results#"> > <head> > <variable name="s"/> > <variable name="o"/> > </head> > <results> > <result> > <binding name="s"> > <uri> > http://modusoperandi.com/Archivist/detection#jakarta_001.tif_jakarta_001_000.png > </uri> > </binding> > <binding name="o"> > <literal>2</literal> > </binding> > </result> > </results> > </sparql> > > > > — EXAMPLE 2 — > > INSERT DATA { > > <http://modusoperandi.com/Archivist/detection#jakarta_001.tif_jakarta_001_000.png> > > <http://modusoperandi.com/Archivist/detection#confidence>"2"^^<http://www.w3.org/2001/XMLSchema#integer> > . > } > > SELECT * > WHERE { > ?s <http://modusoperandi.com/Archivist/detection#confidence> ?o . > } > > <sparql xmlns="http://www.w3.org/2005/sparql-results#"> > <head> > <variable name="s"/> > <variable name="o"/> > </head> > <results> > <result> > <binding name="s"> > <uri> > http://modusoperandi.com/Archivist/detection#jakarta_001.tif_jakarta_001_000.png > </uri> > </binding> > <binding name="o"> > <literal datatype="http://www.w3.org/2001/XMLSchema#integer">2</literal> > </binding> > </result> > </results> > </sparql> > -- This message was sent by Atlassian JIRA (v6.3.4#6332)