3

I use the three values (=pages) A, B, C for the property is of type.

Some pages have exactly one value for is of type, some pages have all three values.

I want to #ask for pages that are of type A without being of type B and C.

I tried the following inline query:

{{#ask: [[Is of type::A]] [[Is of type::!B]] [[Is of type::!C]]}}

But it doesn’t work as intended: it lists all pages that are of type A, including those that are of type B/C in addition.

unor
  • 92,415
  • 26
  • 211
  • 360

1 Answers1

2

Semantic Mediawiki isn't good at subtractive queries. Your query translates in English to:

Find me every page that has all of these: -An instance of property "Is of type" equal to A -An instance of property "Is of type" not equal to B -An instance of property "Is of type" not equal to C

Now here's the "gotcha": Suppose you have a page that "Is of type" A, B, and C. -It is of type A. -It is of a type that isn't B, namely A and C. -It is of a type that isn't C, namely A and B.

It fits all of your conditions, and goes in the result.

I run into these types of problems often. My wiki actually has several templates for subtracting query results.

user1258361
  • 1,133
  • 2
  • 16
  • 25
  • 1
    I see, thank you. Could you show an example for such a "subtraction" template that helps in the example case (A without B/C), or would it be too complex? – unor Feb 14 '15 at 00:35