Hello,

While storing data in TDB, I am creating a named graph per entity and keeping 
all triples related to it into this graph. However, while searching data I am 
finding it difficult to write queries. For example, consider the following data:

<person-1.ttl> {
  <person-1>
    <rdf:type> "person" ;
    <name> "person1" ;
    <like> "sports" .
}

<person-2.ttl> {
  <person-2>
    <rdf:type> "person" ;
    <name> "person2" ;
    <like> "music" .
}

<person-3.ttl> {
  <person-3>
    <rdf:type> "person" ;
    <name> "person3" ;
    <like> "tracking" .
}

<person-4.ttl> {
  <person-4>
    <rdf:type> "person" ;
    <name> "person4" ;
    <like> "sports" .
}

Now, I want to get all person entities. So I used a query 
SELECT * WHERE { GRAPH ?g { ?s <rdf:type> "person"} }

This returns me a list of all graphs (in my Java code). However, I want to get 
the entities. So the option I see is to send again one query for each graph to 
get all the triples and read that person entity from them. 

I have 2 questions here:
1. Is this a good way to store each entity in its own graph? If yes, what can 
the situations where it be useful?
2. In the above case how I can write my sparql to span across all graphs to get 
all the triples from all the graphs? 

Thanks,
JK

Reply via email to