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 > -- Robert Trevor Hall Phone: (315) 719-5039
