From: <jos...@ag...> - 2005-02-26 16:59:09
|
Hi, Guido Excellent! It works great while running from file:///c:/emcvs/eulermoz/rdftest/testinf.xul I've updated the copy of project files at http://eulermoz.sourceforge.net/eulermoz/ There's probably uri dereferencing problem when I try http://eulermoz.sourceforge.net/eulermoz/rdftest/testinf.xul the "execute testcase" then gives url of document = ulermoz.sourceforge.net\eulermoz\rdftest\testcases\ files = proctest3.axioms.n3,proctest3.query.n3 readAFile exception: [Exception... "Component returned failure code: 0x80520001 (NS_ERROR_FILE_UNRECOGNIZED_PATH) [nsILocalFile.initWithPath]" nsresult: "0x80520001 (NS_ERROR_FILE_UNRECOGNIZED_PATH)" location: "JS frame :: http://eulermoz.sourceforge.net/eulermoz/rdftest/interface.js :: readAFile :: line 888" data: no] ... Anyhow, you did impressive work! regards, jos -- Jos De Roo, AGFA http://www.agfa.com/w3c/jdroo/ naudts guido <nau...@ya...> Sent by: eul...@li... 25/02/2005 09:34 To: admin_eulermoz <eul...@li...>, cwm <pub...@w3...>, eulermoz_dev <eul...@li...> cc: (bcc: Jos De_Roo/AMDUS/MOR/Agfa-NV/BE/BAYER) Subject: [Eulermoz-developers] proposal Hallo, I've made a proposal for introducing procedures into logic programming using Notation3 as an example. The proposal is in attachment. My goal is to make logic programming more user friendly and to counter the combinatorial explosion. A demo can be found on: http://eulermoz.sourceforge.net/eulermoz/rdftest/ Greetings,Guido ===== Guido Naudts Lic. zoologie Ir.informatica Adviseur Department of Justice Secretarisdreef 5 2288 Bouwel Belgium __________________________________ Do you Yahoo!? Take Yahoo! Mail with you! Get it on your mobile phone. http://mobile.yahoo.com/maildemo A proposal for the use of procedures in logic programming using Notation 3 Author: Guido Naudts E-mail:nau...@ya... The proposal intends to introduce procedures with variable replacement in logic programming while at the same time enhancing the efficiency of inferencing and the modularity of the programming. Syntax The namespace proc: used is defined as: @prefix proc: <proctest#>. Syntax of procedure declaration: <myproc> proc:variables (?x1 ?x2 ... ?xn); proc:proc {a_tripleset}; proc:query {a_tripleset}. Syntax of procedure call: <myproc> proc:call (?a ?b ... ?q). The intention is that the proc:call variables list is substituted in sequence for the proc:variables list in the procedure declaration. Then the query is used together with the initial substitution for inferencing with the tripleset defined after proc:proc. The result (there can be more than one) is a list of substitutions or a failure (could be indicated by an empty list). The examples will clarify the intended result. This definition is such that as well backward as forward reasoning can be used. This could be indicated by a parameter eg proc:method "backward". The proc:query could be omitted but only with forward reasoning; this is why I did not select this. Examples: 1) Procedure: :cube proc:variables (?a ?b); proc:proc { {(?a ?a) math:product ?b1} => {[:result ?b1]}}; proc:query {[:result ?b]}. Procedure call: # ?z should become "16". :cube proc:call ("4" ?z). 2) Procedure: # calculate ax + b :line proc:variables (?a ?b ?x ?z); proc:proc { {(?a ?x) math:product _:y. (_:y ?b) math:sum ?z1.} => {[:result ?z1]}}; proc:query {[:result ?z]}. Procedure call: # following should return "13" for ?z. :line proc:call ("2" "3" "5" ?z). In a rule (example, not implemented): {[:displacement ?b].:line proc:call ("2" "3" ?b ?z). ?z math:greaterThan "20".} => {[:alert "The maximum value has been reached."]}. 3)An example with a recurrent call Procedure: # calculate n! res must be "1" when called :factorial proc:variables (?n ?res); proc:proc { { ?n math:greaterThan "1". (?n "-1") math:sum ?y. :factorial proc:call (?y ?z). (?z ?n) math:product ?res} => {[:result ?res]}. {?n math:equalTo "1"} => {[:result "1"] }}; proc:query {[:result ?res]}. Procedure call: # following should return 24 = 4! for ?result. :factorial proc:call ("4" ?result). Advantages: * inferencing on small sets of data and rules * procedures with variable replacement * modularity * ease of use * still logical programming (neverwhere any order (sequence) of triples) * together with proc:semantics a library of modules containing many procedures can be made. Caveat The procedure variables must be global variables within the procedure, but unknown outside the procedure. If two rules within the same procedure use the same variable the name of that variable should not become different in the two rules because of variable renumbering. I use the variable prefix "_:" for that. Feasability A demonstration of the above three testcases can be found on: eulermoz.sourceforge.net/eulermoz/rdftest/ An explanation of the program is found in mozengine.html. Double click on testInf.xul and then select testcases proctest, proctest2 and proctest3. Correctness The procedure call is really a subinferencing process with exactly the same characteristics as the main process (same definition of input, same definition of output). In fact the same modules are used (JsEngine.js and Forward.js) so the logic characteristics are identical. |