From: Rob V. <rv...@do...> - 2010-12-16 08:32:12
|
Hi Tomas There is not really any rules support in the 0.3.1 release that can do what you want but it is very straightforward to do with SPARQL queries e.g. PREFIX : <http://example.org/czechRoyals#> SELECT ?grandFather ?grandSon WHERE { ?grandFather :fatherOf ?x . ?x :fatherOf ?grandSon } If you want to generate actual Triples with this data you can either turn the above into a CONSTRUCT query to generate a Graph with the additional data like so: PREFIX : <http://example.org/czechRoyals#> CONSTRUCT { ?grandFather :grandFatherOf ?grandSon . } WHERE { ?grandFather :fatherOf ?x . ?x :fatherOf ?grandSon } Or if you have a Triple Store which supports SPARQL Update (such as the TripleStore class in dotNetRDF) then you can create a SPARQL Update command to add the generated data straight back into the Store e.g. PREFIX : <http://example.org/czechRoyals#> INSERT { ?grandFather :grandFatherOf ?grandSon . } WHERE { ?grandFather :fatherOf ?x . ?x :fatherOf ?grandSon } Hope this helps you get started, please ask if you have further questions/issues. Best Regards, Rob Vesse ---------------------------------------- From: "Tomas Franek" <tom...@se...> Sent: 15 December 2010 16:25 To: rv...@do... Subject: Rulebase I tried your dotnetRDF in my school project and I need help with using rulebase. I have triples that describe Czech kings family sample: Object "Jan Lucembursky" Predicate "FatherOf" Subject "CharlesIV" Object "CharlesIV" Predicate "FatherOf" Subject "Jan" Object "CharlesIV" Predicate "FatherOf" Subject "Vaclav IV" Object "VaclavIV" Predicate "FatherOf" Subject "Marketa" . . . . . I woud like create rule "GrandFatherOf", and make qeury that show all couples grandfather and grandson(granddaughter ) can you help me with this? Tomás Franek |