質問

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?

役に立ちましたか?

解決

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 ) )

他のヒント

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

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

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top