Skip to content

Commit

Permalink
add slotdep module and datalogPSOA test suite
Browse files Browse the repository at this point in the history
  • Loading branch information
greenTara committed Jul 12, 2018
1 parent 9c0f2d9 commit 90c7c5b
Show file tree
Hide file tree
Showing 5 changed files with 319 additions and 0 deletions.
223 changes: 223 additions & 0 deletions relaxng/datalogPSOA_normal.rnc
Original file line number Diff line number Diff line change
@@ -0,0 +1,223 @@
namespace dc = "http://purl.org/dc/elements/1.1/"
namespace dcterms = "http://purl.org/dc/terms/"
default namespace ruleml = "http://ruleml.org/spec"

dcterms:title [ "Deliberation RuleML Custom-Built Schema" ]
dcterms:identifier [ "http://deliberation.ruleml.org/1.03/relaxng/schema_rnc.php?backbone=x7&default=x7&termseq=x7&lng=x1&propo=x3cf&implies=x7&terms=xf0f&quant=x7&expr=x0&serial=x4c" ]
dcterms:isPartOf [ "http://deliberation.ruleml.org/1.03/spec" ]
dcterms:creator [ "http://wiki.ruleml.org/index.php/User:Athant" ]
dc:subject [ "Deliberation RuleML, custom-built" ]
dcterms:description [
"custom-built main module for a Deliberation RuleML language."
]
dcterms:date [ "2018-07-12T18:31:36+00:00" ]
dcterms:language [ "en" ]
dc:rights [ 'Copyright 2015 RuleML Inc. -- Licensed under the RuleML Specification License, Version 1.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://ruleml.org/licensing/RSL1.0-RuleML. Disclaimer: THIS SPECIFICATION IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, ..., EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. See the License for the specifics governing permissions and limitations under the License.' ]
dcterms:rights [ "http://ruleml.org/licensing/RSL1.0-RuleML" ]

dcterms:relation [ "http://deliberation.ruleml.org/1.03" ]
# Base URL = http://deliberation.ruleml.org/1.03/relaxng/schema_rnc.php
# Complete URL =
# http://deliberation.ruleml.org/1.03/relaxng/schema_rnc.php?backbone=x7&default=x7&termseq=x7&lng=x1&propo=x3cf&implies=x7&terms=xf0f&quant=x7&expr=x0&serial=x4c
start = Node.choice | edge.choice
#
# ROOT NODE AND PERFORMATIVES INCLUDED
#
include "modules/performative_expansion_module.rnc" inherit = ruleml {start |= notAllowed}
#
include "modules/performative_content_expansion_module.rnc" inherit = ruleml {start |= notAllowed}
#
# ATOMIC FORMULAS INCLUDED
#
include "modules/atom_expansion_module.rnc" inherit = ruleml {start |= notAllowed}
#
# CONJUNCTIONS AND DISJUNCTIONS INCLUDED
#
include "modules/andor_query_expansion_module.rnc" inherit = ruleml {start |= notAllowed}
#
# IMPLICATIONS INCLUDED
#
include "modules/implication_expansion_module.rnc" inherit = ruleml {start |= notAllowed}
#
# QUANTIFICATION OVER VARIABLES INCLUDED
#
include "modules/quantification_expansion_module.rnc" inherit = ruleml {start |= notAllowed}
#
# ATTRIBUTES WITH DEFAULT VALUES ARE INITIALIZED
#
include "modules/default_inf_expansion_module.rnc" inherit = ruleml {start |= notAllowed}
#
# ATTRIBUTES WITH DEFAULT VALUES ARE ABSENT OR OPTIONAL
#
include "modules/default_absent_expansion_module.rnc" inherit = ruleml {start |= notAllowed}
include "modules/default_absent_folog_expansion_module.rnc" inherit = ruleml {start |= notAllowed}
#
# ATTRIBUTES WITH DEFAULT VALUES REQUIRED
#
include "modules/default_present_expansion_module.rnc" inherit = ruleml {start |= notAllowed}
#
# POLYADIC TERM (ONE OR MORE TERMS) SEQUENCES INCLUDED
#
include "modules/termseq_poly_expansion_module.rnc" inherit = ruleml {start |= notAllowed}
#
# ORDER MODE - UNORDERED GROUPS DISABLED
#
include "modules/ordered_groups_expansion_module.rnc" inherit = ruleml {start |= notAllowed}
#
# EXPLICIT DATATYPING ENABLED
#
include "modules/explicit_datatyping_expansion_module.rnc" inherit = ruleml {start |= notAllowed}
#
include "modules/explicit_datatyping_value_expansion_module.rnc" inherit = ruleml {start |= notAllowed}
#
include "modules/explicit_datatyping_annotation_expansion_module.rnc" inherit = ruleml {start |= notAllowed}
include "modules/dataterm_simple_expansion_module.rnc" inherit = ruleml {start |= notAllowed}
include "modules/data_simple_content_expansion_module.rnc" inherit = ruleml {start |= notAllowed}
#
# xsi:schemaLocation ALLOWED IN RuleML
#
include "modules/xsi_schemalocation_expansion_module.rnc" inherit = ruleml {start |= notAllowed}
#
# WEB REFERENCES INCLUDED
#
include "modules/web_expansion_module.rnc" inherit = ruleml {start |= notAllowed}
#
# INTERNATIONALIZED RESOURCE IDENTIFIERS (IRIs) INCLUDED
#
include "modules/iri_expansion_module.rnc" inherit = ruleml {start |= notAllowed}
#
# RULEBASES INCLUDED
#
include "modules/rulebase_expansion_module.rnc" inherit = ruleml {start |= notAllowed}
#
# ENTAILMENTS (PROVES) INCLUDED
#
include "modules/metalevel_expansion_module.rnc" inherit = ruleml {start |= notAllowed}
#
# DEGREE OF UNCERTAINTY INCLUDED
#
include "modules/fuzzy_expansion_module.rnc" inherit = ruleml {start |= notAllowed}
#
# NODE IDENTIFIERS INCLUDED
#
include "modules/node_attribute_expansion_module.rnc" inherit = ruleml {start |= notAllowed}
#
# IN-PLACE ANNOTATIONS INCLUDED
#
include "modules/meta_expansion_module.rnc" inherit = ruleml {start |= notAllowed}
#
# XML BASE ATTRIBUTE INCLUDED
#
include "modules/xml_base_expansion_module.rnc" inherit = ruleml {start |= notAllowed}
#
# XML ID ATTRIBUTE INCLUDED
#
include "modules/xml_id_expansion_module.rnc" inherit = ruleml {start |= notAllowed}
#
# EQUIVALENCES INCLUDED
#
include "modules/equivalent_expansion_module.rnc" inherit = ruleml {start |= notAllowed}
#
# INFERENCE DIRECTION ATTRIBUTE IS INCLUDED
#
include "modules/direction_attrib_expansion_module.rnc" inherit = ruleml {start |= notAllowed}
#
include "modules/mapdirection_attrib_expansion_module.rnc" inherit = ruleml {start |= notAllowed}
#
# NON-DEFAULT VALUES OF INFERENCE DIRECTION INCLUDED
#
include "modules/direction_non-default_expansion_module.rnc" inherit = ruleml {start |= notAllowed}
#
# DEFAULT VALUES OF INFERENCE DIRECTION INCLUDED
#
include "modules/direction_default_expansion_module.rnc" inherit = ruleml {start |= notAllowed}
#
# MATERIAL IMPLICATION ATTRIBUTE IS INCLUDED
#
include "modules/material_attrib_expansion_module.rnc" inherit = ruleml {start |= notAllowed}
#
include "modules/mapmaterial_attrib_expansion_module.rnc" inherit = ruleml {start |= notAllowed}
#
# NON-DEFAULT VALUES OF MATERIAL IMPLICATION INCLUDED
#
include "modules/material_non-default_expansion_module.rnc" inherit = ruleml {start |= notAllowed}
#
# DEFAULT VALUES OF MATERIAL IMPLICATION INCLUDED
#
include "modules/material_default_expansion_module.rnc" inherit = ruleml {start |= notAllowed}
#
# OBJECT IDENTIFIERS INCLUDED
#
include "modules/oid_expansion_module.rnc" inherit = ruleml {start |= notAllowed}
#
# SLOTS INCLUDED
#
include "modules/slot_expansion_module.rnc" inherit = ruleml {start |= notAllowed}
#
# DEPENDENT SLOTS INCLUDED
#
include "modules/slotdep_expansion_module.rnc" inherit = ruleml {start |= notAllowed}
#
# SLOT CARDINALITY INCLUDED
#
include "modules/card_expansion_module.rnc" inherit = ruleml {start |= notAllowed}
#
# SLOT WEIGHTS INCLUDED
#
include "modules/weight_expansion_module.rnc" inherit = ruleml {start |= notAllowed}
#
# EXPLICIT TYPING OF TERMS INCLUDED
#
include "modules/type_expansion_module.rnc" inherit = ruleml {start |= notAllowed}
#
# DATA TERMS INCLUDED
#
include "modules/dataterm_any_expansion_module.rnc" inherit = ruleml {start |= notAllowed}
#
# DATA ELEMENTS INCLUDED
#
include "modules/data_any_content_expansion_module.rnc" inherit = ruleml {start |= notAllowed}
#
# SKOLEM CONSTANTS INCLUDED
#
include "modules/skolem_expansion_module.rnc" inherit = ruleml {start |= notAllowed}
#
# REIFICATION TERMS INCLUDED, EXPLICIT CONTENT
#
include "modules/reify_expansion_module.rnc" inherit = ruleml {start |= notAllowed}
#
# INDIVIDUAL TERMS (INTERPRETED NAMES) ARE INCLUDED
#
include "modules/individual_expansion_module.rnc" inherit = ruleml {start |= notAllowed}
#
# VARIABLES (INTERPRETABLE NAMES) ARE INCLUDED
#
include "modules/variable_expansion_module.rnc" inherit = ruleml {start |= notAllowed}
#
# IMPLICIT CLOSURE INCLUDED
#
include "modules/closure_expansion_module.rnc" inherit = ruleml {start |= notAllowed}
#
include "modules/mapclosure_expansion_module.rnc" inherit = ruleml {start |= notAllowed}
#
# SLOTTED REST VARIABLES INCLUDED
#
include "modules/resl_expansion_module.rnc" inherit = ruleml {start |= notAllowed}
#
# POSITIONAL REST VARIABLES INCLUDED
#
include "modules/repo_expansion_module.rnc" inherit = ruleml {start |= notAllowed}
#
# INITIALIZATION MODULES INCLUDED
#
include "modules/init_expansion_module.rnc" inherit = ruleml {start |= notAllowed}
#
# KEY/KEYREF ATTRIBUTES ENABLED
#
include "modules/key_expansion_module.rnc" inherit = ruleml {start |= notAllowed}
#
# STYLE ATTRIBUTE ENABLED
#
include "modules/attribute_expansion_module.rnc" inherit = ruleml {start |= notAllowed}

#
2 changes: 2 additions & 0 deletions relaxng/indep_valid_modules/slotdep_expansion_module.rnc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
include "../modules/slotdep_expansion_module.rnc"
include "../modules/init_expansion_module.rnc"
1 change: 1 addition & 0 deletions relaxng/modules/init_expansion_module.rnc
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ Fun-datt.choice |= notAllowed
Var-datt.choice |= empty
Ind-datt.choice |= empty
slot-datt.choice |= empty
slotdep-datt.choice |= empty
Data-datt.choice |= empty
Skolem-datt.choice |= empty
arg-datt.choice |= notAllowed
Expand Down
50 changes: 50 additions & 0 deletions relaxng/modules/slotdep_expansion_module.rnc
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
namespace dc = "http://purl.org/dc/elements/1.1/"
namespace dcterms = "http://purl.org/dc/terms/"

dcterms:title [ "RuleML Dependent Slots" ]
dcterms:identifier [ "http://deliberation.ruleml.org/1.03/relaxng/modules/slotdep_expansion_module.rnc" ]
dcterms:isPartOf [ "http://deliberation.ruleml.org/1.03/spec" ]
dcterms:creator [ "http://wiki.ruleml.org/index.php/User:Athant" ]
dc:subject [ "RuleML, dependent slot" ]
dcterms:description [ "The expansion module for dependent slots." ]
dcterms:language [ "en" ]
dc:rights [
'Copyright 2015 RuleML Inc. -- Licensed under the RuleML Specification License, Version 1.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://ruleml.org/licensing/RSL1.0-RuleML. Disclaimer: THIS SPECIFICATION IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, ..., EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. See the License for the specifics governing permissions and limitations under the License.'
]
dcterms:rights [ "http://ruleml.org/licensing/RSL1.0-RuleML" ]
dcterms:relation [ "http://deliberation.ruleml.org" ]
start |= slotdep.edge.def
# This module declares the following RuleML elements and attributes:
# * slotdep

## In atomic formulas, zero or more dependent slots are allowed.
slotdepTermsForAtoms.sequence |= slotdep-edge.choice*

## In expressions, zero or more dependent slots are allowed.
slotdepTermsForExpressions.sequence |= slotdep-edge.choice*

## an extension point for specializations of the slotdep tag name.
slotdep-edge.choice |= slotdep.edge.def
slotdep.edge.def =

## A user-defined slotdep (property). See http://deliberation.ruleml.org/1.03/glossary/#gloss-slotdep
element slotdep { slotdep.type.def }
slotdep.type.def = (slotdep-datt.choice & reslotdep.attlist), slotdep.content

## The slotdep element accepts optional cardinality and weight attributes.
reslotdep.attlist &= cardinality-att.choice?
reslotdep.attlist &= weight-att.choice?

## The slotdep content model consists of a key (first position) and a filler (second position).
slotdep.content |= slotdepKeyTerm.choice, slotdepFillerTerm.choice

## The key (first position) in a slotdep contains an interpreted term or data, which may be simple or compound.
slotdepKeyTerm.choice |= SimpleKeyTerm.choice | CompoundTerm.choice
# For the declaration of term patterns, see the term module (individual_expansion_module).

## The filler (second position) in a slotdep contains any single term.
slotdepFillerTerm.choice |= AnyTerm.choice
# For the declaration of term patterns, see the term module (individual_expansion_module).
edge.choice |= slotdep.edge.def
#
reslotdep.attlist &= commonInit.attlist?
43 changes: 43 additions & 0 deletions test/rnc-test-suites/datalogPSOA-test-suite/datalogPSOA.ruleml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="../../../relaxng/datalogPSOA_normal.rnc"?>
<RuleML xmlns="http://ruleml.org/spec" xmlns:this="http://example.org/datalogPSOA.ruleml"
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<!-- note the addition of the XML Schema namespace because a built-in datatype is used -->

<!-- a syntactic example rulebase for testing the Datalog PSOA RuleML sublanguage -->
<act index="1">
<Assert mapClosure="universal">

<formula>
<Implies node="this:#rule1">
<if>
<Atom>
<oid>
<Ind>John</Ind>
</oid>
<op>
<Rel>TA</Rel>
</op>
<slotdep>
<Ind>workload</Ind>
<Ind>high</Ind>
</slotdep>
</Atom>
</if>
<then>
<Atom>
<op>
<Rel>friend</Rel>
</op>
<slotdep>
<Ind>time</Ind>
<Data xsi:type="xs:dateTime">2001-10-26T21:32:52+02:00</Data>
</slotdep>
</Atom>
</then>
</Implies>
</formula>
</Assert>
</act>
</RuleML>

1 comment on commit 90c7c5b

@rimachaudhari
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.