How to create advanced queries with a series of AND/OR's with semantic mediawiki?
Asked Answered
M

2

7

How would one create a query like this the following?

get a list of persons where the hair color is brown or black and eye color is blue or green.

The reason i'm asking this is because i'm unsure of how precedence is handled in these queries.

For example if i wrote:

#ask: [[Category:Person]] 
      [[Hair color::brown]] OR [[Hair color::black]] 
      [[Eye color::blue]] OR [[Eye color::green]]

Would smw group the logic as: ( ( hair = brown or black ) and ( eyes = blue or green ) )

or

would the logic be grouped as: ( hair = brown or ( hair=black and eyes=blue ) or eyes = green )

From my initial tests it seems that the latter seems to be the case which seems to make it impossible to create the query i'm after.

Is this feature lacking in smw?

Mascot answered 14/10, 2013 at 7:51 Comment(0)
M
3

Think i just found the answer: the query should be written as such:

  #ask: [[Category:Person]] 
  [[Hair color::brown||black]]
  [[Eye color::blue||green]]

This will give me the correct presecende so logic would get grouped as: ( ( hair = brown or black ) and ( eyes = blue or green ) )

Mascot answered 14/10, 2013 at 9:49 Comment(0)
Q
0

I assume you cant do it. Here login will be:

Category:Person and ( hair = brown or hair:black or eye: blue or eye: green )

Quantic answered 14/10, 2013 at 8:16 Comment(1)
the fact that this feature isn't implemented is a a big shock to me. Something as basic as presendence handling should be implemented....Mascot

© 2022 - 2024 — McMap. All rights reserved.