W3C


RIF Core

W3C Editor's Draft 22 September21 November 2008

This version:
http://www.w3.org/2005/rules/wg/draft/ED-rif-core-20080922/http://www.w3.org/2005/rules/wg/draft/ED-rif-core-20081121/
Latest editor's draft:
http://www.w3.org/2005/rules/wg/draft/rif-core/
Previous version:
http://www.w3.org/2005/rules/wg/draft/ED-rif-core-20080922/ (color-coded diff)
Editors:
Harold Boley, National Research Council Canada
Gary Hallmark, Oracle Corporation
Michael Kifer, State University of New York at Stony Brook, USA
Adrian Paschke, TechnicalFree University DresdenBerlin
Axel Polleres, DERI
Dave Reynolds, HPHewlett-Packard Laboratories, Bristol UK


Abstract

This document, developed by the Rule Interchange Format (RIF) Working Group, specifies RIF-Core, a common subset of RIF-BLD and RIF-PRD based on RIF-DTB 1.0. The RIF-Core presentation syntax and semantics are specified.specified as restrictions on RIF-BLD. The XML serialization syntax of RIF-BLDRIF-Core is specified via a mapping from the presentation syntax. A normative XML schema is also provided.

Status of this Document

May Be Superseded

This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the latest revision of this technical report can be found in the W3C technical reports index at http://www.w3.org/TR/.

This document is being published as one of a set of 85 documents:

  1. RIF Use Cases and Requirements
  2. RIF Core (this document)
  3. RIF Basic Logic Dialect RIF Framework for Logic Dialects RIF RDF and OWL Compatibility RIFDatatypes and Built-Ins 1.0
  4. RIF Production Rule Dialect
  5. RIF (Rule Interchange Format) Test Cases

Please Comment By 2008-09-252008-11-25

The Rule Interchange Format (RIF) Working Group seeks public feedback on these Working Drafts. Please send your comments to public-rif-comments@w3.org (public archive). If possible, please offer specific changes to the text that would address your concern. You may also wish to check the Wiki Version of this document for internal-review comments and changes being drafted which may address your concerns.

No Endorsement

Publication as a Working Draft does not imply endorsement by the W3C Membership. This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress.

Patents

This document was produced by a group operating under the 5 February 2004 W3C Patent Policy. W3C maintains a public list of any patent disclosures made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains Essential Claim(s) must disclose the information in accordance with section 6 of the W3C Patent Policy.


Contents

1 Overview

This specification develops RIF-Core (the Core of the Rule Interchange Format). From a theoretical perspective, RIF-Core corresponds to the language of definite Horn rules without function symbols ('Datalog') and a standard first-order semantics. RIF-Core thus is a subset of RIF-BLD [ #***RIF-BLD]. At the same time, RIF-Core is a language of production rules permitting only assert actions. RIF-Core thus also is a subset of RIF-PRD [ #***RIF-PRD]. Moreover, RIF-Core is based on the built-ins of RIF-DTB 1.0 [ #***RIF-DTB]. The common subset of RIF-BLD and RIF-PRD is specified based on RIF-DTB 1.0.

Syntactically, RIF-Core has a number of Datalog extensions to support features such as objects and frames as in F-logic [KLW95], internationalized resource identifiers (or IRIs, defined by [RFC-3987]) as identifiers for concepts, and XML Schema datatypes [XML-SCHEMA2]. In addition, RIF RDF and OWL Compatibility [RIF-RDF+OWL] defines the syntax and semantics of integrated RIF-Core/RDF and RIF-Core/OWL languages. These features make RIF-Core a Web-aware language. However, it should be kept in mind that RIF is designed to enable interoperability among rule languages in general, and its uses are not limited to the Web.

RIF-Core is defined in two different ways -- both normative :as a direct specification, independently of [ RIF-FLD ], RIF-BLD, and RIF-PRD for the benefit of those who desire a direct definition of RIF-Core, e.g., as prospective implementers. This version of the RIF-Core specification is given first. As specializationsspecialization of RIF-BLD (hence of [RIF-FLD ]) and of RIF-PRD,] which is part of the RIF extensibility framework. Building on RIF-BLD and RIF-PRD, these versionsframework). It is a syntactic subset of theRIF-BLD, so that a well-formed RIF-Core specification are comparatively short and are presented in Sections #***formula (including documents and #*** atcondition formula) is also a well-formed RIF-BLD formula. The endsemantics of this document. ThisRIF-Core is intended for the reader whodefined to be identical to that of RIF-BLD.

RIF-Core is already familiar with either RIF-BLD oralso a syntactic subset of RIF-PRD. It is intended that a RIF-PRD consumer can treat a RIF-Core ruleset as if it were a RIF-PRD rule set and does not needit would conform to go throughthe much longer direct specificationnormative RIF-Core first order semantics. However, due to the presence of RIF-Core. These sectionsbuiltin functions and predicates there are also useful for dialect designers, as theyRIF-Core rulesets which are concrete examples of howunsafe and do not reach a RIF dialect canstable fixed-point under RIF-PRD semantics. We define the conformance to RIF-Core so as to only require conformance over a safe subset of rules, in this way we permit RIF-PRD processors to be derived from other dialects.safely conformant while allowing RIF-Core documents to contain unsafe rules. Producers of RIF-Core who require maximum interchange are advised to restrict themselves to safe rules. These notions of safeness and safe conformance are defined formally in section 5 Conformance and Safety.

To give a preview, here is a simple complete RIF-Core example deriving a ternary relation from its inverse.

Example 1 (An introductory RIF-Core example).

A rule can be written in English to derive the buy relationships (rather than store them) from the sell relationships that are stored as facts (e.g., as exemplified by the English statement below):

The fact Mary buys LeRif from John can be logically derived by a modus ponens argument. Assuming Web IRIs for the predicates buy and sell, as well as for the individuals John, Mary, and LeRif, the above English text can be represented in RIF-Core Presentation Syntax as follows.

Document(
  Prefix(cpt http://example.com/concepts#)
  Prefix(ppl http://example.com/people#)
  Prefix(bks http://example.com/books#)

  Group
  (
    Forall?Buyer?Item?Seller (
        cpt:buy(?Buyer?Item?Seller):- cpt:sell(?Seller?Item?Buyer)
    )
 
    cpt:sell(ppl:John bks:LeRif ppl:Mary)
  )
)

For the interchange of such rule (and fact) documents, an equivalent RIF-Core XML Syntax is given in this specification. To formalize their meaning, a RIF-Core Semantics is specified.

2 Direct Specification ofRIF-Core Presentation Syntax

2.1 Alphabet of RIF-Core 2.2 EBNF Grammar for theRIF-BLD [RIF-BLD] specifies a presentation syntax of RIF-Core Until now, we have used mathematical English to specifyand an XML syntax. The presentation syntax of RIF-Core. Tool developers, however, may prefer EBNF notation, which providesis normative, but is not intended to be a more succinct overview of theconcrete syntax. Several points should be keptSince RIF is an interchange format, it uses XML as its concrete syntax.

RIF-Core is a syntactic subset of RIF-BLD and in mind regardingthis notation. 2.2.1 EBNF forsection we define it as a restriction on the Condition LanguageRIF-BLD syntax.

2.1 Alphabet of RIF-Core

The Condition Language represents formulas that can be used inalphabet of the premisespresentation language of RIF-Core rules (also called rule bodies).is the EBNF grammar for a supersetalphabet of the RIF-Core conditionRIF-BLD presentation language is as follows. Editor's Note: Stylistic comment only. Please could we just have one section forwith the combined condition and rule languageexclusion of the symbol ## and just talk aboutthe set of symbols ArgNames.

ISSUE: Did we really decide that ## cannot occur at all or that it can occur only in the rule language?bodies?

2.2 Terms of RIF-Core

The valueTerms of separating outRIF-Core are the condition language for reuse seems to primarily apply to FLD. Separating condition/rule syntax makes it harder to read and duplicatingterms of RIF-BLD with the condition part afterexclusion of terms with named arguments, subclass terms, and external terms of the rule partform External(fr), where fr is not entirely satisfying. Dave FORMULA ::= IRIMETA? 'And' '(' FORMULA* ')' | IRIMETA? 'Or' '(' FORMULA* ')' | IRIMETA? 'Exists' Var+ '(' FORMULA ')' | ATOMIC | IRIMETA? 'External' '(' Atom | Frame ')' ATOMIC ::= IRIMETA? (Atom | Member | Subclass | Frame) Atom ::= UNITERM UNITERM ::= Const '(' (TERM* | (Name '->' TERM)*) ')' Member ::= TERM '#' TERM Subclass ::= TERM '##' TERMa frame ::= TERM '[' (TERM '->' TERM)* ']' TERM ::= IRIMETA? (Const | Var) Const ::= '"' UNICODESTRING '"^^' SYMSPACE | CONSTSHORT Name ::= UNICODESTRING Var ::= '?' UNICODESTRING SYMSPACE ::= ANGLEBRACKIRI | CURIE IRIMETA ::= '(*' IRICONST? (Frame | 'And' '(' Frame* ')')? '*)'term.

Editor's Note: There was concern over disjunction and NAU, weaker concern over member and subclass. So a conservative versionThis presumes that the At Risk #1 feature External frames is as below. I realize you did qualifyretained in RIF-BLD. If that is not the case the above will need updating.

2.3 Formulas of RIF-Core

The Formulas of the RIF-Core are the formulas of RIF-BLD with the following modifications.


ISSUE: What was decided about external functions?


2.4 Annotations and documents

RIF-Core allows every term ::= IRIMETA? (Const | Var) Const ::= '"' UNICODESTRING '"^^' SYMSPACE | CONSTSHORT Name ::= UNICODESTRING Var ::= '?' UNICODESTRING SYMSPACE ::= ANGLEBRACKIRI | CURIE IRIMETA ::= '(*' IRICONST? (Frame | 'And' '(' Frame* ')')? '*)'and formula to be optionally annotated in the production rule forsame way as RIF-BLD. The non-terminal FORMULA represents RIF conditionframe formulas (defined earlier). The connectives And and Or define conjunctions and disjunctionsthat are allowed as part of conditions, respectively. Exists introduces existentially quantified variables. Here Var+ standsan annotation must be syntactically correct for the list of variables thatRIF-Core. In particular, no function symbols are freeallowed in FORMULA . RIF-Core conditions permit only existential variables.such a formula.

2.5 Well-formed formulas

A syntactically correct RIF-Core formula canthat passes the well-formedness test for RIF-BLD is also a well-formed RIF-Core formula. In this case, it simply means that

For rif:local symbols, the positionsfirst three of object Ids, object properties, and property values. For brevity, we usethe CURIE shortcut notation prefix:suffix for constant symbols, which is understood asabove clauses apply only within the scope of a macrosingle document. That expands into an IRI obtained by concatenationis, two different occurrences of the prefix definition and suffix . Thus, if bks is a prefix that expands into http://example.com/books# then bks:LeRif is an abbreviation for "http://example.com/books#LeRif"^^rif:iri . Thissame rif:local symbol in different documents may have different arities, may occur both as predicates and individuals, etc. For other shortcuts are defined in [ RIF-DTB ]. Assumesymbols, the above restrictions apply not only to the document that contains the following prefix directives appear inparticular occurrence of the preamblesymbol, but also to the document: Prefix(bks http://example.com/books#) Prefix(auth http://example.com/authors#) Prefix(cpt http://example.com/concepts#) Positional terms: cpt:book(auth:rifwg bks:LeRif) Exists?X (cpt:book(?X bks:LeRif)) Terms with named arguments: cpt:book(cpt:author->auth:rifwg cpt:title->bks:LeRif) Exists?X (cpt:book(cpt:author->?X cpt:title->bks:LeRif)) Frames: bks:wd1[cpt:author->auth:rifwg cpt:title->bks:LeRif] Exists?X (bks:wd2[cpt:author->?X cpt:title->bks:LeRif]) Exists?X (And (bks:wd2#cpt:book bks:wd2[cpt:author->?X cpt:title->bks:LeRif])) Exists?I?X (?I[cpt:author->?X cpt:title->bks:LeRif]) Exists?I?X (And (?I#cpt:book?I[cpt:author->?X cpt:title->bks:LeRif])) Exists?S (bks:wd2[cpt:author->auth:rifwg?S->bks:LeRif]) Exists?X?S (bks:wd2[cpt:author->?X?S->bks:LeRif]) Exists?I?X?S (And (?I#cpt:book ?I[author->?X?S->bks:LeRif])) 2.2.2all documents that are imported by that document.


2.6 EBNF Grammar for the Rule Language ThePresentation Syntax forof RIF-Core rules extends(Informative)

Until now, we have used mathematical English to specify the syntax of RIF-Core as a restriction on RIF-BLD. Tool developers, however, may prefer EBNF notation, which provides a more succinct overview of the syntax. However, note that EBNF is unable to express all of the above well-formedness conditions, in particular the requirement that each symbol appear in only one context. For this reason this section is not Normative.

The EBNF for the RIF-Core Condition Language withpresentation syntax is given as follows, showing the following productions.entire (top-down) context of its three parts for rules, conditions, and annotations.

Rule Language:

  Document      ::= IRIMETA? 'Document' '(' Base? Prefix* Import* Group? ')'
  Base          ::= 'Base' '(' IRI ')'
  Prefix        ::= 'Prefix' '(' Name IRI ')'
  Import        ::= IRIMETA? 'Import' '(' IRICONST PROFILE? ')'
  Group         ::= IRIMETA? 'Group' '(' (RULE | Group)* ')'
  RULE          ::= (IRIMETA? 'Forall' Var+ '(' CLAUSE ')') | CLAUSE
  CLAUSE        ::= Implies | ATOMIC
  Implies       ::= IRIMETA?  (ATOMIC | 'And' '(' ATOMIC* ')')ATOMIC  ':-' FORMULA
  PROFILE       ::= TERM

Editor's Note: PRD only permits Atom and Frame in the head so if member/subclass are retained in ATOMIC this needs modification. PRD/BLD syntactic intersection currently only works for one ASSERT in head, not with And. So PRD compatible version seems be as below. Dave DocumentCondition Language:

  FORMULA       ::= IRIMETA?  'Document' '(' Base? Prefix* Import* Group? ')' Base ::= 'Base' '(' IRI ')' Prefix ::= 'Prefix''And' '('  Name IRIFORMULA* ')'  Import ::=|
                     IRIMETA?  'Import''Or' '('  IRICONST PROFILE?FORMULA* ')'  Group ::= IRIMETA? 'Group' '(' (RULE|
                      Group)* ')' RULE ::= (IRIMETA? 'Forall'IRIMETA? 'Exists' Var+ '('  CLAUSE ')')FORMULA ')' |
                      CLAUSE CLAUSE ::= ImpliesATOMIC |
                     IRIMETA? Equal |
                     IRIMETA? Member |
                     IRIMETA? 'External' '(' Atom ')'
  ATOMIC         Implies::= IRIMETA? (Atom | Frame )
   ':-' FORMULA PROFILEAtom          ::= UNITERM
  UNITERM       ::= Const '(' (TERM* ')'
  Equal         ::= TERM  Recall that an IRI has'=' TERM
  Member        ::= TERM '#' TERM
  Frame         ::= TERM '[' (TERM '->' TERM)* ']'
  TERM          ::= IRIMETA? (Const | Var  | 'External' '(' Atom ')' )
  Const         ::= '"' UNICODESTRING '"^^' SYMSPACE | CONSTSHORT
  Name          ::= UNICODESTRING
  Var           ::= '?' UNICODESTRING
  SYMSPACE      ::= ANGLEBRACKIRI | CURIE

Annotations:

  IRIMETA       ::= '(*' IRICONST? (Frame | 'And' '(' Frame* ')')? '*)'

The form of an internationalized resource identifier as defined by [ RFC-3987 ]. A RIF-Core Document consists of an optional Base , followed by any number of Prefix es, followed by any number of Import s, followed by an optional Group . Basefollowing subsections explain and Prefix serve as shortcut mechanisms for IRIs. An Import indicatesexemplify the location of a document to be importedCondition Language and an optional profile. A RIF-Core Group is a collection of any number of RULE elements along with any number of nested Group s. Rules are generated using CLAUSE elements. TheRule production has two alternatives: InLanguage parts; the first, a CLAUSEAnnotations part is inunchanged from RIF-BLD.

2.6.1 EBNF for the scope ofRIF-Core Condition Language

The Forall quantifier. InRIF-Core Condition Language represents formulas that case, all variables mentioned in CLAUSE are required to also appear among the variables in the Var+ sequence.can be used in the second alternative, CLAUSE appears on its own. In that case, CLAUSE cannot have variables. Frame , Var , ATOMIC , and FORMULA were defined as partpremises of RIF-Core rules (also called rule bodies). The syntax for positive conditions in SectionEBNF grammar for a superset of the RIF-Core condition language .is shown in the CLAUSE production, an ATOMIC is what is usually called a factabove conditions part.

An Implies rule can have an ATOMIC orThis is a conjunctionsubset of ATOMIC elements as its conclusion; it has a FORMULA as its premise. Note that, by a definitionthe EBNF for the RIF-BLD condition language specified in Section Formulas , formulas that query externally defined atoms (i.e., formulas ofRIF-BLD conditions part reflecting the form External(Atom(...)) ) are not allowedsyntax restrictions on RIF-Core described normatively in sections 2.1 through 2.5 above.

The conclusion part of a rule ( ATOMIC does not expand to External ). Example 3 (RIF-Core rules). ThisExample shows a business rule borrowed2 from the RIF-BLD document RIF Use Cases and Requirements : If an item is perishable and it is delivered to John more than 10 days afterillustrates a RIF-Core condition.


2.6.2 EBNF for the scheduled delivery date thenRIF-Core Rule Language

The item will be rejected by him. As before,presentation syntax for better readability we useRIF-Core rules is based on the compact URI notation definedsyntax in [ RIF-DTB ],Section Constants and Symbol Spaces . Again, prefix directives are assumed inEBNF for RIF-Core Condition Language with the preamble toproductions shown in the document. Then, two versionsabove rules part.

Again, this is a subset of the mainEBNF for the RIF-BLD rule language specified in RIF-BLD rules part ofreflecting the syntax restrictions on RIF-Core described normatively in sections 2.1 through 2.5 above.

Example 3 from the RIF-BLD document are given. Prefix(ppl http://example.com/people#) Prefix(cpt http://example.com/concepts#) Prefix(func http://www.w3.org/2007/rif-builtin-function#) Prefix(pred http://www.w3.org/2007/rif-builtin-predicate#) a. Universal form: Forall?item?deliverydate?scheduledate?diffduration?diffdays ( cpt:reject(ppl:John?item):- And(cpt:perishable(?item) cpt:delivered(?item?deliverydate ppl:John) cpt:scheduled(?item?scheduledate) ***replace with equality-less version***?diffduration = External(func:subtract-dateTimes(?deliverydate?scheduledate)) ***replace with equality-less version***?diffdays = External(func:days-from-duration(?diffduration)) External(pred:numeric-greater-than(?diffdays 10))) ) b. Universal-existential form: Forall?item ( cpt:reject(ppl:John?item ):- Exists?deliverydate?scheduledate?diffduration?diffdays ( And(cpt:perishable(?item) cpt:delivered(?item?deliverydate ppl:John) cpt:scheduled(?item?scheduledate) ***replace with equality-less version***?diffduration = External(func:subtract-dateTimes(?deliverydate?scheduledate)) ***replace with equality-less version***?diffdays = External(func:days-from-duration(?diffduration)) External(pred:numeric-greater-than(?diffdays 10))) ) )illustrates a set of RIF-Core rules and Example 4 (Aa RIF-Core document containingthat contains an annotated group). Thisgroup formula. In contrast, the Example shows a complete6 from the RIF-BLD document containingshows a groupformula that consists of twois not in RIF-Core rules.because it includes terms with named arguments, which are not allowed in this dialect.


3 RIF-Core Semantics

RIF-Core is a syntactic subset of RIF-BLD and the firstsemantics of these rulesRIF-Core is copied from Example 3a.identical that of RIF-BLD.


4 XML Serialization Syntax for RIF-Core

The groupXML syntax of RIF-Core is annotated with an IRI identifier and frame-represented Dublin Core metadata. Document( Prefix(ppl http://example.com/people#) Prefix(cpt http://example.com/concepts#) Prefix(dc http://purl.org/dc/terms/) Prefix(func http://www.w3.org/2007/rif-builtin-function#) Prefix(pred http://www.w3.org/2007/rif-builtin-predicate#) Prefix(xs http://www.w3.org/2001/XMLSchema#) (* "http://sample.org"^^rif:iri pd[dc:publisher -> http://www.w3.org/ dc:date -> "2008-04-04"^^xs:date] *) Group ( Forall?item?deliverydate?scheduledate?diffduration?diffdays ( cpt:reject(ppl:John?item):- And(cpt:perishable(?item) cpt:delivered(?item?deliverydate ppl:John) cpt:scheduled(?item?scheduledate) ***replace with equality-less version***?diffduration = External(func:subtract-dateTimes(?deliverydate?scheduledate)) ***replace with equality-less version***?diffdays = External(func:days-from-duration(?diffduration)) External(pred:numeric-greater-than(?diffdays 10))) ) Forall?item ( cpt:reject(ppl:Fred?item):- cpt:unsolicited(?item) ) ) ) 3 Direct Specificationa subset of RIF-Core Semantics 4 XML Serialization Syntax for RIF-Corethe RIF-CoreXML serialization defines a normative mapping from the RIF-Core presentationsyntax toof RIF-BLD. All XML (Section Mapping fromtags of RIF-BLD are supported, but the Presentation SyntaxXML schema of RIF-Core restricts their context with respect to what is allowed by the XML Syntax ), and a normative XMLSchema forof RIF-BLD. The semantics of the XML syntax (Appendix XML Schemafor Core ). Recall that the syntax ofRIF-Core is defined through the same RIF-BLD XML-to-presentation syntax mapping.

ISSUE: sub might not context-free and thus cannot be fully captured by EBNF or XML Schema. Still, validity with respect to XML Schema canbe a useful test. To reflectallowed. This state of affairs, we define two notionsdepends on the resolution of syntactic correctness.the weaker notion checks correctness only with respect to XML Schema, whileissue regarding the stricter notion represents "true" syntactic correctness. Definition (Valid Core document insubclass relationship.

Example 5, "A RIF condition and its XML syntax). A valid Core documentserialization," in the XML syntax is an XMLRIF-BLD document that is valid with respect to the XML schema in Appendixillustrates XML Schemaserialization for Core . Definition (Conformant Core document in XML syntax).a conformant Core document in theRIF-Core condition formula. XML syntax isserialization of a valid Corecomplete RIF-Core document appears in the XML syntax thatRIF-BLD document as Example 7.


5 Conformance and Safety

RIF-Core is a syntactic subset of both RIF-BLD and RIF-PRD. The imagesemantics of a well-formedRIF-Core document in the presentation syntax (see Definition Well-formedformula is the same as in SectionRIF-BLD.

All RIF-Core documents are syntactically also RIF-PRD documents. However, some formulas )may be unsafe and cannot be executed under the presentation-to-XML syntax mapping core definedRIF-PRD operational semantics. Thus, in Section Mapping from the Presentation Syntaxorder to allow production rule systems and logic programming systems to interchange rulesets via RIF-Core, we define a safe subset of RIF-Core and the XML Syntax . The XML serialization fornotion of safely conformant RIF-Core is alternatingconsumers or fully striped [ ANF01 ].producers. A fully striped serialization views XMLsafely conformant RIF-Core consumer can reject non-safe RIF-Core documents as objects and divides all XML tags into class descriptors, called type tags , and property descriptors, called role tags [ TRT03 ]. We followeven if they are otherwise well-formed. The traditionnotion of using capitalized names for type tags(general) conformance allows RIF-Core producers and lowercase names for role tags. The all-uppercase classes in the presentation syntax, such as FORMULA , become XML Schema groups in Appendix XML Schemaconsumers to produce and consume unsafe rulesets. For safe Core . They act like macrosdocuments, the logical semantics of RIF-BLD and are not visibleoperational fixed-point semantics of RIF-PRD coincide. In instance markup.the other classes as well as non-terminalsabsence of the data types and symbols (such as Exists or = ) become XML elements with optional attributes, as shown below. RIF-Core usesbuilt-ins, this follows from [ XML1.0 ] for its XML syntax. 4.1 XML for the Condition Language XML serializationVianu97].

5.1 Safeness

A subformula of RIF-Core in Section EBNF fora RIF-Core condition Language uses the following elements. - And (conjunction) - Or (disjunction) - Exists (quantified formula for 'Exists', containing declare and formula roles) - declare (declare role, containing a Var) -formula (formula role, containing a FORMULA) - Atom (atom formula, positional or with named arguments) -is called an external (external call, containing a content role) - content (content role, containingsubformula if it appears within an Atom) - Member (member formula) - Subclass (subclass formula) - Frame (Frame formula) - object (Member/Frame role, containingExternally defined term. A TERM or an object description) - op (Atom role for predicates/functions as operations) - args (Atom positional arguments role, with fixed 'ordered' attribute, containing n TERMs) - instance (Member instance role) - class (Member class role) - sub (Subclass sub-class role) - super (Subclass super-class role) - slot (Atom or Frame slot role, with fixed 'ordered' attribute, containingsubformula of a Name or TERM followed bycondition formula is called disjunctive subformula if it appears within a TERM) - Const (individual, function, or predicate symbol, with optional 'type' attribute) - Name (name of named argument) - Var (logic variable) - id (identifier role, containing IRICONST) - meta (meta role, containing metadata asDisjunction.

Definition (Safeness).

   key n -> filler n ] <Frame> <id> core ( iriconst )</id> ? <meta> core ( frameconj )</meta> ? <object> core ( inst )</object> <slot ordered="yes"> coreISSUES: The above is very unclear. What is a non-disjunctive atomic subformula?? ( key 1see above definition of a disjunctive subformula)  coreAn atomic formula is also non disjunctive. And it does not have quantifiers. What is  ( fillerfixed)? 
  • A RIF condition formula is called safe if all its variables are safe with respect to and for all its existential subformulas Exists?V1 ) </slot> . . . <slot ordered="yes"> core ( key...?Vn ) core( filler n) </slot> </Frame> (* iriconst? frameconj? *) e 1 $ e 2 < Binop > <id> core ( iriconst )</id> ? <meta> core ( frameconj )</meta> ? e 1 ' e 2 ' </ Binop > where Binop , eeach ?V1 ' , e 2 '... ?Vn is safe with respect to .
  • A RIF rule implication :- is called safe if all its variables are defined bysafe with respect to .
  • A RIF Universal rule implication Forall?V1 ...?Vn () is called safe if the equation core ( e 1 $ e 2 ) = < Binop > e 1 ' e 2 ' </ Binop > (* iriconst? frameconj? *) unicodestring ^^ symspace <Const type=" symspace "> <id> core ( iriconst )</id> ? <meta> core ( frameconj )</meta> ? unicodestring </Const> (* iriconst? frameconj? *) ? unicodestring <Var> <id> core ( iriconst )</id> ? <meta> core ( frameconj )</meta> ? unicodestring </Var> 5implication is safe.
  • A RIF Universal fact Forall?V1 ...?Vn () is safe if contains no variables.

5.2 Conformance Clauses

RIF-Core does not require or expect conformant systems to implement the RIF-Core presentation syntax. Instead, conformance is described in terms of semantics-preserving transformations.

Let be a set of datatypes that includes the datatypes specified in [RIF-DTB], and suppose is a set of external predicates and functions that includes the built-ins listed in [RIF-DTB]. We say that a formula is a Core, formula iff

  • it is a well-formed Core formula,
  • all the datatypes used in are in , and
  • all the externally defined functions and predicates used in are in .

A RIF processor is a conformant Core, consumer iff it implements a semantics-preserving mapping, ,mapping from the set of all Core , formulas to the language L of the processor. Formally, this means that for any pair , of Core , formulas for which |= Core is defined, |= Core iff () |= L (). Here |= Core denotes the logical entailment in RIF-Core and |= L is the logical entailment inset of all Core, formulas to the language L of the RIFprocessor.

A RIF processor is a conformant Core, producer iff it implements a semantics-preserving mapping, ,mapping from a subset of the language L of the processor to a set of Core, formulas.

Formally, this means that for any pair , of formulas in the aforesaid subset of L for which |= L is defined, |= L iff () |= Core ().A conformant document is one whichthat conforms to all the syntactic constraints of RIF-Core, including ones that cannot be checked by an XML Schema validator (cf. Definition Conformant Core document in XML syntax ). A round-tripping of a conformant Core document is its semantics-preserving mapping to a document in any language L followed by a semantics-preserving mapping from the L document back to a conformant Coredocument. While semantically equivalent, the original and the round-tripped Core documents need not be identical. Metadata should survive Core round-tripping. The above definitions are specializations to Core of the general conformance clauses definedvalidator.

In the RIF framework for logic dialects [ RIF-FLD ]. The following clauses are further restrictions that are specific to RIF-Core. RIF-Core specific clausesaddition:

  • A conformant RIF-Core consumer is a conformant Core, consumer in which consists only of the datatypes and consists only of the externally defined functions and predicates that are required by RIF-Core. These datatypes and externally defined terms (called built-ins) are specified in [RIF-DTB]. A conformant RIF-Core consumer must reject all inputs that do not match the syntax of Core. If it implements extensions, it may do so under user control -- having a "strict Core""strict Core" mode and a "run-with-extensions""run-with-extensions" mode.
  • A conformant Core producer is a conformant Core, producer, which produces documents that include only the datatypes and externals that are required by Core.

Feature At Risk #3: Strictness Requirement

Note: This feature is "at risk""at risk" and may be removed from this specification based on feedback. Please send feedback to public-rif-comments@w3.org.

The two preceding clauses are features AT RISK. In particular, the "strictness""strictness" requirement is under discussion.

Since such a consumer/producer might not preserve entailment of unsafe condition formulas, it might not be Core-conformant in parentheses are under discussion.the alternativemore general sense defined earlier. Thus, safe conformance is built-in predicate calls. See the annotations in the table of the section on "Intersection of RIF-PRD and RIF-BLD". 7a weaker requirement than (general) conformance.


6 RIF-Core as a Specialization of RIF-PRD

This normative section describes RIF-Core by specializing RIF-PRD . The reader is assumed to be familiar with RIF-PRD as described in [ #***RIF-PRD]. The reader who is not interested in how RIF-Core is derived from PRD can skip this section.

7.16.1 Intersection of RIF-PRD and RIF-BLD

RIF-PRD and RIF-BLD share essentially the same presentation syntax and XML syntax.

The differences between the two dialects are summarized below:

  • RIF-BLD allows logic and externally specified, fixed-interpretation functions as TERM, whereas RIF-PRD accepts only externally specified functions;
  • RIF-BLD allows ATOMIC or And(ATOMIC*) in rule conclusions, whereas RIF-PRD allows ACTION or Do(ACTION*). In RIF-PRD it is not possible to conclude equality or class membership.
  • RIF-PRD allows Not(FORMULA), which RIF-BLD does not accept;
  • RIF-PRD defines ASSERT and Retract actions that are not allowed in RIF-BLD.
  • RIF-PRD introduces a pattern matching constraint in Forall

For context, the table below lists the constructs which are in the maximal common subset (intersection) of BLD and PRD, marks certain rows as not being in Core, or annotates them w.r.t. restrictions making them part of Core.

Presentation syntax XML syntax
TERM::=
Core
[Const | Var | External]
Const::=
Core
 '"''"' UNICODESTRING  '"^^''"^^' SYMSPACE
<Const type=xsd:anyURI [xml:lang=xsd:language]? >
   Any Unicode string
</Const>
Var::=
Core
'?' Any Unicode string
<Var>
   Any Unicode string
</Var>
External (as TERM)::= Remark: only used for external built-in calls; no logical functions
Core
'External' '(' Expr ')'
<External>
   <content>
      Expr
   </content>
</External>
ATOMIC::=
Remark: Equal, Member, Subclass are under discussion to be included in Core or notCore
[Atom |  Equal | Member | Subclass |Frame]
Atom::=
Remark: likely no named arguments in RIF, but only positional argumentsCore
Const '(' (TERM*  | (Name '->' TERM)*)')'
<Atom>
   <op> Const </op>
     [<args  rif:ordered="yes">rif:ordered="yes"> TERM* </args>?
 | <slot rif:ordered="yes"> <Name> Any Unicode string </Name> TERM </slot>* ]</Atom>
Equal::=
Remark: under discussion; restricted equality only needed for single-assigning values of external built-in function calls to logic variablesCore
TERM = TERM
<Equal>
   <left> TERM </left>
   <right> TERM </right>
</Equal>
Member::= Remark: under discussion; might be not part of Core
Core
TERM # TERM
<Member>
   <instance> TERM </instance>
   <class> TERM </class>
</Member>
Subclass::= Remark: under discussion; might be not part of Core Core TERM ## TERM <Subclass> <sub> TERM </sub> <super> TERM </super> </Subclass>Frame::=
Remark: under discussion; Core might have frames and user predicates plus built-in predicates, or frames and built-in predicates, or frames, user predicates, and built-in functions (with restricted equality), or frames and built-in functions (with restricted equality)Core
TERM ' [ ' (TERM ' -> ' TERM)* ' ] '
<Frame>
   <object> TERM </object>
   <slot  rif:ordered="yes">rif:ordered="yes"> TERM TERM </slot>*
</Frame>
FORMULA::=
Remark: Disjunctions in the body and conjunctions in the head might not be part of Core.Core
[ATOMIC | External | And | Or | Exists]
External (as FORMULA)::=
Core
'External '(' [Atom | Frame] ')'
<External>
   <content>
      [ Atom | Frame ]
   </content>
</External>
And::=
Core
'And' '(' FORMULA* ')'
<And>
   <formula> FORMULA </formula>*
</And>
Or::=
Remark: Disjunctions in the body might be not part of CoreCore
'Or' '(' FORMULA* ')'
<Or>
   <formula> FORMULA </formula>*
</Or>
Exists::=
Core
'Exists' Var+ '(' FORMULA ')'
<Exists>
   <declare> Var </declare>+
   <formula> FORMULA </formula>
</Exists>
RULE::= Remark: There is an implicit assert assumption for production rules
Core
[ Forall | Implies | ATOMIC ]
Forall::= Remark: There is an implicit assert assumption for production rules
Core
' Forall ' Var+ ' ( ' [Implies | ATOMIC] ' ) '
<Forall>
   <declare> Var </declare>+
   <formula>
       [Implies | ATOMIC ] 
   </formula>
</Forall>
Implies::= Remark: There is an implicit assert assumption for production rules;
there might be no conjunction in the headCore
 (ATOMIC | 'And' '(' ATOMIC* ')')ATOMIC '=>' FORMULA
<Implies>
   <if> FORMULA </if>
   <then>
       [ ATOMIC | <And> <formula>ATOMIC
    </formula>* </And> ]</then>
</Implies>
Group::=
Core
METADATA? 'Group' '(' ([RULE | Group])* ')'
<Group>
   <sentence> [ RULE | Group ] </sentence>*
</Group>
Core
METADATA? 'Document' '(' Group? ')'
<Document>
  <payload> Group </payload>?
</Document>
METADATA::=
Core
'(*' Const? (Frame | 'And' '(' Frame* ')')? '*)'
<AnyClassTag>
   <id> Const </declare>?
   <meta>
      [ Frame 
        |
        <And>
           <formula> Frame </formula>
        </And>
       ]
   </meta>?
   other content of AnyClassTag
</AnyClassTag>

87 Acknowledgements

This document is the product of the Rules Interchange Format (RIF) Working Group (see below) whose members deserve recognition for their time and commitment. The editors extend special thanks to: ***, for their thorough reviews and insightful discussions; the working group chairs, Chris Welty and Christian de Sainte-Marie, for their invaluable technical help and inspirational leadership; and W3C staff contact Sandro Hawke, a constant source of ideas, help, and feedback.


The regular attendees at meetings of the Rule Interchange Format (RIF) Working Group at the time of the publication were: Adrian Paschke (REWERSE), Axel Polleres (DERI), Chris Welty (IBM), Christian de Sainte Marie (ILOG), Dave Reynolds (HP), Gary Hallmark (ORACLE), Harold Boley (NRC), Hassan Aït-KaciAït-Kaci (ILOG), Igor Mozetic (JSI), John Hall (OMG), Jos de Bruijn (FUB), Leora Morgenstern (IBM), Michael Kifer (Stony Brook), Mike Dean (BBN), Sandro Hawke (W3C/MIT), and Stella Mitchell (IBM). We would also like to thank *** past members of the working group, ***.

98 References

9.18.1 Normative References

[RDF-CONCEPTS]
Resource Description Framework (RDF): Concepts and Abstract Syntax, Klyne G., Carroll J. (Editors), W3C Recommendation, 10 February 2004, http://www.w3.org/TR/2004/REC-rdf-concepts-20040210/. Latest version available at http://www.w3.org/TR/rdf-concepts/.

[RFC-3066]
RFC 3066 - Tags for the Identification of Languages, H. Alvestrand, IETF, January 2001. This document is http://www.isi.edu/in-notes/rfc3066.txt.

[RFC-3987]
RFC 3987 - Internationalized Resource Identifiers (IRIs), M. Duerst and M. Suignard, IETF, January 2005. This document is http://www.ietf.org/rfc/rfc3987.txt.

[RIF-BLD]
RIF Basic Logic Dialect Harold Boley, Michael Kifer, eds., Boley H. and Kifer M. (Editors), W3C Editor's Draft, 22 September 2008, http://www.w3.org/2005/rules/wg/draft/ED-rif-bld-20080922/ .Rule Interchange Format Working Group Draft. Latest Version available at http://www.w3.org/2005/rules/wg/draft/rif-bld/http://www.w3.org/2005/rules/wiki/BLD.

[RIF-DTB]
RIF Datatypes and Built-Ins 1.0 Axel Polleres, Harold Boley, Michael Kifer, eds. W3C Editor's Draft, 22 September21 November 2008, http://www.w3.org/2005/rules/wg/draft/ED-rif-dtb-20080922/http://www.w3.org/2005/rules/wg/draft/ED-rif-dtb-20081121/. Latest version available at http://www.w3.org/2005/rules/wg/draft/rif-dtb/.

[RIF-FLD]
RIF Framework for Logic Dialects Harold Boley, Michael Kifer, eds., Boley H. and Kifer M. (Editors), W3C Editor's Draft, 22 September 2008, http://www.w3.org/2005/rules/wg/draft/ED-rif-fld-20080922/ .Rule Interchange Format Working Group Draft. Latest Version available at http://www.w3.org/2005/rules/wg/draft/rif-fld/http://www.w3.org/2005/rules/wiki/FLD.

[RIF-RDF+OWL]
RIF RDF and OWL Compatibility Jos, de Bruijn, J. (Editor), W3C Rule Interchange Format Working Group Draft. Latest Version available at http://www.w3.org/2005/rules/wiki/SWC.

[RIF-PRD]
RIF Production Rule Dialect Christian de Sainte Marie, Adrian Paschke, Gary Hallmark, eds. W3C Editor's Draft, 22 September21 November 2008, http://www.w3.org/2005/rules/wg/draft/ED-rif-rdf-owl-20080922/http://www.w3.org/2005/rules/wg/draft/ED-rif-prd-20081121/. Latest version available at http://www.w3.org/2005/rules/wg/draft/rif-rdf-owl/http://www.w3.org/2005/rules/wg/draft/rif-prd/.

[XML1.0]
Extensible Markup Language (XML) 1.0 (Fourth Edition), W3C Recommendation, World Wide Web Consortium, 16 August 2006, edited in place 29 September 2006. This version is http://www.w3.org/TR/2006/REC-xml-20060816/.

[XML-Base]
XML Base, W3C Recommendation, World Wide Web Consortium, 27 June 2001. This version is http://www.w3.org/TR/2001/REC-xmlbase-20010627/. The latest version is available at http://www.w3.org/TR/xmlbase/.

[XML-SCHEMA2]
XML Schema Part 2: Datatypes, W3C Recommendation, World Wide Web Consortium, 2 May 2001. This version is http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/. The latest version is available at http://www.w3.org/TR/xmlschema-2/.


9.28.2 Informational References

[ANF01]
Normal Form Conventions for XML Representations of Structured Data, Henry S. Thompson. October 2001. Available at http://www.ltg.ed.ac.uk/~ht/normalForms.html.

[CL73]
Symbolic Logic and Mechanical Theorem Proving, C.L. Chang and R.C.T. Lee. Academic Press, 1973.

[CURIE]
CURIE Syntax 1.0: A syntax for expressing Compact URIs, Mark Birbeck, Shane McCarron. W3C Working Draft 2 April 2008. Available at http://www.w3.org/TR/curie/.

[Enderton01]
A Mathematical Introduction to Logic, Second Edition, H. B. Enderton. Academic Press, 2001.

[KLW95]
Logical foundations of object-oriented and frame-based languages, M. Kifer, G. Lausen, J. Wu. Journal of ACM, July 1995, pp. 741--843.

[Mendelson97]
Introduction to Mathematical Logic, Fourth Edition, E. Mendelson. Chapman & Hall, 1997.
[OWL-Reference]
OWL Web Ontology Language Reference, M. Dean, G. Schreiber, Editors, W3C Recommendation, 10 February 2004. Latest version available at http://www.w3.org/TR/owl-ref/.

[RDFSYN04]
RDF/XML Syntax Specification (Revised), Dave Beckett, Editor, W3C Recommendation, 10 February 2004, http://www.w3.org/TR/2004/REC-rdf-syntax-grammar-20040210/. Latest version available at http://www.w3.org/TR/rdf-syntax-grammar/.

[RIF-UCR]
RIF Use Cases and Requirements Adrian Paschke, David Hirtle, Allen Ginsberg, Paula-Lavinia Patranjan, Frank McCabe, eds. W3C Editor's Draft, 22 September21 November 2008, http://www.w3.org/2005/rules/wg/draft/ED-rif-ucr-20080922/http://www.w3.org/2005/rules/wg/draft/ED-rif-ucr-20081121/. Latest version available at http://www.w3.org/2005/rules/wg/draft/rif-ucr/.

[TRT03]
Object-Oriented RuleML: User-Level Roles, URI-Grounded Clauses, and Order-Sorted Terms, H. Boley. Springer LNCS 2876, Oct. 2003, pp. 1-16. Preprint at http://iit-iti.nrc-cnrc.gc.ca/publications/nrc-46502_e.html.

[vEK76]
The semantics of predicate logic as a programming language, M. van Emden and R. Kowalski. Journal of the ACM 23 (1976), pp. 733-742.

10[Vianu97]
Rule-Based Languages, Vianu V.. Annals of Mathematics and Artificial Intelligence 19 (1997), pp. 215-259.


9 Appendix: XML Schema for RIF-Core

The namespace of RIF is http://www.w3.org/2007/rif#.

XML schemas for the RIF-Core sublanguages are defined below and are also available here with additional examples.


10.19.1 Condition Language

 <?xml  version="1.0" encoding="UTF-8"?> 10.2version="1.0" encoding="UTF-8"?>
 

9.2 Rule Language

 <?xml  version="1.0" encoding="UTF-8"?>version="1.0" encoding="UTF-8"?>