Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PSOA tuples #79

Closed
greenTara opened this issue Aug 9, 2018 · 21 comments
Closed

Add PSOA tuples #79

greenTara opened this issue Aug 9, 2018 · 21 comments

Comments

@greenTara
Copy link
Member

No description provided.

@greenTara
Copy link
Member Author

greenTara commented Aug 9, 2018

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

  • modify rnc and xsd test-suite instances as done for exa/ instance
  • create new modules
  • create indep_valid modules for new modules
  • modify init_expansion_module.rnc as needed
  • add include statements for new modules to PSOA drivers

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
Copy link
Member Author

greenTara commented Aug 16, 2018

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
Copy link
Member Author

greenTara commented Aug 16, 2018

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
Copy link
Member Author

greenTara commented Aug 23, 2018

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
Copy link
Member Author

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
Copy link
Member Author

greenTara commented Aug 27, 2018

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
Copy link
Member Author

greenTara commented Aug 27, 2018

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
Copy link
Member Author

greenTara commented Aug 30, 2018

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
Copy link
Member Author

greenTara commented Aug 30, 2018

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
Copy link
Member Author

greenTara commented Aug 30, 2018

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
Copy link
Member Author

greenTara commented Aug 31, 2018

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
Copy link
Member Author

greenTara commented Aug 31, 2018

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

  • datalogPSOA_normal4xsd.rnc
  • hornlogPSOA_normal4xsd.rnc
  • datalogPSOA_normal4simp.rnc
  • hornlogPSOA_normal4simp.rnc

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
Copy link
Member Author

greenTara commented Aug 31, 2018

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
Copy link
Member Author

greenTara commented Aug 31, 2018

@greenTara
Copy link
Member Author

greenTara commented Aug 31, 2018

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

@greenTara
Copy link
Member Author

greenTara commented Aug 31, 2018

  1. Modify the unordered... modules similar to the change of ordered... see Possible positional freedom of xsd might be more than is implemented #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
Copy link

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

@rimachaudhari
Copy link

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

@rimachaudhari
Copy link

rimachaudhari commented May 31, 2019

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)

rimachaudhari referenced this issue in RuleML/deliberation-ruleml Jun 6, 2019
The schemas associated with this example do not yet exist.
Partial implementation of RuleML/issues-ruleml#78
rimachaudhari referenced this issue in RuleML/deliberation-ruleml Jun 6, 2019
…r testing

Signed-off-by: greenTara <taraathan@gmail.com>
rimachaudhari referenced this issue in RuleML/deliberation-ruleml Jun 6, 2019
rimachaudhari referenced this issue in RuleML/deliberation-ruleml Jun 6, 2019
rimachaudhari referenced this issue in RuleML/deliberation-ruleml Jun 6, 2019
rimachaudhari referenced this issue in RuleML/deliberation-ruleml Jun 6, 2019
Also add copy statements to batch_config2rnc4simp
rimachaudhari referenced this issue in RuleML/deliberation-ruleml Jun 6, 2019
rimachaudhari referenced this issue in RuleML/deliberation-ruleml Jun 6, 2019
Partial implementation.
rimachaudhari referenced this issue in RuleML/deliberation-ruleml Jun 6, 2019
rimachaudhari referenced this issue in RuleML/deliberation-ruleml Jun 6, 2019
rimachaudhari referenced this issue in RuleML/deliberation-ruleml Jun 17, 2019
Bash scripts were modified in the previous commit.
Also a php problem with timezone was fixed.
rimachaudhari referenced this issue in RuleML/deliberation-ruleml Jun 17, 2019
We changed manually-written RNC drivers to PHP-generated RNC drivers.
Also naffologeqPSOA drivers generated.
@greenTara
Copy link
Member Author

greenTara commented Jun 25, 2019

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
Copy link
Member Author

greenTara commented Jun 27, 2019

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

<xsl:template
match="ruleml:Tuple/*[ruleml:isNode(.)]"
mode="phase-1">
<xsl:call-template name="wrap">
<xsl:with-param name="tag">arg</xsl:with-param>
</xsl:call-template>
</xsl:template>

Also

<xsl:template match="ruleml:Tuple" mode="phase-2">
xsl:copy
<xsl:apply-templates select="@" mode="phase-2"/>
<xsl:apply-templates select="comment()" mode="phase-2"/>
<xsl:apply-templates select="
[namespace-uri(.)!='http://ruleml.org/spec']" mode="phase-2"/>
<xsl:apply-templates select="ruleml:meta" mode="phase-2"/>
<xsl:apply-templates
select="*[
namespace-uri(.)='http://ruleml.org/spec' and
local-name(.)!= 'meta' and
local-name(.)!= 'arg' and
local-name(.)!='repo']"/>
<xsl:apply-templates select="ruleml:arg" mode="phase-2"/>
<xsl:apply-templates select="ruleml:repo" mode="phase-2"/>
</xsl:copy>
</xsl:template>

greenTara referenced this issue in RuleML/deliberation-ruleml Jul 2, 2019
including treatment of canonical ordering of tupdep and tup
within Atom, ...
as well as wrapping skipped args within Tuple
@tmitsi tmitsi closed this as completed Feb 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants