I have an oxigraph store that contains all of my information. At different points in time I construct various subgraphs from that store with the same columns ?s ?p and ?o.
At some point I want to combine any two of these subgraphs. Constructing a new subgraph with them is trivial, but how can I check for missing predicates that are in the main graph?
For example the first subgraph could include a relationship between a mother and daughter in a family. The second subgraph could have a father and son of that same family. These relationships are in the main graph since these are subgraphs, but the main graph could have relationships like the mother and father being spouses or the two children being siblings that I would want to include. Is there a way to go about this in a performant way?
Technical details: I technically create separate stores for each subgraph, but these stores can easily be dumped and loaded into the main store as different graphs, or just be kept in the same store from the beginning.
I've created a simple query like this:
CONSTRUCT {
?s ?p ?o .
} WHERE {
{
GRAPH <subgraph1IRI> {
?s ?p ?o .
}
}
UNION
{
GRAPH <subgraph2IRI> {
?s ?p ?o .
}
}
}
But that's just merging. I've looked into FILTER, but what exactly the query is doing quickly gets confusing with my inexperience, especially wrapping my head around reversing every check to account for flipped subjects and objects.