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. |
From: <jm...@us...> - 2010-03-26 16:02:27
|
Revision: 1359 http://eulergui.svn.sourceforge.net/eulergui/?rev=1359&view=rev Author: jmvanel Date: 2010-03-26 16:02:18 +0000 (Fri, 26 Mar 2010) Log Message: ----------- swrl-n3-rules.n3 : fix the fully substituted triple; now we get this (also applied the simplification due to latest Euler revision 3352 ) : ( {:x :sibling :y. :x :hates :y} ((:x _:x_1) (:y _:y_1)) ) :substitutedFormula {_:x_1 :sibling _:y_1. _:x_1 :hates _:y_1} Revision Links: -------------- http://eulergui.svn.sourceforge.net/eulergui/?rev=3352&view=rev 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-26 14:23:49 UTC (rev 1358) +++ trunk/eulergui/examples/swrl-n3-rules.n3 2010-03-26 16:02:18 UTC (rev 1359) @@ -158,8 +158,9 @@ #** Consequent: :substituteVariableList - substitution of a list of variable substitutions ?L in a triple { (?STAT ?INVARIANT) :substituteVariableList ?L . + # _:d e:trace ( rdf:first :substituteVariableList ?L ). ?STAT log:includes {?S ?P ?O} . - ?L a rdf:List . + # ?L a rdf:List . ?L rdf:first (?V ?VT) . # _:d e:trace ( rdf:first :substituteVariableList ?L log:includes {?V ?P ?O} ). } => { @@ -169,55 +170,79 @@ { (?STAT ?INVARIANT) :substituteVariableList ?L . ?STAT log:includes {?S ?P ?O} . - ?L a rdf:List . + # ?L a rdf:List . ?L rdf:rest ?REST . # recover result from preceding rule: ?L rdf:first (?V ?VT) . ( {?S ?P ?O} (?V ?VT) ) :variableSubstitution {?SS ?P ?OS} . - #_:d e:trace ( rdf:rest :substituteVariableList ?L - # :variableSubstitution {?SS ?P ?OS} ). + # _:d e:trace ( rdf:rest :substituteVariableList ?L + # :variableSubstitution {?SS ?P ?OS} ). } => { - ?REST a rdf:List . + # ?REST a rdf:List . ({?SS ?P ?OS} ?INVARIANT) :substituteVariableList ?REST . }. -#** recover the fully substituted triple from the initial non substituted triple ?STAT and the substitution list ?L +# substitution of triples in a formula ?F - WIP +{ ?F :substituteVariablesInFormula ?L . + # ?F log:includes ?STAT . + ?F log:includes {?S ?P ?O} . + # _:d e:trace ("substituteVariablesInFormula" + # ?F ?STAT # ?L ). +} => { + ( + # ?STAT + {?S ?P ?O} + # ( ?F ?STAT ?L ) # INVARIANT + ( ?F {?S ?P ?O} ?L ) # INVARIANT + ) :substituteVariableList ?L . +}. + +#** recover the fully substituted triple from the initial formula, non substituted triple ?STAT and 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 (?F ?STAT ?L) # INVARIANT + ) :substituteVariableList ?L . + + #_:d e:findall ( ?STAT_ + # {(?STAT_ (?F ?STAT ?L) ) :substituteVariableList ()} ?TSUBST ). + (?TSUBST (?F ?STAT ?L) ) :substituteVariableList (). + + # _:d e:trace ("trace substitutedTriple" + # ?F ?STAT ?L ). + } => { - (?STAT ?L) :substitutedTriple ?TSUBST. + (?F ?L) :substitutedTriplesInFormula ?TSUBST. }. -# substitution of triples in a formula ?F - WIP { ?F :substituteVariablesInFormula ?L . - ?F log:includes {?S ?P ?O} . + _:d e:findall ( ?TSUBST_ + { (?F ?L) :substitutedTriplesInFormula ?TSUBST_ . } + ?TSUBST ). + ?TSUBST log:conjunction ?FSUBST . } => { - ({?S ?P ?O} ?INVARIANT) :substituteVariableList ?L . + (?F ?L) :substitutedFormula ?FSUBST. }. # 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 :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 . # useless with latest Euler + { ?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) . }. +{ ?LC :substitutedTriplesInFormula ?L . } => { _:dd :print (?LC :substitutedTriplesInFormula ?L) . }. +{ ?LC :substitutedFormula ?L . } => { _:dd :print (?LC :substitutedFormula ?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. |
From: <iam...@us...> - 2010-04-14 13:19:01
|
Revision: 1451 http://eulergui.svn.sourceforge.net/eulergui/?rev=1451&view=rev Author: iamlolive Date: 2010-04-14 13:18:54 +0000 (Wed, 14 Apr 2010) Log Message: ----------- adding support for the SameIndividualAtom in SWRL->N3 rules translator Modified Paths: -------------- trunk/eulergui/examples/swrl-n3-rules.n3 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |