简体   繁体   中英

SPARQL same values in different rows

Lets assume I have a list of items and one item is depend on one category and other item depend on that same category.

In summary i1 depends on c1, i2 depends on c1.

I want to see all the i1, i2 and c1 rows, this statement:

PREFIX shop: <someurl>
SELECT  ?i1_name ?i2_name ?c_name
{
?i1 shop:depends ?c.
?i2 shop:depends ?c.
?i1 shop:name ?i1_name.
?i2 shop:name ?i2_name.
?c shop:cat_name ?c_name
FILTER(?i1 != ?i2)
}

Returns

i1_name, i2_name, c_name
i2_name, i1_name, c_name

What I want to see is just one line. How can I achive this?

Thanks. Kind Regards

Not sure, but maybe you should replace

FILTER(?i1 != ?i2)

by

   FILTER(?i1 < ?i2)

See what happens.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM