I want to express some many to many relatinships from a database in RDF format. For example user A rated Item B with value C.
How I have to express a many to many relationship in rdf?
I am thinking of using a blank node.
user:1 item:ratting [ _:1 item:id "5";item:ratting-number "10".] In order to express that user 1 rated item 5 with 10. Is there a better way to do that?
The approach you suggest is certainly a good option. Another popular approach is treating the relation as an object, e.g. for your example:
Though in this approach I would personally choose to create a new URI for the rating-object, rather than using a blank node, e.g. 'item:rating1'.
There is a W3C Note that discusses several approaches to modeling n-ary relations in RDF, which might be worth looking into.
answered 22 Feb, 18:17
Jeen Broekstra ♦