3 ms·
Can you express graph attributes such as edge weight in RDF? I am familiar with RDF triples such as "Book", author, "Jane Doe". How would you express "10 minut
by pbourke 5y ago
Can you express graph attributes such as edge weight in RDF?
I am familiar with RDF triples such as "Book", author, "Jane Doe". How would you express "10 minute phone call at time t between persons A and B"?
- zomglings 5y agoYou could do it, but a triple wouldn't be the best choice of data structure. I would just add a new numerical column called "weight" to each relation in your RDF store: "Harry Potter and the Philosopher's Stone","author","Jane Doe",0.005 "Harry Potter and the Philosopher's Stone","author","J.K. Rowling",1.0 ... You could easily export RDF triples from this if you needed to using rules like "The author for each book is determined by the '<book>-author-<name>' relation of highest weight". Edit: Sorry I didn't answer your question about "10 minute phone call at time t between person A and person B". The best way I can think of to model this with triples is: "call:<call_id>","started_at",t "call:<call_id>","ended_at",t + <duration> "person A","participant","call:<call_id>" "person B","participant","call:<call_id>" But this may be overly complicated depending on how you want to query the data and what you want to do with it. Edit 2: mhitza already answered it better! https://news.ycombinator.com/item?id=28503097 https://news.ycombinator.com/item?id=28503097
- mhitza 5y agoNot previous commenter, but as with other problems in computing, I find that you need to add a level of indirection. "CallSessionX" -> participant -> "person A" "CallSessionX" -> participant -> "person B" "CallSessionX" -> duration -> "10 minute" "CallSessionX" -> at_time -> t Haven't used Sparql or Cypher in many years (used in Neo4j), but with the later you could do a query along the lines "person A" <- participant <- call_session -> participant -> "person B" To find calls between person A and person B, then you can add a variable binding on the exact node you're interested in (eg call_session) to extract/aggregate attributes.