ruleml / reaction-ruleml Goto Github PK
View Code? Open in Web Editor NEWReaction RuleML
Home Page: http://reaction.ruleml.org
Reaction RuleML
Home Page: http://reaction.ruleml.org
There is an immediate need to implement the first two steps of Issue #7
The rest of the modularization can/should still be postponed until some testing has been completed. But the driver schema implementation is necessary to efficiently carry out the generated-instances-based testing.
In RR, the syntax allows every Node to have an oid child.
In the final release of Deliberation RuleML, this was changed so that only certain Nodes (Atom, Expr, Uniterm) can have oids.
For the initial "parallel" release of Reaction RuleML 1.0 in Relax NG, we need a strategy for the oid component that is compatible.
Some options:
In commit 6fcf78d, the operator of Expr is made optional in the xsd.
This change needs to be propagated to the Relax NG.
The part of the content model that is of concern is Expr.main
The pattern Expr.main is defined in two modules, for the ordered and unordered cases.
These modules are redefined when they are imported into DR-ReactionRuleML. So the redefinition of Expr.main can be added there.
The current pattern is
(ordered)
Expr.main |=
operatorForExpressions-edge.choice,
argumentsForExpressions.sequence
(unordered)
Expr.main |=
operatorForExpressions-edge.choice
& argumentsForExpressions.sequence
The redefined patterns should be
(ordered)
Expr.main |=
operatorForExpressions-edge.choice?,
argumentsForExpressions.sequence
(unordered)
Expr.main |=
operatorForExpressions-edge.choice?
& argumentsForExpressions.sequence
An alternative implementation would be to extend the Expr.main pattern, rather than redefine it, e.g below the include statement insert
Expr.main |= argumentsForExpressions.sequence
However, I believe the first option is more helpful for moving on to the version where Deliberation RuleML will adopt the key/keyref mechanism.
Also see http://wiki.ruleml.org/index.php/Add_Keyref_Mechanism_to_Deliberation_RuleML
These would be of the form
Time_term = element Time {Time.type}
Time_formula = element Time {Time.type}
Only one of these should be reifiable. In particular, the formula should be reifiable because there is no need to reify a term.
Node.choice |= Time_formula
These patterns are used in different places
SimpleKeyTerm.choice |= Time_term
SimpleFormula-node.choice |= Time_formula
Similarly for Spatial, Interval.
The patterns for these could diverge. For example, we usually allow an @type attribute on simple terms, but not on formulas. Also, Time-term might take an @iri.
In contrast, Time-formula might take a <degree> child in Fuzzy RuleML, or an <oid>, which would not be allowed for a term in strict DR 1.0.
A branch is needed for RuleML 1.02 development. The IRIs that implement the inclusion of Deliberation RuleML schemas will change to point to the 1.02 directory on the server.
Similar to issue #62, we have this error
System ID: /Users/taraathan/Repositories/RuleML/Github/reaction-ruleml/auto-gen/dr-rnc/instance-rnc-assert-horn1.xml
Main validation file: /Users/taraathan/Repositories/RuleML/Github/reaction-ruleml/auto-gen/dr-rnc/instance-rnc-assert-horn1.xml
Scenario name: dr-xsd
Schema: /Users/taraathan/Repositories/RuleML/Github/reaction-ruleml/xsd/dr.xsd
Engine name: Saxon-EE 9.4.0.6
Severity: error
Description: In content of element : The content model does not allow element <{...ruleml.org/spec}Quantifier> to appear here. Expected one of: {http://ruleml.org/spec}Equivalent, {http://ruleml.org/spec}Neg, {http://ruleml.org/spec}Spatial, {http://ruleml.org/spec}Implies, {http://ruleml.org/spec}Atom, {http://ruleml.org/spec}Negation, {http://ruleml.org/spec}Interval, {http://ruleml.org/spec}Time, {http://ruleml.org/spec}Operator, {http://ruleml.org/spec}Forall, {http://ruleml.org/spec}Equal, {http://ruleml.org/spec}Rule
Start location: 721:107
The parent element is Forall inside a qualification.
To fix this we need:
ForallFormula.choice |= Quantifier-node.choice
should be
ForallFormula.choice |= Quantifier-fo-node.choice
The content model for the <strong> and <weak> edges in Neg and Naf, as well as the in Negation, are allowed to have any kind of negation (Neg, Naf or Negation).
This doesn't fit well with the Derivation RuleML backbone, which allows arbitrary compounding of Neg at the level of FOL, but still doesn't allow Naf inside of Neg or Naf even at FOL expressivity.
Errors from the validation of auto-gen/dr-rnc/instance-rnc-assert1.xml (instance of Relax NG schema)
Schema: http://reaction.ruleml.org/1.0/xsd/dr.xsd
Engine name: Saxon-EE 9.4.0.6
Severity: error
Description: Attribute @safety is not allowed on element
Start location: 1190:56
Severity: error
Description: Attribute @SiZe is not allowed on element
Start location: 1190:56
Since April 2014, the content model of Profile in Relax NG has been
Profile.attlist &= iri-att.choice?
Profile.attlist &= direction-att-inf.choice?
Profile.attlist &= Type.attlist?
Profile.attlist &= commonNode.attlist?
Profile.attlist &= safety-att.choice?
Profile.attlist &= size-att.choice?
Profile.content |= Node.header, formula_Profile-edge.choice*
formula_Profile-edge.choice |= formula_AssertRetract-edge.choice
Instead of
Atom.content =
meta-roles.content,
degree?,
(# operator optional for frame representation
element op { op-atom.type }
| op-atom.content)?,
Atom-slots.extend1,
Atom-repo.extend,
Atom-slots.extend1,
Atom-slots.extend2
Should be
Atom.content =
meta-roles.content,
degree?,
(# operator optional for frame representation
element op { op-atom.type }
| op-atom.content)?,
Atom-slots.extend1,
(Atom-repo.extend,
Atom-slots.extend1)?,
Atom-slots.extend2
The JAXB parser creates a property called Meta for each of these, and so has a conflict that requires either conflict resolution, or selection of a different name for one or the other of these components.
Lines 1=13 and I thnk line 16 also, are not needed and should be deleted.
The verification using instance generation from the original dr.xsd with validation against the RNC based on either nafneghornlogeq expressivity, or the more general naffologeq (the highest expressivity of Deliberation RuleML) shows the following extensions or redefinitions are needed:
On line 392 we have
# *** oid ***
oid.content = AnyTerm.choice
oid.type = oid.content, oid.attlist
oid = element oid { oid.type }
In the included http://ruleml.org/1.0/relaxng/modules/oid_expansion_module.rnc, we have
objectIdentifier-edge.choice |= oid.edge.def
## An optional object identifier for an atomic formula, expression or the unifed terms
## of the SWSL branch, as needed for PSOA semantics.
## Note that oids are not required to be unique within a rulebase.
oid.edge.def =
## <oid>: a label for Node elements. See
## http://www.ruleml.org/1.0/glossary/#gloss-oid
element oid { oid.attlist? & oid.content }
## The object descriptor content model consists of any single term.
## Note: this corrects an error in the oid content model of RuleML 1.0,
## where Var is allowed in oid in bindatagroundlog and bindatagroundfact.
oid.content |= AnyTerm.choice
# For the declaration of the term patterns, see the term module (individual_expansion_module)
where according to the definition in init_expansion_module.rnc,
oid.attlist &= commonInit.attlist?
There are several problems with the existing dr.rnc
Note that oid.type is not needed elsewhere.
Therefore we may achieve the same result with the alias definition
oid = objectIdentifier-edge.choice
and deleting lines 393-395.
In checking an auto-generated instance from the Relax NG consumer dialect against the online schema http://reaction.ruleml.org/1.0/xsd/dr.xsd , errors are reported for meta and vocab attributes on Rule and Implies or Equivalent. There is no error given when the attribute appears on other elements, e.g. Equal, Data, Time, Expr, etc.
Instead of
Plex.content =
meta-roles.content,
element slot { slot.type }*,
((arg | arg.content)+
| repo?
| element slot { slot.type }*
| resl?
| repo
| element slot { slot.type }*
| resl?
| resl
Should be
Plex.content =
meta-roles.content,
element slot { slot.type }*,
(((arg | arg.content)+,
repo?,
element slot { slot.type }*,
resl?)?
| (repo,
element slot { slot.type }*,
resl?)
| resl)
From the documentation:
# Interval primitives
# content model:
# in ([Time,Time?] | [Spatial, Spatial?] | [Interval, Interval?] | [(Ind | Data | Skolem | Var | Reify | Expr | Plex | Time | Spatial | Interval), (Ind | Data | Skolem | Var | Reify | Expr | Plex | Time | Spatial | Interval)?])
From the schema, this looks like:
interval_primitives.content =
(Time, Time?)
| (Spatial, Spatial?)
| (Interval, Interval?)
| ((AnyTerm.choice),
(AnyTerm.choice)?)
But I believe this can be simplified to
interval_primitives.content = AnyTerm.choice, AnyTerm.choice?
Am I missing something here?
There is a large overhead to handling "default values" of attributes in Relax NG.
And there seems to be little value added from this characteristic.
The only advantages I can think of are:
The principal disadvantage, from the RNC perspective, is the extra code necessary to handle this feature. As an example, here is the beginning of the coding for the RR @Style attribute, which has default value "reasoning".
# *** @style ***
#
# restriction: active | messaging | reasoning
# default value: reasoning (in DR Reaction RuleML), active (in PR and ECA RuleML), and messaging (in CEP RuleML)
# optional attribute
# in style_default module
style.datatype |= "reasoning"
# in style_non-default module
style.datatype |= "active" | "messaging"
# *** @style ***
#
# restriction: active | messaging | reasoning
# default value: reasoning (in DR Reaction RuleML)
# optional attribute
style.attrib = style-att-inf.choice
# in default_inf_reactive module
style-att-inf.choice |= notAllowed
# in default_absent_reactive module
style-att-inf.choice |= empty
# in default_present_reactive module
style-att-inf.choice |= style-att.choice
# in style_attrib module
style-att.choice |= attribute style { style.datatype }
The remaining steps to implement this code would be to create the modules:
In a driver schema for the compact syntax where the attributes with default values must be absent:
include default_inf_reactive_expansion_module.rnc
include default_absent_reactive_expansion_module.rnc
In a driver schema for the normalized syntax where the attributes with default values must be present:
include default_inf_reactive_expansion_module.rnc
include default_present_reactive_expansion_module.rnc
In a driver schema for the relaxed syntax where the attributes with default values may be absent or present:
include default_inf_reactive_expansion_module.rnc
include default_absent_reactive_expansion_module.rnc
include default_present_reactive_expansion_module.rnc
In addition, when the fine-grained modularization of RR is implemented, there would need to be the following modules:
In comparison, if we drop the value "reasoning" from the style datatype, and use the absence of the style attribute as the indicator that the style is reasoning, (and similarly for @mode, @safety, @SiZe) then
1.The map attributes on various elements (performatives and Rulebases) that are inherited from Deliberation RuleML are disallowed by DR Reaction RuleML. Because these attributes have default values, they are required to be present in the normalized form, leading to an incompatibility for this version. For the release to LegalRuleML, we will remove performatives. However, Rulebase is still relevant to LegalRuleML because of its possible appearance in scope, etc. and its required role in Entails. The map attributes on Rulebase need to be harmonized in some way.
2. @safety is not allowed on Profile by the XSD
3. #size? there is some confusing documentation, and it doesn't appear in the glossary. The Relax NG has it appearing on Profile, but the XSD does not allow it.
In dr.xsd line 39 says
DR/KR Reaction RuleML ( meta_, scope_, guard_, evaluation_, signature_, qualification_, quantification_, oid?, (act | Assert | Retract | Query)_ )
however line 88 says
DR/KR Reaction RuleML (Consult|Assert|Retract|Query|Answer|Test)
Are these new performatives?
If so, I suggest we make the addition of these new elements a part of a version later than 1.0. We could create branches to separate these developments.
Line 553
is not relevant to RNC.
IntervalAlgebraOperator.content =
meta-roles.content,
(element arg { arg_interval.type }
| element arg { arg_interval.type }
| Interval
| Interval)
This cannot be converted back to XSD without error.
An XSD schema will allow any element that is globally declared to be the root element of a document.
Relax NG has the capability to specify the elements that are allowed to be root elements through its "start" pattern.
In DR version 1.0, the start pattern is specified as
start = Node.choice | edge.choice
for consistency with the XSD. (see http://ruleml.org/1.0/myng/)
I suppose we should continue this for RR 1.0, in keeping with the dual-release in XSD and Relax NG, and leave the modification of this to future versions.
To implement this, we need to make sure that every ".def" pattern is added to either Node.choice or edge.choice, as appropriate. In DR 1.0, I did this at the beginning of each module, e.g.
start |= Ind.Node.def | arg.edge.def
Node.choice |= Ind.Node.def
edge.choice |= arg.edge.def
in http://ruleml.org/1.0/relaxng/modules/individual_expansion_module.rnc
Expr.content =
meta-roles.content,
(element op { op-Expr.type }
| op-Expr.content),
element slot { slot.type }*,
((arg | arg.content)+ | repo? | repo),
element slot { slot.type }*,
resl?
a) does not allow no arguments
b) has a redundant choice: repo? | repo
The correct RNC would be
Expr.content =
meta-roles.content,
(element op { op-Expr.type }
| op-Expr.content)?,
element slot { slot.type }*,
((((arg | arg.content)+ | repo?)|repo),
element slot { slot.type }*)?,
resl?
(Note the optional operator as well for keyref instances.)
Both Reaction RuleML and Deliberation RuleML have a meta element, but they have a slightly different content model.
The RR version has a required optional index attribute, while the DR version has no index attribute.
Proposed solution: include and extend the existing meta element with an optional @Index attribute.
Further, the following interleave definition is included in the existing meta module:
Node.header &= metaKnowledge-edge.choice*
Proposed: redefine this in the include as
meta.edge.def = element meta { index.attrib? &
formula_AssertRetract.attlist? & formula_AssertRetract.content }
Node.header &= empty
In the body of dr.rnc, we make the following definitions
metadata_ordered-header.choice |= meta*, scope*, guard*
interface_ordered-header.choice |= evaluation*, signature*
instance_ordered-header.choice |= qualification*, quantification*, oid?
Node_ordered-header.choice |=
metadata_ordered-header.choice, interface_ordered-header.choice, instance_ordered-header.choice
Node.header &= Node_ordered-header.choice?
System ID: /Users/taraathan/Repositories/RuleML/Github/reaction-ruleml/auto-gen/dr-rnc/instance-rnc-assert-horn1.xml
Main validation file: /Users/taraathan/Repositories/RuleML/Github/reaction-ruleml/auto-gen/dr-rnc/instance-rnc-assert-horn1.xml
Scenario name: dr-xsd
Schema: /Users/taraathan/Repositories/RuleML/Github/reaction-ruleml/xsd/dr.xsd
Engine name: Saxon-EE 9.4.0.6
Severity: error
Description: In content of element : The content model does not allow element <{...ruleml.org/spec}Implies> to appear here. Expected one of: {http://ruleml.org/spec}Naf, {http://ruleml.org/spec}Spatial, {http://ruleml.org/spec}Neg, {http://ruleml.org/spec}Atom, {http://ruleml.org/spec}Or, {http://ruleml.org/spec}Negation, {http://ruleml.org/spec}Interval, {http://ruleml.org/spec}Time, {http://ruleml.org/spec}And, {http://ruleml.org/spec}Operator, {http://ruleml.org/spec}Equal
Start location: 1493:111
According to the XSD
<xs:group name="quantification.content">
<xs:choice>
<xs:group ref="inner-quantifier.content"/>
</xs:choice>
</xs:group>
and inner-quantifier.content is essentially a group of quantifiers (Forall, Exists, Quantifier)
whose content model is the same as the body of an implication (PremiseFormula in RNC).
In the current RNC this is implemented by re-using the content of a normal Forall, which is wrong.
There is no existing formula edge that has content identical to the body of implications, so
a pattern for such a formula edge has to be created (call it formula-inner-quant).
The original RR schema dr.xsd appears to allow the element to be empty, at least according to oXygen validation using the Saxon engine. This choice is not now implemented in the Relax NG, but it can be easliy added, if that is intended.
System ID: /Users/taraathan/Repositories/RuleML/Github/reaction-ruleml/auto-gen/dr-rnc/instance-rnc-assert-strict1.xml
Main validation file: /Users/taraathan/Repositories/RuleML/Github/reaction-ruleml/auto-gen/dr-rnc/instance-rnc-assert-strict1.xml
Scenario name: dr-xsd
Schema: /Users/taraathan/Repositories/RuleML/Github/reaction-ruleml/xsd/dr.xsd
Engine name: Saxon-EE 9.4.0.6
Severity: error
Description: In content of element : The content model does not allow element <{...ruleml.org/spec}Quantifier> to appear here. Expected one of: {http://ruleml.org/spec}Rulebase, {http://ruleml.org/spec}Equivalent, {http://ruleml.org/spec}Neg, {http://ruleml.org/spec}Spatial, {http://ruleml.org/spec}Implies, {http://ruleml.org/spec}Atom, {http://ruleml.org/spec}Negation, {http://ruleml.org/spec}Interval, {http://ruleml.org/spec}Time, {http://ruleml.org/spec}Entails, {http://ruleml.org/spec}Operator, {http://ruleml.org/spec}Forall, {http://ruleml.org/spec}Equal, {http://ruleml.org/spec}Rule
Start location: 11:103
In the Relax NG schema, the content model of meta is
formula_AssertRetract.content
This is similarly true in the XSDs
</xs:attributeGroup>
<xs:group name="meta.content">
<xs:choice>
<xs:group ref="formula-assert.content"/>
</xs:choice>
</xs:group>
Here is the definition
<xs:group name="formula-assert.content">
<xs:choice>
<xs:element ref="Rulebase"/>
<xs:element ref="Implies"/>
<xs:element ref="Rule"/>
<xs:element ref="Equivalent"/>
<xs:element ref="Entails"/>
<xs:group ref="outer-quantifier.content"/>
<xs:group ref="outer-connective.content"/>
<xs:group ref="extended-signature-predicate-sorts.content"/>
</xs:choice>
</xs:group>
In Relax NG extended_quantifier_expansion_module
AssertRetractFormula.choice |= Quantifier-node.choice
should be
AssertRetractFormula.choice |= Quantifier-fo-node.choice
The test file FullDerivationRule.rrml does not validate against the XSD because it has mapClosure, mapDirection and mapMaterial attributes on the Assert element. These are allowed in Deliberation RuleML 1.0.
Something seems to be awry in the content model for Interval. First we have the documentation
# DR Reaction RuleML: ( meta*, scope*, guard*, evaluation*, signature*, qualification*, quantification*, oid?, ([arg, arg?] | [content(xs:any),content(xs:any)?] | [Time,Time?] | [Spatial, Spatial?] | [Interval, Interval?] | [Var, Var?])?
This would perhaps make sense if the "arg" was the same as the arg of Atom and Expr.
But a separate arg_interval pattern is defined, where one element contains both endpoints.
arg_interval.content = interval_primitives.content
This produces the possibility for an Interval to contain, say, four Time values:
<Interval>
<arg index=1><Time>...</Time<Time>...</Time></arg>
<arg index=2><Time>...</Time<Time>...</Time></arg>
</Interval>
This appears to be a correct translation of the original dr.xsd, according to an independent translation of a flattened XSD schema followed by Jing simplification. (see https://github.com/greenTara/reaction-ruleml/blob/master/xsd/flatten/tmp/dr-simp.rnc)
Deliberation RuleML does not have the value "effect" in the content model for @per. If this is desired in RR for the elements Expr and Fun as well as Rel, that needs to be added to the XSD.
The directory should be renamed (e.g. simp).
Once the default values of attribute values are removed, bring this up-to-date so the modifications can be verified.
Ideally, this would be kept up-to-date by a commit hook.
At several points in the development, consistency between the XSD and RNC schemas can be checked by autogeneration of instances. A very brief description is given here: http://wiki.ruleml.org/index.php/MYNG#Testing_Relax_NG_schemas
This will typically give a large but not unmanageable file (~ 30 MB).
You might have to increase the Java heap to be able to validate this with Jing, however.
Associate the Relax NG schema dr-relaxed.rnc to this file, and validate.
Similary an RNC file can be converted to XSD using oXygen, and then used to generate instances that should validate against the XSD. The driver schema for this dr-autogen-compact.rnc . I generated a simplified RNG schema first, in /tmp, and then converted to XSD and ran the instance generator. There are some validation errors (against the schema that was used to created the instances) because of recursion limits. These can be fixed by a global find/replace, although that is annoying.
Instance generated with a root element other than "RuleML" seem to give different validation errors than instances having the "RuleML" root.
Instances with a root such as "Rule" :
The original XSD dr.xsd uses a content model for Time and Spatial that allows two slotted rest variables (resl) to occur in the same argument sequence. This is a known bug coming from the patterns used in Deliberation RuleML 0.91 and 1.0 to add some positional independence to argument sequences of terms and predicates. The RNC approach of implementing positional independence with interleave avoids this bug.
To get the instance verification from dr.xsd to work, all second resl elements need to be manually deleted so the instances will validate against the relaxed RNC schemas.
Reaction RuleML allows the per attribute on Relations, with an extended enumeration list of values, including "modal" and "effect".
However, there is no example in the exa directory demonstrating this syntax.
The last remaining element issue is the Quantifier element - its content model and what parents it is allowed to have.
In the XSD, the content model of Quantifier is the same as Forall and Exists within the quantifier edge.
This is unlike Forall and Exists elsewhere (except at FOL expressivity).
The formula-inner-quant pattern was defined to create this type, and can be re-used for Quantifier.
In the XSD, Quantifier is only allowed to appear as a child of quantification, and may not be nested.
This should be reproduced in the Relax NG by adding Quantifier to other choice patterns only at FOL expressivity.
There are redundancies in the flattened RNC. For example, the start pattern as initially defined includes the RuleML pattern, and then in a choice combine definition, the RuleML pattern is again included.
start = RuleML ....
start |= RuleML
Such redundancy can cause difficulty when XSD needs to be regenerated from the RNC (although it appears the start pattern is treated specially so redundancy in the start pattern itself does not cause a problem with the reconversion.)
Here is another test for the dr-flat.rnc - it should be possible to transform it back to XSD without errors. This transformation is also necessary for the automatic instance generation from the RNC that is a necessary part of testing.
To ensure the validity of the schemas during development, it is critical to have test suites of example documents that exhaustively cover the syntax. These can be nonsense documents because they are not intended to illustrate the semantics. Therefore, it is best to have these in a directory that is separate from the meaningful examples (in /exa).
Further, the test suites should reference the driver schemas by relative IRIs, allowing for testing of development schemas in the working directory. In contrast, the documents in /exa should always reference the absolute IRIs for the schemas served from the RuleML website, allowing a smooth transition to MYNG-based service.
Ideally, a Github commit hook will be implemented to batch validate the test suites, ensuring that the published schemas are always fully tested.
We have alias declarations like
oid = objectIdentifier-edge.choice
This makes our schema more readable, but introduces extra named patterns unnecessarily. A global find-replace can be used to replace each occurrence of "oid" with "objectIdentifier-edge.choice".
When the simplified monolithic RNC schema is generated with Jing -s, the simpler names will be reconstructed, so the resulting content models are readable.
System ID: /Users/taraathan/Repositories/RuleML/Github/reaction-ruleml/auto-gen/dr-rnc/instance-rnc-assert1.xml
Main validation file: /Users/taraathan/Repositories/RuleML/Github/reaction-ruleml/auto-gen/dr-rnc/instance-rnc-assert1.xml
Scenario name: dr-xsd online
Schema: http://reaction.ruleml.org/1.0/xsd/dr.xsd
Engine name: Saxon-EE 9.4.0.6
Severity: error
Description: In content of element : The content model does not allow element <{...ruleml.org/spec}Rulebase> to appear here. Expected one of: {http://ruleml.org/spec}Equivalent, {http://ruleml.org/spec}Spatial, {http://ruleml.org/spec}Neg, {http://ruleml.org/spec}Implies, {http://ruleml.org/spec}Atom, {http://ruleml.org/spec}Negation, {http://ruleml.org/spec}Interval, {http://ruleml.org/spec}Time, {http://ruleml.org/spec}Operator, {http://ruleml.org/spec}Forall, {http://ruleml.org/spec}Equal, {http://ruleml.org/spec}Rule
Start location: 2420:121
The nesting sequence is
Assert > meta > Entails > meta > Atom > signature > Operator > formula > Rulebase
In the Relax NG, the content model of signature is
signature.content |= formula_Query.content
so anything that can be in a Query is supposed to be valid inside signature.
The same is true in the XSD, (except it is named formula-query.content)
<xs:group name="formula-query.content">
<xs:choice>
<xs:element ref="Rulebase"/>
<xs:element ref="Entails"/>
<xs:group ref="query-connective.content"/>
<xs:group ref="query-quantifier.content"/>
<xs:group ref="extended-signature-predicate-sorts.content"/>
</xs:choice>
</xs:group>
in dr-xsd we have
<xs:group name="query-connective.content">
<xs:choice>
<xs:element name="Operator" type="ConnectiveOperator.type"/>
<xs:element name="And" type="And-query.type"/>
<xs:element name="Or" type="Or-query.type"/>
<xs:element ref="Negation"/>
<xs:element ref="Naf"/>
<xs:element ref="Neg"/>
<xs:element ref="Equal"/>
</xs:choice>
</xs:group>
<xs:group name="ConnectiveOperator.content">
<xs:sequence>
<xs:group ref="meta-roles.content"/>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="formula" type="formula-rulebase.type"/>
<xs:group ref="formula-rulebase.content"/>
</xs:choice>
</xs:sequence>
</xs:group>
So this incompatibility can be traced to the Relax NG allowing Rulebases to be nested, while the XSD does not.
The autogen driver schema should be modified to include
drrr_rulebase_strict_expansion_module.rnc
which does not allow rulebase nesting.
The trouble appears to be with the Operator element.
This should be a SimpleFormula, and so be allowed wherever Atom is allowed.
Do this after Issue #17 (modularization) is resolved.
The pattern to be followed for Nodes is
Node.choice |= Name.Node.def
##
Name-node.choice |= Name.Node.def
Name.Node.def =
## short definition.
element Name { Name.type.def }
Name.type.def = (Name-datt.choice & reName.attlist), Name.header, Name.main
##
Name-datt.choice |= ...
Name-datt.choice |= ...
reName.attlist &= ...?
reName.attlist &= ...?
The blank ## lines provide spacing that helps with readability.
The pattern for edges is similar except there are not attributes with default values
edge.choice |= name.edge.def
##
name-edge.choice |= name.edge.def
name.edge.def =
## short definition.
element name { name.type.def }
name.type.def = name.attlist, name.content
Attributes are documented a little differently
## short definition.
name.attrib.choice |= name.attrib.def
name.attrib.def = attribute name { name.datatype }
##
name.datataype = ...
In all cases, if a component with a particular name can have more than one type, then the patterns are qualified, semi-consistently using underscores for edges, dashes for Nodes and dots for attributes, e.g.
formula_And.edge.def =
##
element formula { formula_And.type.def }
iri.lrml.attrib.def = attribute iri { iri.lrml.datatype }
I have created a new redefining module for And and Or that can serve as a template.
There are two And types in Deliberation RuleML - And-inner and And-query
The difference in Deliberation is that And-query allows closure attributes while And-inner does not.
The type definition of the And elements has two attribute lists, one for the attributes with default values And-Query-datt.choice and the other for the attributes with no default values reAnd-Query.attlist.
In the XSD of Reaction RuleML, And is given the operator-interface attribute list, which contains type?, style?, scope? and closure? in the consumer dialect, and also arity?, card?, weight?, mode? and per-rel?.
In addition the XSD includes the direction attribute optionally in this group.
To redefine the RNC type for And, we would need to make the pattern And-Query-datt.choice empty
And-Query-datt.choice |= empty
and give reAnd-Query.attlist the operator-interface pattern
reAnd-Query.attlist &= operator-interface.attlist?
In the RNC, the common attributes are included in the operator-interface.attlist, so there is no need to explicitly add these.
When Deliberation RuleML expressivity is FOL, then the And element is allowed to have an optional mapClosure attribute as well. This is not accommodated in Reaction RuleML, but there is no loss of expressivity, as the quantifications can always be expressed explicitly.
Validation of the latest dr.rnc gives me an error
[Jing] reference to undefined pattern "interval_anycontent.type"
This will mostly be accomplished by following the templates in Issue #18 .
To validate against the schema in
http://ruleml.org/1.0/designPattern/
the additional constraints that must be followed are:
"Choice-combine" named patterns are those whose names end in
.choice, .main, .content, .value, .datatype, .sequence, .defs
These names can be used only with the choice-combine syntax, and can be used multiple times, in different modules
And.main |= ...
And.main |= ...
"Interleave-combine" named patterns are those whose names end in
.attlist, .header
These names can be used only with the interleave-combine syntax, and can be used multiple times, in different modules. The right-hand-side must be either the empty pattern, a zero-or-one option, or a zero-to-many option
And.header &= empty
And.header &= ...?
And.header &= ...*
"No-combine" named patterns have any other name.
These names can be used only with the interleave-combine syntax, and can only be used once in the entire schema, including "included" modules.
And.node.def = ...
That's it. If the modules, after conversion to RNG syntax, validate against this schema, then they may be combined arbitrarily by inclusion, and will always result in a valid schema, The resulting family of sublanguages is monotonic relative to containment of the set of included modules.
The content models of these elements from Deliberation RuleML are determined by certain "Formula.choice" patterns. It should therefore be sufficient to add Rule (the current name of the pattern defining the Rule element) to these patterns.
AssertRetractFormula.choice |= Rule
ForallFormula.choice |= Rule
RulebaseFormula.choice |= Rule
Currently the content model is:
Interval.content =
meta-roles.content,
(element arg { arg_interval.type }
| interval_primitives.content
| element content { interval_anycontent.type })?
This needs to be changed to allow two arguments.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.