rdflib
rdflib copied to clipboard
querying multiple ttl files
I have two simple ttl files with following data:
example1.ttl:
ns1:place1 a a owl:NamedIndividual;
ns2:hasAddress address_1 .
example2.ttl:
ns2:address_1 a a owl:NamedIndividual;
ns2:hasproperty1 property1 .
ns2:hasproperty2 property2 .
I uploaded the files with:
g.parse(example1.ttl)
g.parse(example2.ttl)
when I use sparql to get the address of place:
SELECT ?address
WHERE {
ns1:place1 ns2:hasAddress ?address .
}
I get the expected address object
when I ask for all properties of address object:
SELECT ?property ?value
WHERE {
ns2:address_1 ?property ?value .
}
I also get them, but when I ask for the properties of the address of the place:
SELECT ?property ?value
WHERE {
ns1:place1 ns2:hasAddress ?address .
?address ?property ?value .
}
I get a blank result, I wonder what should I be doing wrong?,
Because I was waiting to get all properties of the address.
Best regards
Luis
These are not real examples (prefixes are missing etc.). You should create a Gist with all the files.
Thanks for oyur answer Martynas Jusevičius, at the end I solved the issue removing the name spaces and working directly with full uri.
In your examples:
example1.ttl:
ns1:place1 a a owl:NamedIndividual;
ns2:hasAddress address_1 .
example2.ttl:
ns2:address_1 a a owl:NamedIndividual;
ns2:hasproperty1 property1 .
ns2:hasproperty2 property2 .
The first address_1
in example1.ttl
has no namespace prefix, but the second one ns2:address_1
in example2.ttl
has.
@luisenriqueramos1977 could you close the issue?
@luisenriqueramos1977 what version of RDFLib were you using?