unor
unor

Reputation: 96607

Excluding certain property values in inline query

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.

Upvotes: 3

Views: 300

Answers (1)

user1258361
user1258361

Reputation: 1133

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.

Upvotes: 2

Related Questions