Let's say I have a triple store full of video metadata. A video can have an arbitrary selection of pre-defined tags, like this:
v1 ex:hasTag A.
v2 ex:hasTag B.
v3 ex:hasTag A;
ex:hasTag B.
So for the sake of this example, there are only the two pre-defined tags A
and B
.
Now I would like to get an overview of which video has which tags attached, in a matrix like this (or similar):
A B
v1 true false
v2 false true
v3 true true
However, I do not know how to achieve this. First of all, I would need a boolean test, e.g. something like isTrue(?video ex:hasTag A)
or whatever it looks like. Even then, I do not know where to put it. If I put the previous statement in the WHERE clause, the query result only contains the videos having the tag A
, of course.
Coming from SQL, I can imagine I need to use subqueries in some way, but these seem not to be standardized at the moment. I also saw the FILTER
keyword, but I don't feel that is what I want.
I'm currently at a loss but always willing to learn. Any help is appreciated.