RuleML / issues-ruleml

A repository solely for RuleML issues. No schemas or documents should be committed here.
3 stars 3 forks source link

Add PSOA tuples #79

Closed greenTara closed 4 years ago

greenTara commented 5 years ago

The following slotdep commits are relevant to implementation of this issue (chronological order): RuleML/deliberation-ruleml@aed13be (modify to exemplify tuples) RuleML/deliberation-ruleml@90c7c5b

RuleML/deliberation-ruleml@be6f9db (repeat as above for hornlog) RuleML/deliberation-ruleml@d8218fd (uncertainty regarding the static non-PSOA schema) RuleML/deliberation-ruleml@905e295 (modify ordered_groups_expansion_module.rnc and init_expansion_module.rnc as needed) RuleML/deliberation-ruleml@03151ac RuleML/deliberation-ruleml@5320e9e (modify the existing 4xsd drivers to include new tuple modules) RuleML/deliberation-ruleml@33e70d5 (by analogy to above for 4simp) RuleML/deliberation-ruleml@a94f063 (update auto-generate files, e.g. xsd's)

greenTara commented 5 years ago

RuleML/deliberation-ruleml@aed13be (modify to exemplify tuples)

  1. Rename the file as exa/,,,/datalogPSOA_normal.ruleml (commit without modification of contents)
  2. Change schema associations to "datalogPSOA_normal.rnc" and "datalogPSOA_normal.xsd"
  3. Change "workload" to "w", and so on.
  4. Change <Data> to an <Ind>
  5. In each part of the rule ( <if> and <then>), a) duplicate the <slotdep> element, b) rename the second one as <slot>, c) change constant labels (e.g. "w" becomes "v"). d) Expected to have no validation error at this stage when validated against e.g. datalogPSOA_normal.rnc
  6. Duplicate the entire rule ( <formula><Implies> ) a) Replace slotdep and slot elements with tuple elements in both <Atom>s in the new rule after <op> . b) <tupdep><Tuple>... c) <tup><Tuple><arg index="1"><Ind>a</Ind></arg><arg index="2"><Ind>b</Ind></arg><arg index="3"><Ind>c</Ind></arg></Tuple></tup>
  7. Duplicate the second rule ( <Implies> ) a) modify contents to merge the contents of the previous two rules (tuples before slots)

This instance will at this stage have validation errors regarding tuples (but not slots) when validated against e.g. datalogPSOA_normal.rnc

greenTara commented 5 years ago

RuleML/deliberation-ruleml@90c7c5b

  1. modify rnc and xsd test-suite instances as done for exa/ instance a) replace lines from line 6 (the first XML comment inside the <RuleML> element) down with the corresponding contents of exa/...
  2. create stub new modules in Oxygen a) tup_expansion_module.rnc copied from slot_expansion_module.rnc, b) tupdep_expansion_module.rnc copied from slotdep_expansion_module.rnc c) tuple_expansion_module.rnc copied from Plex_expansion_module.rnc
  3. run bash script to generate indep_valid modules (batch_module2indep_valid.sh)
  4. For "tup_expansion_module.rnc" a) replace "slot" with "tup" except delete line 27 (a comment line), and lines 37-39 and 44-50 b) replace "(tup-datt.choice & retup.attlist)," with "tup.attlist? &" c) replace "tup.content |= ..." with "tup.content |= Tuple-node.choice" d) replace retup.attlist with tup.attlist
  5. modify init_expansion_module.rnc as needed (to get module validation)
  6. run bash script to validate relative to design pattern (batch_rnc2rng.sh)
  7. Copy-paste content of tup module into tupdep module and replace "tup" with "tupdep"
  8. modify Tuple module a) replace Plex with Tuple except lines 21-33 and 40-43 and 64-80 b) change "reTuple" to "Tuple" c) change "Tuple_repo" and "Tuple_Any" to "Tuple" d) replace "(Tuple-datt.choice & reTuple.attlist)" with "Tuple.attlist" e) replace "positionalArgumentsForExpressions.sequence" with "positionalArgumentsForAtoms.sequence" f) modify init_expansion_module.rnc as needed
  9. add include statements for new modules to PSOA drivers ( relaxng/datalogPSOA_normal.rnc ) After "include "modules/individual_expansion_module.rnc", put

    
    
    #
    # DEPENDENT TUPLES INCLUDED
    #
    include "modules/tupdep_expansion_module.rnc" inherit = ruleml {start |= notAllowed}

Validate.
greenTara commented 5 years ago

Change the content model of <Atom> so that tuples are allowed, and exa/.../datalogPSOA....ruleml validates.

  1. Change ordered_groups.... module.rnc
argumentsForAtoms.sequence |= positionalArgumentsForAtoms.sequence, slotsForAtoms.sequence

to

argumentsForAtoms.sequence |= 

   ( positionalArgumentsForAtoms.sequence |

     tuplesForAtoms.sequence), 

   slotsForAtoms.sequence
  1. Add definition of tuplesForAtoms.sequence a) Duplicate the definition of slotsForAtoms.sequence along with its documentation (in ## comments above) which is lines 32-34. b) Replace "slot" with "tup". c) Delete the final item ("restOf ...")

  2. In init module, initialize tupdepTermsForAtoms.sequence and tupTermsForAtoms.sequence

  3. Validate exa/.../datalogPSOA_normal.ruleml. There should be no more JING errors.

greenTara commented 5 years ago

Generic Procedure for Creating/Modifying Modules

  1. After creating a new module, run batch_module2indep_valid.sh . This script creates parallel file in the relaxng/indep_valid module that allows every module to be directly validated from Oxygen.
  2. After modifying any module, run batch_rnc2rng.sh . This script converts each module into the XML form of Relax NG, and then validates this XML against the schema that defines the RuleML design pattern.
  3. Before committing, run the "Format and Indent" tool on XML and Relax NG files. (Currently there is a problem with nested includes in Relax NG however.)
greenTara commented 5 years ago

DONE: Refining the bash scripts so that module validation can be run separately:

  1. Write a script batch_val_module.sh which contains the for loop from build myng2rnc.sh from lines 18-28 plus the boilerplate (lines 1, 2, 12, 13) and documentation on line 3
greenTara commented 5 years ago

DONE: Modifying schema_rnc.php

  1. To the "terms" facet, add the following lines a) copying $terms_slot = 1; to become $terms_slotdep = 13;
  2. duplicate (above) the assignment of $needSlot for $needSlotDep
  3. duplicate (above) the // Include slots block, for slotdep
  4. run the experimental bash script to test it
greenTara commented 5 years ago

DONE: Replace the for loop in build_myng2rnc.sh with a call to batch_val_module.sh

Keep line 18, replace lines 19-28 with the call to batch_val_module.sh, similar to line 16.

greenTara commented 5 years ago

DONE: Modify exp_myng2rnc.sh to validate the generated RNC driver, and attempt to validate the RuleML instance file

  1. fix the soft link creation statement (if this doesn't work, put the generated rnc into DRIVERS_HOME instead)

ln -s "${RNC_HOME}modules/" "${TMP_HOME}modules"

  1. add a call of the rnc validation bash script (aux_valrnc.sh) to validate the driver schema:

"${BASH_HOME}aux_valrnc.sh" "${schemaFile}" This is a call with a single input argument to validate an rnc schema

  1. add a call of the rnc validation bash script to validate the PSOA instance against the driver schema:

"${BASH_HOME}aux_valrnc.sh" "${schemaFile}" "${rulemlFile}" This is a call with two input arguments to validate an XML instance ${rulemlFile} against an rnc schema ${schemaFile} .

greenTara commented 5 years ago

DONE: Make the extension of the myng code to include tuples.

  1. Extend the terms facet with two new bits (14, 15 - or possibly 6,7?) called $terms_tupdep and $terms_tup
  2. Create new variables $needtupdep, $needtup (assigned accordng to $terms_tupdep and $terms_tup) and $needTuple (assigned to be the max of the previous two).
  3. Add the echo commands necessary to create the include statements, following the manually created driver datalogPSOA_normal.rnc
  4. Document
  5. Add the include statements for tupdep, tup and tuple modules to all_ordered.rnc
  6. Test by running the bash script exp_myng2rnc.sh and build_myng2rnc.sh
greenTara commented 5 years ago

DONE: Add the myng codes for datalogPSOA_normal.rnc and hornlogPSOA_normal.rnc to the exp... script. Test using the exp... script.

Also, change the hornlog instance by adding a slot inside Expr. Further, change the text to single letters, like in the datalogPSOA instance, and create two more rules to show the tuple features.

greenTara commented 5 years ago

DONE: To the exp... script, add calls to the PHP script (result going into $TMP_HOME) using the myng codes for

We use the same myng code as in the corresponding e.g. datalogPSOA_normal.rnc, but change from -s4c to -s50 (for 4xsd) and -s48 (for 4simp) at the end.

Check the result by comparing to the manually written drivers in /relaxng/...4xsd.rnc and /relaxng/...4simp.rnc.

greenTara commented 5 years ago

DONE: Once all the calls to the PHP script have been confirmed, change the output directory from TMP_HOME to RNC_HOME. This will overwrite the existing manually-created scripts.

DONE (but not committed, because script fails part way through): Run build_myng2xsd.sh to check. If this runs with no errors, commit.

greenTara commented 5 years ago

DONE: Fix the PHP date issue (see recent fix in 1.03).

https://github.com/RuleML/deliberation-ruleml/blob/1.03/relaxng/php-cli.ini

and line 126 of https://github.com/RuleML/deliberation-ruleml/blob/1.03/relaxng/schema_rnc.php

greenTara commented 5 years ago

DONE: Experimentally publish the 1.03psoa branch on the RuleML server in a directory called 1.03psoa.

greenTara commented 5 years ago
  1. Modify the unordered... modules similar to the change of ordered... see #80
  2. Add languages datalogPSOA_relaxed.rnc, etc.
  3. Add datalogPSOA4xsd.rnc, etc.
  4. Add lines to config files for datalogPSOA and hornlogPSOA and naffologeqPSOA
  5. Rerun the bash build_myng2rnc.sh for testing purposes
rimachaudhari commented 5 years ago

Test using the script build_web2rnc.sh (modified as needed).

rimachaudhari commented 5 years ago

Run build_myng2xsd.sh to check. If this runs with no errors, commit.

rimachaudhari commented 5 years ago

RuleML/deliberation-ruleml@2eac790 (add tuple feature to PSOA schemas: Partial implementation.) RuleML/deliberation-ruleml@f11de30 (add style attribute to Tuple) RuleML/deliberation-ruleml@fe89bb0 (modify unordered module to include tuples)

greenTara commented 5 years ago

In normalizer_module.xslt, change all occurrences of

          local-name(.)!= 'arg' and 
          local-name(.)!='repo' and 

to local-name(.)!= 'arg' and local-name(.)!= 'tupdep' and local-name(.)!= 'tup' and local-name(.)!='repo' and

and similarly for other occurrences of arg that are unrelated to the index attribute of arg

greenTara commented 5 years ago

Add templates for Tuple, using a simplification of the template for Plex.

<xsl:template match="ruleml:Tuple/*[ruleml:isNode(.)]" mode="phase-1">

arg Also