Reputation: 33
I have two local knowledge graphs in the form of turtle files.
Let's say they look something like: File1 - people.ttl
Bob a person ;
feeds cat-1 ;
trains dog-1 ;
owns house-1 .
File 2 - houses.ttl
house-1 a house ;
worth "$500k" ;
has_address "123 Road Dr." .
if I load these into rdflib as pplGraph
and hsGraph
:
from rdflib import Graph
pplGraph = Graph().parse('people.ttl')
hsGraph = Graph().parse('houses.ttl')
is there a way to do a federated query between them? Say I want to know the cost of every person's house, how would I write that query?
I know I could do something like:
for s,p,o in hsGraph.triples((None, None, None)):
pplGraph.add((s,p,o))
and then do a non-federated query, but is it possible to keep the two separate and just use the query method?
Upvotes: 2
Views: 50
Reputation: 1251
Use RDFLib's Dataset
class as suggested by UninformedUser.
(answer submitted here after real answer in comments just to tick over SO's question/answer metrics)
Upvotes: 0