Fix query for core:relatedRole so it gets core:Role individuals not assigned to a subclass

This commit is contained in:
rjy7 2011-01-25 19:17:10 +00:00
parent 6abdc3a78e
commit 08ff4fa013

View file

@ -14,22 +14,29 @@
?indivInRole ?indivName ?indivInRole ?indivName
?dateTimeInterval ?dateTimeStart ?dateTimeEnd WHERE { ?dateTimeInterval ?dateTimeStart ?dateTimeEnd WHERE {
GRAPH ?g1 { ?subject ?property ?role } GRAPH ?g1 { ?subject ?property ?role }
GRAPH ?g2 { ?role a ?subclass }
GRAPH ?g3 { ?subclass rdfs:subClassOf core:Role } # ?role is either a core:Role or one of its subclasses
{
{ GRAPH ?g2 { ?role a ?subclass } }
{ GRAPH ?g3 { ?subclass rdfs:subClassOf core:Role } }
UNION
{ GRAPH ?g4 { ?role a core:Role } }
}
# Works because we don't do inferencing on subproperties, so the only ?roleProp # Works because we don't do inferencing on subproperties, so the only ?roleProp
# returned will be the asserted one. # returned will be the asserted one.
OPTIONAL { GRAPH ?g4 { ?roleProp rdfs:subPropertyOf core:roleOf } OPTIONAL { GRAPH ?g5 { ?roleProp rdfs:subPropertyOf core:roleOf }
GRAPH ?g5 { ?role ?roleProp ?indivInRole } GRAPH ?g6 { ?role ?roleProp ?indivInRole }
GRAPH ?g6 { ?indivInRole rdfs:label ?indivName } GRAPH ?g7 { ?indivInRole rdfs:label ?indivName }
} }
OPTIONAL { GRAPH ?g7 { ?role rdfs:label ?roleLabel } } OPTIONAL { GRAPH ?g8 { ?role rdfs:label ?roleLabel } }
OPTIONAL { GRAPH ?g8 { ?subclass rdfs:label ?roleTypeLabel } } OPTIONAL { GRAPH ?g9 { ?subclass rdfs:label ?roleTypeLabel } }
OPTIONAL { GRAPH ?g9 { ?role core:dateTimeInterval ?dateTimeInterval } OPTIONAL { GRAPH ?g10 { ?role core:dateTimeInterval ?dateTimeInterval }
OPTIONAL { GRAPH ?g10 { ?dateTimeInterval core:start ?dateTimeStartValue } OPTIONAL { GRAPH ?g11 { ?dateTimeInterval core:start ?dateTimeStartValue }
GRAPH ?g11 { ?dateTimeStartValue core:dateTime ?dateTimeStart } GRAPH ?g12 { ?dateTimeStartValue core:dateTime ?dateTimeStart }
} }
OPTIONAL { GRAPH ?g12 { ?dateTimeInterval core:end ?dateTimeEndValue } OPTIONAL { GRAPH ?g13 { ?dateTimeInterval core:end ?dateTimeEndValue }
GRAPH ?g13 { ?dateTimeEndValue core:dateTime ?dateTimeEnd } GRAPH ?g14 { ?dateTimeEndValue core:dateTime ?dateTimeEnd }
} }
} }
FILTER ( FILTER (
@ -50,23 +57,30 @@
?roleLabel ?roleTypeLabel ?roleLabel ?roleTypeLabel
?indivInRole ?indivName ?indivInRole ?indivName
?dateTimeInterval ?dateTimeStart ?dateTimeEnd WHERE { ?dateTimeInterval ?dateTimeStart ?dateTimeEnd WHERE {
GRAPH ?g1 { ?subject ?property ?role } GRAPH ?g1 { ?subject ?property ?role }
GRAPH ?g2 { ?role a ?subclass }
GRAPH ?g3 { ?subclass rdfs:subClassOf core:Role } # ?role is either a core:Role or one of its subclasses
{
{ GRAPH ?g2 { ?role a ?subclass } }
{ GRAPH ?g3 { ?subclass rdfs:subClassOf core:Role } }
UNION
{ GRAPH ?g4 { ?role a core:Role } }
}
# Works because we don't do inferencing on subproperties, so the only ?roleProp # Works because we don't do inferencing on subproperties, so the only ?roleProp
# returned will be the asserted one. # returned will be the asserted one.
OPTIONAL { GRAPH ?g4 { ?roleProp rdfs:subPropertyOf core:roleOf } OPTIONAL { GRAPH ?g5 { ?roleProp rdfs:subPropertyOf core:roleOf }
GRAPH ?g5 { ?role ?roleProp ?indivInRole } GRAPH ?g6 { ?role ?roleProp ?indivInRole }
GRAPH ?g6 { ?indivInRole rdfs:label ?indivName } GRAPH ?g7 { ?indivInRole rdfs:label ?indivName }
} }
OPTIONAL { GRAPH ?g7 { ?role rdfs:label ?roleLabel } } OPTIONAL { GRAPH ?g8 { ?role rdfs:label ?roleLabel } }
OPTIONAL { GRAPH ?g8 { ?subclass rdfs:label ?roleTypeLabel } } OPTIONAL { GRAPH ?g9 { ?subclass rdfs:label ?roleTypeLabel } }
OPTIONAL { GRAPH ?g9 { ?role core:dateTimeInterval ?dateTimeInterval } OPTIONAL { GRAPH ?g10 { ?role core:dateTimeInterval ?dateTimeInterval }
OPTIONAL { GRAPH ?g10 { ?dateTimeInterval core:start ?dateTimeStartValue } OPTIONAL { GRAPH ?g11 { ?dateTimeInterval core:start ?dateTimeStartValue }
GRAPH ?g11 { ?dateTimeStartValue core:dateTime ?dateTimeStart } GRAPH ?g12 { ?dateTimeStartValue core:dateTime ?dateTimeStart }
} }
OPTIONAL { GRAPH ?g12 { ?dateTimeInterval core:end ?dateTimeEndValue } OPTIONAL { GRAPH ?g13 { ?dateTimeInterval core:end ?dateTimeEndValue }
GRAPH ?g13 { ?dateTimeEndValue core:dateTime ?dateTimeEnd } GRAPH ?g14 { ?dateTimeEndValue core:dateTime ?dateTimeEnd }
} }
} }
FILTER ( FILTER (