From: <jm...@us...> - 2010-03-24 23:08:45
|
Revision: 1355 http://eulergui.svn.sourceforge.net/eulergui/?rev=1355&view=rev Author: jmvanel Date: 2010-03-24 23:08:35 +0000 (Wed, 24 Mar 2010) Log Message: ----------- swrl-n3-rules.n3 : recover the fully substituted triple from the initial non substituted triple and the substitution list; apply the design pattern "add an item in the list that will be kept unchanged during recursion." Modified Paths: -------------- trunk/eulergui/examples/swrl-n3-rules.n3 Modified: trunk/eulergui/examples/swrl-n3-rules.n3 =================================================================== --- trunk/eulergui/examples/swrl-n3-rules.n3 2010-03-24 19:33:16 UTC (rev 1354) +++ trunk/eulergui/examples/swrl-n3-rules.n3 2010-03-24 23:08:35 UTC (rev 1355) @@ -141,7 +141,7 @@ ######## variable substitution ######### -# variable substitution of ?V by ?VT in a triple ?T == {?S ?P ?O} +#** variable substitution of ?V by ?VT in a triple ?T == {?S ?P ?O} { {?V ?P ?O} :substituteVariable (?V ?VT). } => { # the subject is substituted ( {?V ?P ?O} (?V ?VT) ) :variableSubstitution {?VT ?P ?O} @@ -151,11 +151,13 @@ ( {?S ?P ?V} (?V ?VT) ) :variableSubstitution {?S ?P ?VT} }. -#** What: :substituteVariableList - substitution of a list of variable substitutions ?L in a triple +#** substitution of a list of variable substitutions ?L in a statement +# Antecedent: :substituteVariableList # @subject an RDF statement # @object list of variable substitutions, e.g. ( (:x ?X)(:y ?Y) ) +#** Consequent: :substituteVariableList - substitution of a list of variable substitutions ?L in a triple { - ?STAT :substituteVariableList ?L . + (?STAT ?INVARIANT) :substituteVariableList ?L . ?STAT log:includes {?S ?P ?O} . ?L a rdf:List . ?L rdf:first (?V ?VT) . @@ -165,7 +167,7 @@ }. { - ?STAT :substituteVariableList ?L . + (?STAT ?INVARIANT) :substituteVariableList ?L . ?STAT log:includes {?S ?P ?O} . ?L a rdf:List . ?L rdf:rest ?REST . @@ -178,13 +180,44 @@ # :variableSubstitution {?SS ?P ?OS} ). } => { ?REST a rdf:List . - {?SS ?P ?OS} :substituteVariableList ?REST . + ({?SS ?P ?OS} ?INVARIANT) :substituteVariableList ?REST . }. -# test -{:x :sibling :y} :substituteVariableList +#** recover the fully substituted triple from the initial non substituted triple ?STAT and the substitution list ?L +{ + ( ?STAT (?STAT ?L) # INVARIANT + ) :substituteVariableList ?L . + _:d e:trace ("trace substitutedTriple" ?STAT ?L ). + _:d e:findall ( ?STAT_ + {(?STAT_ (?STAT ?L) ) :substituteVariableList ()} ?TSUBST ). +} => { + (?STAT ?L) :substitutedTriple ?TSUBST. +}. + +# substitution of triples in a formula ?F - WIP +{ ?F :substituteVariablesInFormula ?L . + ?F log:includes {?S ?P ?O} . +} => { + ({?S ?P ?O} ?INVARIANT) :substituteVariableList ?L . +}. + +# substitution of triples in a pair of formulas (?A ?C) . TODO + + +# test substituteVariableList +( {:x :sibling :y} + ( {:x :sibling :y} ( (:x ?X)(:y ?Y) ) ) +) :substituteVariableList ( (:x ?X)(:y ?Y) ) . ( (:x ?X)(:y ?Y) ) a rdf:List . +# {:x :sibling :y. :x :hates :y.} :substituteVariablesInFormula +# ( (:x ?X)(:y ?Y) ) . +# ( (:x ?X)(:y ?Y) ) a rdf:List . +# { ?LC :substituteVariable ?L . } => { _:dd :print (?LC :substituteVariable ?L) . }. +# { ?LC :variableSubstitution ?L . } => { _:dd :print (?LC :variableSubstitution ?L) . }. +{ ?LC :substituteVariableList ?L . } => { _:dd :print (?LC :substituteVariableList ?L) . }. +{ ?LC :substitutedTriple ?L . } => { _:dd :print (?LC :substitutedTriple ?L) . }. +# { ?LC :substituteVariablesInFormula ?L . } => { _:dd :print (?LC :substituteVariablesInFormula ?L) . }. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |