From: Graeme S. <ac...@gm...> - 2011-02-09 22:17:25
|
On 9 February 2011 21:44, Marcus Cobden <li...@ma...> wrote: > One of the things I wanted was for the inferred triples to be placed in > different graphs, depending on which graphs the antecedents came from. Would > that be possible? > > Yes, this is straightforward. As an example, here's the Jess version of the RDFS rule for inferring the type of a resource from a property domain: ;;; prp-dom: infer resource type from property domain (defrule prp-dom (declare (salience 100)) (logan-quad (graph ?g) (subject ?p) (predicate "http://www.w3.org/2000/01/rdf-schema#domain") (object ?t) ) (logan-quad (graph ?h) (subject ?s) (predicate ?p) (object ?o) ) => (assert (logan-quad (graph "urn://inferred") (subject ?s) (predicate "http://www.w3.org/1999/02/22-rdf-syntax-ns#type") (object ?t) ) ) ) While in this instance the consequent asserts the entailed triple in the "urn://inferred" graph, you can easily set this to be ?g, ?h (the graphs in the anticedents), or define a function that selects somewhere else for it to go. > > Btw: I spent an hour or so today adding generics to all the NG4J classes, > if you're working with NG4J it might make things a bit easier ;) I'll be > posting the diff tomorrow. > > Sounds useful! Cheers, Graeme. |