You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Dmitri Pisarenko <dp...@altruix.co> on 2017/03/26 13:41:36 UTC

How to select an entity which has a property with a certain value?

Hello!

I run a query

SELECT ?x WHERE { ?x <http://mycompany.com/data/bp-2/batch/batchNumber> 4 }

Its purpose is to get the indivdual, which has the property http://mycompany.com/data/bp-2/batch/batchNumber being equal to 4.

When I run this query the result is a completely different individual and the condition (batchNumber==4) is not true for it.

What is the correct version of this query (select individual, in which property X is equal to value Y) ?

Thanks in advance

Dmitri Pisarenko

Re: How to select an entity which has a property with a certain value?

Posted by "A. Soroka" <aj...@virginia.edu>.
Please show us sample data and the means by which you are executing the query.

https://stackoverflow.com/help/mcve

---
A. Soroka
The University of Virginia Library

> On Mar 26, 2017, at 9:52 AM, Dmitri Pisarenko <dp...@altruix.co> wrote:
> 
> Hello!
> 
> FYI: Modifying the query to
> 
> SELECT ?x
> WHERE { 
> 	?x <http://mycompany.com/data/bp-2/batch/batchNumber> ?curBatchId .
> 	FILTER (?curBatchId = 4)
> }
> 
> doesn't change anything.
> 
> 
> Best regards
> 
> Dmitri Pisarenko
> 
> 
> 
> 26.03.2017, 16:41, "Dmitri Pisarenko" <dp...@altruix.co>:
>> Hello!
>> 
>> I run a query
>> 
>> SELECT ?x WHERE { ?x <http://mycompany.com/data/bp-2/batch/batchNumber> 4 }
>> 
>> Its purpose is to get the indivdual, which has the property http://mycompany.com/data/bp-2/batch/batchNumber being equal to 4.
>> 
>> When I run this query the result is a completely different individual and the condition (batchNumber==4) is not true for it.
>> 
>> What is the correct version of this query (select individual, in which property X is equal to value Y) ?
>> 
>> Thanks in advance
>> 
>> Dmitri Pisarenko


Re: How to select an entity which has a property with a certain value?

Posted by Dmitri Pisarenko <dp...@altruix.co>.
Hello!

FYI: Modifying the query to

SELECT ?x
WHERE { 
	?x <http://mycompany.com/data/bp-2/batch/batchNumber> ?curBatchId .
	FILTER (?curBatchId = 4)
}

doesn't change anything.


Best regards

Dmitri Pisarenko



26.03.2017, 16:41, "Dmitri Pisarenko" <dp...@altruix.co>:
> Hello!
>
> I run a query
>
> SELECT ?x WHERE { ?x <http://mycompany.com/data/bp-2/batch/batchNumber> 4 }
>
> Its purpose is to get the indivdual, which has the property http://mycompany.com/data/bp-2/batch/batchNumber being equal to 4.
>
> When I run this query the result is a completely different individual and the condition (batchNumber==4) is not true for it.
>
> What is the correct version of this query (select individual, in which property X is equal to value Y) ?
>
> Thanks in advance
>
> Dmitri Pisarenko

Re: How to select an entity which has a property with a certain value?

Posted by "Lorenz B." <bu...@informatik.uni-leipzig.de>.
4 is a shortcut for "4"^^<http://www.w3.org/2001/XMLSchema#integer>

Does this literal really match your data?
The property is correct?
How to you process the resultset returned by the query? There might be
several solutions depending on your dataset, thus, you have to iterate
over the resultset.

As Adam Soroka said, it's easier to help you with seeing sample data and
sample code.



> Hello!
>
> I run a query
>
> SELECT ?x WHERE { ?x <http://mycompany.com/data/bp-2/batch/batchNumber> 4 }
>
> Its purpose is to get the indivdual, which has the property http://mycompany.com/data/bp-2/batch/batchNumber being equal to 4.
>
> When I run this query the result is a completely different individual and the condition (batchNumber==4) is not true for it.
>
> What is the correct version of this query (select individual, in which property X is equal to value Y) ?
>
> Thanks in advance
>
> Dmitri Pisarenko
>
-- 
Lorenz Bhmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center