I have two tables that I have to merge and I'm not too sure how to go about doing so.
Both tables keep a list of teachers and their teaching subjects. Each has a predicate along the lines of school:teaches
and college:instructs
, which mean the same thing. My task is to merge the schools together but as far as I am familiar with SPARQL I don't know how to do so?
So far I have
SELECT ?teacher
WHERE {
?teacher school:teaches|college:instructs :courses
}
There is not enough information about your data, but assuming :teaches
and :instructs
are only used to link teachers with courses, you'll need:
SELECT ?teacher
WHERE {
?teacher school:teaches|college:instructs ?courses .
}
Assuming :courses
is the class of courses, and all objects of the triples you want to belong to that class, then you'll need to add this patters as well:
SELECT ?teacher
WHERE {
?teacher school:teaches|college:instructs ?courses .
?courses a :courses .
}