Rob,

>> model.createTypedLiteral(new Long(ii)));

That puts in a typed literal as xsd:long, because xsd:long reflects all the range limitations of a Java Long.

Try putting in a xsd:integer with:

m.createTypedLiteral("0", XSDDatatype.XSDinteger) ;

because it looks like inference is inferring this value from the derived datatype xsd:long.

Once the data to query has two ways (two RDF terms) to write one value, it's hard to write a query to do value-based equality without post-processing the results.

        Andy

PS This would not happen with TDB - it stores the integer value, and looses the xsd:long/xsd:integer distinction.




On 13/07/12 18:10, Rob Hall wrote:
Update: I found that a small change is making the difference. It seems that
the combination of* *axioms within my model and the language spec used when
creating it are causing the duplication to occur. The following list
denotes the base spec that I used when creating my reasoner; whether or not
my model imported my axioms; and finally, whether the test (that no
'duplicate' rows existed) passed.


    1. OntModelSpec.OWL_DL_MEM & Empty Model - Passed
    2. OntModelSpec.OWL_DL_MEM & Allowed Imports - Failed
    3. OntModelSpec.OWL_MEM & Empty Model - Passed
    4. OntModelSpec.OWL_MEM & Allowed Imports - Passed


On Fri, Jul 13, 2012 at 10:50 AM, Rob Hall <[email protected]> wrote:


Hey,

    I have an OntModel with an attached pellet reasoner that I am querying
with ARQ. It contains typed literals (for example, *"0"^^<
http://www.w3.org/2001/XMLSchema#long>*) which I've added directly using
the typed literal api as follows:

*model.add(individual, Vocabulary.atIndex, model.createTypedLiteral(new
Long(ii)));*
*
*
Where atIndex is a data property that relates individuals to to an
indexing value. When I run a SPARQL query to retrieve this data, I get
multiple rows for each individual value like such:


---------------------------------------------------------------------------------------------------------------
| index                                        | inv
                                 |
================================================================
| 0                                              | example:inv-0
                             |
| "0"^^xsd:long                             | example:inv-0
                         |
================================================================

When I then view any serialization of this dataset, I see exactly one
relation between the individual and the value (with a different datatype).
(N-TRIPPLE example below).

*<http://example/ont#inv-0> <http://example/ont#atIndex> "0"^^<
http://www.w3.org/2001/XMLSchema#integer> .*
*
*
I've attempted to modify the query provided below in several ways but I've
yet to find a successful way to retrieve one distinct row. Adding DISTINCT
or GROUP BY clauses do nothing as jena treats them as distinct nodes (which
it makes sense that it does). I've attempted filter queries to limit
results using xpath string comparison operations to no avail.

PREFIX fn: <http://www.w3.org/2005/xpath-functions#>
PREFIX vocab: <http://example/ont#>
SELECT ?index ?inv
WHERE {
?inv vocab:atIndex ?index .
} ORDER BY ?index






Reply via email to