This document, developed by the Rule Interchange Format (RIF) Working Group, specifies the Basic Logic Dialect, RIF-BLD, a format that allows logic rules to be exchanged between rule systems. The RIF-BLD presentation syntax and semantics are specified both directly and as specializations of the RIF Framework for Logic Dialects, or RIF-FLD. The XML serialization syntax of RIF-BLD is specified via a mapping from the presentation syntax. A normative XML schema is also provided.

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/.

XMLSchemaDatatypesDependency

RIFisdefinedtousedatatypesdefined in theXMLSchemaDefinitionLanguage(XSD).Asofthiswriting,thelatestW3CRecommendationforXSDisversion1.0,withversion1.1progressingtowardRecommendation.RIFhasbeendesignedtotakeadvantageofthenewdatatypesandclearerexplanationsavailableinXSD1.1,butfornowthoseadvantagesarebeingpartiallyputonhold.Specifically,untilXSD1.1becomesaW3CRecommendation,theelementsofRIFwhicharebasedonitshouldbeconsideredoptional,asdetailedinDatatypesandBuiltins,section2.3.UponthepublicationofXSD1.1asaW3CRecommendation,thoseelementswillceasetobeoptionalandaretobeconsideredrequiredasotherwisespecified.

Summary of Changes

W3CMembers Please CommentReview By 29October20098June2010

The RuleInterchangeFormat(RIF)WorkingGroupW3CDirector seeks togatherexperiencereviewandfeedback from implementationsinordertoincreaseconfidenceinW3CAdvisoryCommitteerepresentatives,viatheirreviewformby8June2010.Thiswillallow the languageDirectortoassessconsensus and meetspecificexitcriteria.determinewhethertoissue this document willremainas a CandidateRecommendationuntilatleast29October2009.Afterthatdate,whenandiftheexitcriteriaW3CRecommendation.

Support

No Endorsement

Publication as a CandidateProposed Recommendation 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.

1 Overview

This specification develops RIF-BLD (the Basic Logic Dialect of the Rule Interchange Format). From a theoretical perspective, RIF-BLD corresponds to the language of definite Horn rules with equality and a standard first-order semantics [CL73]. Syntactically, RIF-BLD has a number of 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 semantics for the integrated RIF-BLD/RDF and RIF-BLD/OWL languages. These features make RIF-BLD 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.

While rule interchange (and not, e.g., execution) is the principle design goal for RIF-BLD, the design clearly indicates a decision to avoid solving the (probably impossible) problem of rule interchange in general. Instead, the design of RIF reflects the rationale of identifying specific kinds of rules within existing rule systems, called RIF dialects, that can be translated into other rule systems without changing their meaning. RIF-BLD is just the first in a series of such dialects. In particular, RIF-BLD has the RIF-Core dialect [RIF-Core] as a subset. It is not expected that most rule systems will be able to translate all their rules into RIF-BLD, rather it is expected that only certain kinds of rules will be translatable. Since there are many existing rule languages with useful features that are not supported in RIF-BLD, it is expected that RIF-BLD translators will not translate rules that use such features. This could drive the design of "BLD-specific" rule sets in which rules are specifically written by the implementor to be within the BLD dialect and thus be portable between many rule system implementations.

Among its many influences, RIF shares certain characteristics with ISO Common Logic (CL) [ISO-CL], itself an evolution of KIF [KIF] and Conceptual Graphs [CG]. Like CL, RIF employs XML as its primary normative syntax, uses IRIs as identifiers, specifies integrated RIF-BLD/RDF and RIF-BLD/OWL languages for Semantic Web Compatibility [RIF-RDF+OWL], and provides a rich set of datatypes and built-ins that are designed to be well aligned with Web-aware rule system implementations [RIF-DTB]. Unlike CL, RIF-BLD was designed to be a simple dialect with limited expressiveness that lies within the intersection of first-order and logic-programming systems. This is why RIF-BLD does not support negation. More generally, RIF-BLD is part of a coherent array of RIF rule dialects, which encompasses both logic rules -- through the RIF framework for logic dialects [RIF-FLD] also including a variety of rule languages based on non-monotonic theories -- and production rules, as defined in [RIF-PRD]. CL, on the other hand, is strictly first-order; it does not account for non-monotonic semantics (e.g. negation as failure, defaults, priorities, etc.). For rule interchange between CL and RIF dialects, it is expected that partial RIF-CL mappings will be defined.

RIF-BLD also bears some similarity to SPARQL, in particular with respect to RDF Compatibility [RIF-RDF+OWL]. As with the well-known correspondence between a fragment of SQL and Datalog, SPARQL can be partially mapped to Datalog (and thus to the RIF-Core subset of RIF-BLD), see [AP07] and [AG08] for details. A full mapping of SPARQL would need constructs beyond RIF-BLD, such as non-monotonic negation. Likewise, not all of SPARQL's FILTER functions are expressible in RIF-DTB built-in predicates. Not all of RIF-BLD is expressible in SPARQL either, for instance recursive rules over RDF Data are not expressible as SPARQL CONSTRUCT statements.

RIF-BLD is defined in two different ways -- both normative:

As a direct specification, independently of the RIF framework for logic dialects [RIF-FLD], for the benefit of those who desire a direct path to RIF-BLD, e.g., as prospective implementers, and are not interested in extensibility issues. This version of the RIF-BLD specification is given first.

As a specialization of the RIF framework for logic dialects [RIF-FLD], which is part of the RIF extensibility framework.
Building on RIF-FLD, this version of the RIF-BLD specification is comparatively short and is presented in Section RIF-BLD as a Specialization of the RIF Framework at the end of this document. This is intended for the reader who is already familiar with RIF-FLD and does not need to go through the much longer direct specification of RIF-BLD. This section is also useful for dialect designers, as it is a concrete example of how a non-trivial RIF dialect can be derived from the RIF framework for logic dialects.

Logic-based RIF dialects that specialize or extend RIF-BLD in accordance with the RIF framework for logic dialects [RIF-FLD] include RIF-Core as a specialization of RIF-BLD. It is expected that other specifications will develop further logic dialects based on RIF-BLD such as a RIF-BLD extension capturing uncertainty [URD08].

As a preview, here is a simple complete RIF-BLD example deriving a ternary relation from its inverse.

Example 1 (An introductory RIF-BLD 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):

A buyer buys an item from a seller
if the seller sells the item to the buyer.

John sells LeRif to Mary.

Intuitively, the fact Mary buys LeRif from John should be logically derivable from the above premises.
Assuming Web IRIs for the predicatesbuyandsell,aswellpredicatesbuyandsell,aswellasfortheindividualsJohn,Mary,andLeRif,theaboveEnglishtextcanberepresentedintheRIF-BLDPresentationSyntaxasfollows.

Whenever a RIF-BLD document falls into the Core subset or can be translated to it, the document should be produced in RIF-Core to allow its interchange with a maximum number of RIF consumers.
For instance, the Datalog-like RIF document in Example 1 is also a RIF-Core example.

For the interchange of documents containing RIF-BLD rules (and facts), a concrete RIF-BLD XML Syntax is given in this specification. To formalize their meaning, a model-theoretic RIF-BLD Semantics is specified.

2 Direct Specification of RIF-BLD Presentation Syntax

This section specifies the presentation syntax of RIF-BLD directly, without relying on [RIF-FLD]. In the first five (normative) subsections, the presentation syntax is
defined using "mathematical English," a special form of English for communicating mathematical definitions, examples, etc.
In the non-normative subsection EBNF Grammar for the Presentation Syntax of RIF-BLD, a grammar for a superset of the presentation syntax is given using Extended Backus–Naur Form (EBNF).
Neither the mathematical English nor the EBNF is intended to be a concrete syntax for RIF-BLD. The mathematical English deliberately leaves out details such as the delimiters of the various syntactic components, escape symbols, parenthesizing, precedence of operators, and the like. The EBNF does not specify context-sensitive syntactic constraints.
Since RIF is an interchange format, it uses XML as the only concrete syntax,
which will be defined in XML Serialization Syntax for RIF-BLD. Hence RIF-BLD conformance is described in terms of semantics-preserving transformations.

2.1 Alphabet of RIF-BLD

Definition (Alphabet).
The alphabet of the presentation language of RIF-BLD consists of

a countably infinite set of constant symbolsConst

a countably infinite set of variable symbolsVar (disjoint from Const)

a countably infinite set of argument names, ArgNames (disjoint from Const and Var)

connective symbols And, Or, and :-

quantifiers Exists and Forall

the symbols =, #, ##, ->, External, Import, Prefix, and Base

the symbols Group and Document

the symbols for representing lists: List and OpenList.

the auxiliary symbols (, ), [, ], <, >, and ^^

The set of connective symbols, quantifiers, =, etc., is disjoint from Const and Var. The argument names in ArgNames are written as Unicode strings that must not start with a question mark, "?". Variables are written as Unicode strings preceded with the symbol "?".

Constants are written as "literal"^^symspace, where literal is a sequence of Unicode characters and
symspace is an identifier for a symbol space. Symbol spaces are defined in Section Constants, Symbol Spaces, and Datatypes of [RIF-DTB].

The symbols =, #, and ## are used in formulas that define equality, class membership, and subclass relationships. The symbol -> is used in terms that have named arguments and in frame formulas. The symbol External indicates that an atomic formula or a function term is defined externally (e.g., a built-in) and the symbols Prefix and Base enable compact representations of IRIs [RFC-3987].

The symbol Document is used to specify RIF-BLD documents, the symbol Import is an import directive, and the symbol Group is used to organize RIF-BLD formulas into collections. ☐

The language of RIF-BLD is the set of formulas constructed using the above alphabet according to the rules given below.

2.2 Terms

RIF-BLD defines several kinds of terms: constants and variables,
positional terms, terms with named arguments, plus equality,
membership, subclass, frame, and external terms. The word "term" will be used to refer to any of these constructs.

To simplify the next definition, we will use the phrase base term to refer to simple, positional, or named-argument terms, or to terms of the form External(t), where t is a positional or a named-argument term.

Definition (Term).

Constants and variables. If t ∈ Const or t ∈ Var then t is a simple term.

Terms with named arguments. A term with named arguments is of the form t(s1->v1 ... sn->vn), where n≥0, t ∈ Const and v1, ..., vn are base terms and s1, ..., sn are pairwise distinct symbols from the set ArgNames.

The constant t here represents a predicate or a function; s1, ..., sn represent argument names; and v1, ..., vn represent argument values. The argument names, s1, ..., sn, are required to be pairwise distinct. Terms with named arguments are like positional terms except that the arguments are named and their order is immaterial. Note that a term of the form f() is, trivially, both a positional term and a term with named arguments.

Terms with named arguments are introduced to support exchange of languages
that permit argument positions of predicates and functions to be named
(in which case the order of the arguments does not matter).

List terms. There are two kinds of list terms: open and closed.

A closed list has the form List(t1 ... tm), where m≥0 and t1, ..., tm are terms.

An open list (or a list with a tail) has the form
OpenList(t1 ... tmt), where m>0 and t1, ..., tm, t are terms. Open lists are usually written using the following: List(t1 ... tm|t).

The last argument, t, represents the tail of the list and so it is normally a list as well. However, the syntax does not restrict t in any way: it could be an integer, a variable, another list, or, in fact, any term. An example is List(1 2 | 3). This is not an ordinary list, where the last argument, 3, would represent the tail of a list (and thus would also be a list, which 3 is not). Such general open lists correspond to Lisp's dotted lists [Steele90]. Note that they can be the result of instantiating an open list with a variable in the tail, hence are hard to avoid. For instance, List(1 2 | 3) is List(1 2 | ?X), where the variable ?X is replaced with 3.

A closed list of the form List() (i.e., a list in which m=0, corresponding to Lisp's nil) is called the empty list.

Equality terms. t = s is an equality term, if t and s are base terms.

Class membership terms (or just membership terms). t#s is a membership term if t and s are base terms.

Membership, subclass, and frame terms are used to describe objects and class hierarchies.

Externally defined terms. If t is a positional or a named-argument term then External(t) is an externally defined term.

External terms are used for representing built-in functions and predicates as well as "procedurally attached" terms or predicates, which might exist in various rule-based systems, but are not specified by RIF. ☐

Observe that the argument names of frame terms, p1, ..., pn, are base terms and so, as a special case, can be variables. In contrast, terms with named arguments can use only the symbols from ArgNames to represent their argument names. They cannot be constants from Const or variables from Var. The reason for not allowing variables for those is to control the complexity of unification, which is used by several inference mechanisms of first-order logic.

2.3 Formulas

RIF-BLD distinguishes certain subsets of the set Const of symbols, including subsets of predicate symbols and function symbols. Section Well-formed Formulas gives more details, but we do not need those details yet.

Definition (Atomic Formula).
Any term (positional or with named arguments) of the form p(...), where p is a predicate symbol, is also an atomic formula. Equality, membership, subclass, and frame terms are also atomic formulas. An externally defined term of the form External(φ), where φ is an atomic formula, is also an atomic formula, called an externally defined atomic formula.
☐

Note that simple terms (constants and variables) are not formulas.

More general formulas are constructed from atomic formulas with the help of logical connectives.

Definition (Formula).
A formula can have several different forms and is defined as follows:

Atomic: If φ is an atomic formula then it is also a formula.

Condition formula: A condition formula is either an atomic formula or a formula that has one of the following forms:

Conjunction: If φ1, ..., φn, n ≥ 0, are condition formulas then so is And(φ1 ... φn), called a conjunctive formula. As a special case, And() is allowed and is treated as a tautology, i.e., a formula that is always true.

Disjunction: If φ1, ..., φn, n ≥ 0, are condition formulas then so is Or(φ1 ... φn), called a disjunctive formula. As a special case, Or() is permitted and is treated as a contradiction, i.e., a formula that is always false.

Existentials: If φ is a condition formula and ?V1, ..., ?Vn, n>0, are distinct variables then Exists ?V1 ... ?Vn(φ) is an existential formula.

Condition formulas are intended to be used inside the premises of rules. Next we define the notions of rule implications, universal rules, universal facts, groups (i.e., sets of rules and facts), and documents.

Rule implication: φ :- ψ is a formula, called rule implication, if:

φ is an atomic formula or a conjunction of atomic formulas,

ψ is a condition formula, and

none of the atomic formulas in φ is an externally defined term (i.e., a term of the form External(...)). Note: external terms can occur in the arguments of atomic formulas in the rule conclusion. For instance, p(func:numeric-add(?X,"2"^^xsd:integer)) :-p(func:numeric-add(?X,"2"^^xs:integer)) :- q(?X).

FeatureAtRisk#2:Equalityintheruleconclusion(φintheabove)Note:Thisfeatureis"atrisk"andmaybealteredorremovedfromthisspecificationbasedonfeedback.Ifyouhaveconcernsaboutthisorinformationwhichmaybeusefulinoureventualdecision,pleasetellusatpublic-rif-comments@w3.org.Seethefulllistoffeatures"atrisk"inRIF.Universal rule: If φ is a rule implication and ?V1, ..., ?Vn, n>0, are distinct variables then Forall ?V1 ... ?Vn(φ) is a formula, called a universal rule. It is required that all the free variables in φ occur among the variables ?V1 ... ?Vn in the quantification part. An occurrence of a variable ?v is free in φ if it is not inside a substringsubformulaofφ of the form Q ?vExists ?v (ψ)ofφ,whereQisaquantifier(ForallorExists)and ψ is a formula. Universal rules will also be referred to as RIF-BLD rules.

Universal fact: If φ is an atomic formula and ?V1, ..., ?Vn, n>0, are distinct variables then
Forall ?V1 ... ?Vn(φ) is a formula, called a universal fact, provided that all the free variables in φ occur among the variables ?V1 ... ?Vn.

Universal facts are often considered to be rules without premises.

Group: If φ1, ..., φn are RIF-BLD rules, universal facts, variable-free rule implications, variable-free atomic formulas, or group formulas then Group(φ1 ... φn) is a group formula. As a special case, the empty group formula, Group(), is allowed and is treated as a tautology, i.e., a formula that is always true.

Non-empty group formulas are used to represent sets of rules and facts. Note that some of the φi's can be group formulas themselves, which means that groups can be nested.

Document: An expression of the form Document(directive1 ... directiven Γ) is a RIF-BLD document formula (or simply a document formula), if

Γ is an optional group formula; it is called the group formula associated with the document.

directive1, ..., directiven is an optional sequence of directives. A directive can be a base directive, a prefix directive or an import directive.

A base directive has the form Base(<iri>), where iri is a Unicode string in the form of an absolute IRI [RFC-3987].

A prefix directive has the form Prefix(p <v>), where p is an alphanumeric string that serves as the prefix name and v is an expansion for p -- a Unicode sequence of characters that forms an IRI.
(An alphanumeric string is a sequence of ASCII characters, where each character is a letter, a digit, or an underscore "_", and the first character is a letter.)

Like the Base directive, the Prefix directives define shorthands to allow more concise representation of constants that come from the symbol space rif:iri (we will call such constants rif:iriconstants). This mechanism is explained in [RIF-DTB], Section Constants, Symbol Spaces, and Datatypes.

An import directive can have one of these two forms: Import(<loc>) or Import(<loc> <p>). Here loc is a Unicode sequence of characters that forms an IRI and p is another Unicode sequence of characters. The constant loc represents the location of another document to be imported; it is called the locator of the imported document. The argument p is called the profile of import; it has the form of a Unicode character sequence in the form of an IRI -- see [RIF-RDF+OWL].

Section Direct Specification of RIF-BLD Semantics of this document defines the semantics for the directive Import(<loc>) only. The two-argument directive, Import(<loc> <p>), is intended for importing non-RIF-BLD documents, such as rules from other RIF dialects, RDF data, or OWL ontologies. The profile, p, indicates what kind of entity is being imported and under what semantics (for instance, the various RDF entailment regimes have different profiles). The semantics of Import(<loc> <p>) (for various p) are expected to be given by other specifications on a case-by-case basis. For instance, [RIF-RDF+OWL] defines the semantics for the profiles that are recommended for importing RDF and OWL.

Note that although Base, Prefix, and Import all use symbols of the form <iri> to indicate the connection of these symbols to IRIs, these symbols are notrif:iri constants, as semantically they are interpreted in a way that is quite different from constants.

A document formula can contain at most one Base directive. The Base directive, if present, must be first, followed by any number of Prefix directives, followed by any number of Import directives.

In the definition of a formula, the component formulas φ, φi, ψi, and Γ are said to be subformulas of the respective formulas (condition, rule, group, etc.) that are built using these components. ☐

2.4 RIF-BLD Annotations in the Presentation Syntax

RIF-BLD allows every term and formula (including terms and formulas that occur inside other terms and formulas) to be optionally preceded by anoneannotation of the form (* id φ *), where id is a rif:iri constant and φ is a frame formula or a conjunction of frame formulas. Both items inside the annotation are optional. The id part represents the identifier of the term or formula to which the annotation is attached and φ is the metadata part of the annotation. RIF-BLD does not impose any restrictions on φ apart from what is stated above. This means that it may include variables, function symbols, constants from the symbol space rif:local (often referred to as local or rif:localconstants), and so on.

Document formulas with and without annotations will be referred to as RIF-BLD documents.

The following convention is used to avoid a syntactic ambiguity with respect to annotations. The annotation scoping convention associates each annotation to the largest term or formula it precedes. For instance, in (* id φ *) t[w -> v] the metadata annotation could be attributed to the term t or to the entire frame t[w -> v]. The convention specifies that the above annotation is considered to be syntactically attached to the entire frame. Yet, since φ can be a conjunction, some conjuncts can be used to provide metadata targeted to the object part, t, of the frame. For instance, (* And(_foo[meta_for_frame->"this is an annotation for the entire frame"] _bar[meta_for_object->"this is an annotation for t" meta_for_property->"this is an annotation for w"]) *) t[w -> v].

We suggest to use Dublin Core, RDFS, and OWL properties for metadata, along the lines of Section 7.1 of [OWL-Reference]-- specifically owl:versionInfo, rdfs:label, rdfs:comment, rdfs:seeAlso, rdfs:isDefinedBy, dc:creator, dc:description, dc:date, and foaf:maker.

2.5 Well-formed Formulas

Not all formulas and thus not all documents are well-formed in RIF-BLD:
it is required that no constant appear in more than one context. What this means precisely is explained below. Informally,thismeansthateachconstantsymbolinRIF-BLDcanbeeitheranindividual,aplainfunction,aplainpredicate,anexternallydefinedfunction,oranexternallydefinedpredicate.However,symbolscanbepolyadic:thesamefunctionorpredicatesymbol(normalorexternal)canoccurwithdifferentnumbersofargumentsindifferentplaces.Notethatpolyadicsymbolscouldbereplacedbynon-polyadicsymbolswiththearityinformationencodedinthefunctionorpredicatenames.Forinstance,thepolyadictermsp(?X)andp(?X,?Y)couldberepresentedasp_1(?X)andp_2(?X,?Y),respectively.

The set of all constant symbols, Const, is partitioned into the following subsets:

A subset of individuals.

The symbols in Const that belong to the symbol spaces of Datatypes are required to be individuals.

A subset of plain (i.e., non-external) function symbols.

A subset for external function symbols.

A subset of plain predicate symbols.

A subset for external predicate symbols.

The above subsets do not differentiate between positional and named argument symbols. Also, as seen from the following definitions, these subsets are not specified explicitly but, rather, are inferred from the occurrences of the symbols.

Definition (Context of a symbol).
The context of an occurrence of a symbol, s∈Const, in a formula, φ, is determined as follows:

If s occurs as a predicate of the form s(...) (positional or named-argument) in an atomic subformula of φ then s occurs in the context of a (plain) predicate symbol.

If s occurs as a function symbol in a non-subformula term of the form s(...) then s occurs in the context of a (plain) function symbol.

If s occurs as a predicate in an atomic subformula External(s(...)) then s occurs in the context of an external predicate symbol.

If s occurs as a function in a non-subformula term External(s(...)) then s occurs in the context of an external function symbol.

If s occurs in any other context (in a frame: s[...], ...[s->...], or ...[...->s]; or in a positional/named-argument term: p(...s...), q(...->s...)), it is said to occur as an individual. ☐

Definition (Imported document).
Let Δ be a document formula and Import(loc) be one of its import directives, where loc is a locator of another document formula, Δ'. We say that Δ' is directly imported into Δ.

A document formula Δ' is said to be imported into
Δ if it is either directly imported into Δ or it is imported (directly or not) into some other formula that is directly imported into Δ. ☐

The above definition deals only with one-argument import directives, since
only such directives can be used to import other RIF-BLD documents.
Two-argument import directives are provided to enable import of other types of documents, and their semantics are supposed to be covered by other specifications, such as [RIF-RDF+OWL].

Definition (Well-formed formula).
A formula φ is well-formed iff:

every constant symbol (whether coming from the symbol space rif:local or not) mentioned in φ occurs in exactly one context.

if φ is a document formula and Δ'1, ..., Δ'k are all of its imported documents, then every non-rif:local constant symbol mentioned in φ or any of the imported Δ'is must occur in exactly one context (in all of the Δ'is).

if t is an instantiation of a schema in the coherent set of external schemas associated with the language then t can occur only as External(t), i.e., as an external term or atomic formula. ☐

Definition (Language of RIF-BLD).
The language of RIF-BLD consists of the set of all well-formed formulas and is determined by:

the alphabet of the language and

a set of coherent external schemas, which determine the available built-ins and other externally defined predicates and functions. ☐

2.6 EBNF Grammar for the Presentation Syntax of RIF-BLD (Informative)

Until now, we have been using mathematical English to specify the syntax of RIF-BLD. Tool developers, however, may prefer EBNF notation, which provides a more succinct view of the syntax. Several points should be kept in mind regarding this notation.

The syntax of first-order logic is not context-free, so EBNF cannot capture the syntax of RIF-BLD precisely. For instance, it cannot capture thesomewell-formedness conditions, i.e.,suchas the requirement that eachsymbolinRIF-BLDcanoccurinatmostonecontext.externaltermsmustbeinstancesofexternalschemas. As a result, the EBNF grammar defines a strict superset of RIF-BLD: not all formulas that are derivable using the EBNF grammar are well-formed formulas in RIF-BLD.

The EBNF grammar does not address all details of how constants (defined in [RIF-DTB]) and variables are represented, and it is not sufficiently precise about the delimiters and escape symbols. White space is informally used as a delimiter, and is implied in productions that use Kleene star. For instance, TERM* is to be understood as TERM TERM ... TERM, where each space abstracts from one or more blanks, tabs, newlines, etc. This is so because RIF's presentation syntax is a tool for specifying the semantics and for illustration of the main RIF concepts through examples. It is not intended as a concrete syntax for a rule language. RIF defines a concrete syntax only for exchanging rules, and that syntax is XML-based, obtained as a refinement and serialization of the presentation syntax.

For all the above reasons, the EBNF grammar is not normative. Recall from the opening paragraph, however, that the RIF-BLD presentation syntax as specified in mathematical English is normative.

The EBNF for the RIF-BLD presentation syntax is given as follows, showing the entire (top-down) context of its three parts for rules, conditions, and annotations.

The following subsections explain and exemplify these parts, starting with the basic language of positive conditions.

2.6.1 EBNF for the Condition Language

The Condition Language represents formulas that can be used in the premises of RIF-BLD rules (also called rule bodies). The EBNF grammar for a superset of the RIF-BLD condition language is shown in the above conditions part.

The production rule for the non-terminal FORMULA represents RIF condition formulas (defined earlier). The connectives And and Or define conjunctions and disjunctions of conditions, respectively. Exists introduces existentially quantified variables. Here Var+ stands for the list of variables that are free in FORMULA. A RIF-BLD FORMULA can also be an ATOMIC term, i.e. an Atom, ExternalAtom, Equal, Member, Subclass, or Frame. A TERM can be a constant, variable, Expr, List, or ExternalExpr.

The RIF-BLD presentation syntax does not commit to any particular vocabulary and permits arbitrary Unicode strings in constant symbols, argument names, and variables. Constant symbols can have this form: "UNICODESTRING"^^SYMSPACE, where SYMSPACE is an ANGLEBRACKIRI or CURIE that represents the identifier of the symbol space of the constant. UNICODESTRING, ANGLEBRACKIRI, and CURIE are defined in Section Shortcuts for Constants in RIF's Presentation Syntax of [RIF-DTB]. Constant symbols can also have several shortcut forms, which are represented by the non-terminal CONSTSHORT. These shortcuts are also defined in the same section of [RIF-DTB]. One of them is the CURIE shortcut, which is extensively used in the examples in this document.
Names are Unicode character sequences. Variables are composed of UNICODESTRING symbols prefixed with a ?-sign.

Equality, membership, and subclass terms are self-explanatory. An Atom and Expr (expression) can either be positional or have named arguments. A frame term is a term composed of an object identifier and a collection of attribute-value pairs. The term External(Atom) is a call to an externally defined predicate. Likewise, External(Expr) is a call to an externally defined function.

Example 3 (RIF-BLD conditions).

This example shows conditions that are composed of atoms, expressions, equalities with lists, frames, and existentials. In frame formulas, variables are shown in the positions of object identifiers, object properties, and property values. For brevity, we use the shortcut CURIE notation prefix:suffix for constant symbols defined in [RIF-DTB]. This is understood as a shorthand for an IRI obtained by concatenation 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.

2.6.2 EBNF for the Rule Language

A RIF-BLD Document consists of an optional Base, followed by any number of Prefixes, followed by any number of Imports, followed by an optional Group.
Base and Prefix serve as shortcut mechanisms for IRIs.
IRI has the form of an internationalized resource identifier as defined by [RFC-3987].
An Import indicates the location of a document to be imported and an optional profile.
A RIF-BLD Group is a collection of
any number of RULE elements along with any number of nested Groups.

Rules are generated using CLAUSE elements. The RULE production has two alternatives:

In the first, a CLAUSE is in the scope of the Forall quantifier. In that case, all variables mentioned in CLAUSE are required to also appear among the variables in the Var+ sequence.

In the second alternative, CLAUSE appears on its own. In that case, CLAUSE cannot have variables.

Var, ATOMIC, and FORMULA were defined as part of the syntax for positive conditions in Section EBNF for RIF-BLD Condition Language. In the CLAUSE production, an ATOMIC is what is usually called a fact. An Impliesrule can have an ATOMIC or a conjunction of ATOMIC elements as its conclusion; it has a FORMULA as its premise. Note that, by the definition of formulas, externally defined atoms (i.e., formulas of the form External(Atom)) are not allowed in the conclusion part of a rule (ATOMIC does not expand to External).

If an item is perishable and it is delivered to John more than 10 days
after the scheduled delivery date then the item will be rejected by him.

As before, for better readability we use the compact URI notationnotation,theangle-bracketnotation,andtheBasedirective defined in [RIF-DTB], Section Constants, Symbol Spaces, and Datatypes. Again, prefixdirectives are assumed in the preamble to the document.
Then, two versions of the main part of the document are given.

2.6.3 EBNF for Annotations

The EBNF grammar production for RIF-BLD annotations is shown in the above annotations part.

As explained in Section RIF-BLD Annotations in the Presentation Syntax, each RIF-BLD formulasformula and termsterm can be prefixedwithprecededbyone optional annotations,annotation,IRIMETA, for identification and metadata.
IRIMETA is represented using (*...*)-brackets
that contain an optional rif:iri constant, IRICONST, as identifier followed by
an optional Frame or conjunction of Frames as metadata.

An IRICONST is rif:iri constant,
again permitting the shortcut forms defined in [RIF-DTB].
One such specialization is '"' IRI '"^^' 'rif:iri' from the Const production, where IRI is a sequence of Unicode characters that forms an internationalized resource identifier as defined by [RFC-3987].

Example 5 (A RIF-BLD document containing an annotated group).

This example shows a complete document containing a group formula that consists of two RIF-BLD rules. The first of these rules is copied from Example 4a. The group is annotated with an IRI identifier and metadata represented using Dublin Core vocabulary.

3 Direct Specification of RIF-BLD Semantics

This normative section specifies the semantics of RIF-BLD directly, without
relying on [RIF-FLD].

Recall that the presentation syntax of RIF-BLD allows shorthand notation,
which is specified via the Prefix and Base directives, and various shortcuts for integers, strings, and rif:local symbols.
The semantics, below, is described using the full syntax, i.e., we
assume that all shortcuts have already been expanded as defined in [RIF-DTB], Section Constants, Symbol Spaces, and Datatypes.

3.1 Truth Values

The set TV of truth values in RIF-BLD consists of two values, t and f.

Definition (Semantic structure).
A semantic structure, I, is a tuple of the form
<TV, DTS, D, Dind,
Dfunc, IC, IV,
IF, INF, Ilist, Itail, Iframe,
Isub, Iisa, I=,
Iexternal, Itruth>. Here D is a non-empty set of elements called the domain of I, and Dind, Dfunc are nonempty subsets of D. Dind is used to interpret the elements of Const that occur as individuals and Dfunc is used to interpret the elements of Const that occur in the context of function symbols. As before, Const denotes the set of all constant symbols and Var the set of all variable symbols. DTS denotes a set of identifiers for datatypes (please refer to Section Datatypes of [RIF-DTB] for the semantics of datatypes).

The other components of I are total mappings defined as follows:

IC maps Const to D.

This mapping interprets constant symbols. In addition:

If a constant, c ∈ Const,
is an individual then it is required that
IC(c) ∈ Dind.

If c ∈ Const, is a function symbol (positional or with named arguments) then it is required that IC(c) ∈ Dfunc.

IV maps Var to Dind.

This mapping interprets variable symbols.

IF maps D to total functions D*ind → D (here D*ind is a set of all finite sequences over the domain Dind).

This mapping interprets positional terms. In addition:

If d ∈ Dfunc then IF(d) must be a function D*ind → Dind.

This means that when a function symbol is applied to arguments that are individual objects then the result is also an individual object.

INF maps D to the set of total functions of the form SetOfFiniteSets(ArgNames × Dind) → D.

This mapping interprets function symbols with named arguments. In addition:

If d ∈ Dfunc then INF(d) must be a function SetOfFiniteSets(ArgNames × Dind) → Dind.

This is analogous to the interpretation of positional terms with two differences:

Each pair <s,v> ∈ ArgNames × Dind represents an argument/value pair instead of just a value in the case of a positional term.

The arguments of a term with named arguments constitute a finite set of argument/value pairs rather than a finite ordered sequence of simple elements. So, the order of the arguments does not matter.

Ilist and Itail are used to interpret lists. They are mappings of the following form:

Ilist : Dind* → Dind

Itail : Dind+× Dind → Dind

In addition, these mappings are required to satisfy the following conditions:

The function Ilist is injective (one-to-one).

The set Ilist(Dind*), henceforth denoted Dlist, is disjoint from the value spaces of all data types in DTS.

Note that the last condition above restricts Itail only when its last argument is in Dlist. If the last argument of Itail is not in Dlist, then the list is a general open one and there are no restrictions on the value of Itail except that it must be in Dind.

Iframe maps Dind to total functions of the form SetOfFiniteBags(Dind × Dind) → D.

This mapping interprets frame terms. An argument, d ∈ Dind, to Iframe represents an object and the finite bag {<a1,v1>, ..., <ak,vk>} represents a bag of attribute-value pairs for d. We will see shortly how Iframe is used to determine the truth valuation of frame terms.

Bags (multi-sets) are used here because the order of the attribute/value pairs in a frame is immaterial and pairs may repeat. Such repetitions arise naturally when variables are instantiated with constants. For instance, o[?A->?B ?C->?D] becomes o[a->b a->b] if variables ?A and ?C are instantiated with the symbol a while ?B and ?D are instantiated with b. (We shall see later that o[a->b a->b] is equivalent to o[a->b].)

Isub gives meaning to the subclass relationship. It is a mapping of the form Dind × Dind → D.

Isub will be further restricted in Section Interpretation of Formulas to ensure that
the operator ## is transitive, i.e., that c1 ## c2 and c2 ## c3 imply c1 ## c3.

Iisa gives meaning to class membership. It is a mapping of the form Dind × Dind → D.

Iisa will be further restricted in Section Interpretation of Formulas to ensure that
the relationships # and ## have the usual property that all members of a subclass are also members of the superclass, i.e., that o # cl and cl ## scl imply o # scl.

I= is a mapping of the form Dind × Dind → D.

It gives meaning to the equality operator.

Itruth is a mapping of the form D → TV.

It is used to define truth valuation for formulas.

Iexternal is a mapping from the coherent set of schemas for externally defined functions to total functions D* → D. For each external schema σ = (?X1 ... ?Xn; τ) in the coherent set of external schemas associated with the language, Iexternal(σ) is a function of the form Dn → D.

For every external schema, σ, associated with the language, Iexternal(σ) is assumed to be specified externally in some document (hence the name external schema). In particular, if σ is a schema of a RIF built-in predicate or function, Iexternal(σ) is specified in [RIF-DTB] so that:

If σ is a schema of a built-in function then Iexternal(σ) must be the function defined in [RIF-DTB].

If σ is a schema of a built-in predicate then
Itruth ο (Iexternal(σ)) (the composition of Itruth and Iexternal(σ), a truth-valued function) must be as specified in [RIF-DTB].

We also define the following mapping from terms to D, which we denote using the same symbol I as the one used for semantic structures. This overloading is convenient and creates no ambiguity.

I(k) = IC(k), if k is a symbol in Const

I(?v) = IV(?v), if ?v is a variable in Var

I(f(t1 ... tn)) = IF(I(f))(I(t1),...,I(tn))

I(f(s1->v1 ... sn->vn)) = INF(I(f))({<s1,I(v1)>,...,<sn,I(vn)>})

Here we use {...} to denote a set of argument/value pairs.

For list terms, the mapping is defined as follows:

I(List()) = Ilist(<>).

Here <> denotes an empty list of elements of Dind. (Note that the domain of Ilist is Dind*, so Dind0 is an empty list of elements of Dind.)

Here {...} denotes a bag of attribute/value pairs. Jumping ahead, we note that duplicate elements in such a bag do not affect the truth value of a frame formula. Thus, for instance, [a->b a->b] and o[a->b] always have the same truth value.

Note that, by definition, External(t) is well-formed only if t is an instantiation of an external schema. Furthermore, by the definition of coherent sets of external schemas, t can be an instantiation of at most one such schema, so I(External(t)) is well-defined.

The effect of datatypes. The set DTS must include the datatypes described in Section Datatypes of [RIF-DTB].

The datatype identifiers in DTS impose the following restrictions. Given dt ∈ DTS, let LSdt denote the lexical space of dt, VSdt denote its value space, and Ldt: LSdt → VSdt the lexical-to-value-space mapping (for the definitions of these concepts, see Section Datatypes of [RIF-DTB]). Then the following must hold:

VSdt ⊆ Dind; and

For each constant "lit"^^dt such that lit ∈ LSdt, IC("lit"^^dt) = Ldt(lit).

That is, IC must map the constants of a datatype dt in accordance with Ldt.

RIF-BLD does not impose restrictions on IC for constants in symbol spaces that are not datatypes included in DTS. ☐

3.3 RIF-BLD Annotations in the Semantics

RIF-BLD annotations are stripped before the mappings that constitute RIF-BLD semantic structures are applied. Likewise, they are stripped before applying the truth valuation, TValI, defined in the next section. Thus, identifiers and metadata have no effect on the formal semantics.

Note that although identifiers and metadata associated with RIF-BLD formulas are ignored by the semantics, they can be extracted by XML tools. The frame terms used to represent RIF-BLD metadata can then be fed to other RIF-BLD rules, thus enabling reasoning about metadata. RIF-BLD does not define any particular semantics for metadata, however.

3.4 Interpretation of Non-document Formulas

This section defines how a semantic structure, I, determines
the truth value TValI(φ) of a RIF-BLD formula, φ, where φ is any formula other than a document formula. Truth valuation of document formulas is defined in the next section.

We define a mapping, TValI, from the set of all non-document formulas to TV. Note that the definition implies that TValI(φ) is defined only if the set DTS of the datatypes of I includes all the datatypes mentioned in φ and Iexternal is defined on all externally defined functions and predicates in φ.

Definition (Truth valuation).
Truth valuation for well-formed formulas in RIF-BLD is determined using the following function, denoted TValI:

Note that, by definition, External(t) is well-formed only if t is an instantiation of an external schema. Furthermore, by the definition of coherent sets of external schemas, t can be an instantiation of at most one such schema, so I(External(t)) is well-defined.

The empty disjunction is treated as a contradiction, so TValI(Or()) = f.

Quantification:

TValI(Exists ?v1 ... ?vn (φ)) = t if and only if for some I*, described below, TValI*(φ) = t.

TValI(Forall ?v1 ... ?vn (φ)) = t if and only if for every I*, described below, TValI*(φ) = t.

Here I* is a semantic structure of the form <TV, DTS, D, Dind, Dfunc, IC, I*V, IF, INF, Ilist, Itail, Iframe, Isub, Iisa, I=, Iexternal, Itruth>, which is exactly like I, except that the mapping I*V, is used instead of IV. I*V is defined to coincide with IV on all variables except, possibly, on ?v1,...,?vn.

Rule implication:

TValI(conclusion :- condition) = t, if either TValI(conclusion)=t or TValI(condition)=f.

TValI(conclusion :- condition) = f otherwise.

Groups of rules:

If Γ is a group formula of the form Group(φ1 ... φn) then

TValI(Γ) = t if and only if TValI(φ1) = t, ..., TValI(φn) = t.

TValI(Γ) = f otherwise.

This means that a group of rules is treated as a conjunction. In particular, the empty group is treated as a tautology, so TValI(Group()) = t. ☐

3.5 Interpretation of Documents

Document formulas are interpreted using semantic multi-structures, which
are sets of closely related semantics structures. The need for multi-structures
arises due to the fact that a RIF-BLD document can import other documents and
thus is essentially a multi-document object. One interesting aspect of the
multi-document semantics is that rif:local symbols that belong to
different documents can have different meanings.

Definition (Semantic multi-structure).
A semantic multi-structureÎ is a set of semantic structures of the form {J,I; Ii1, Ii2, ...}, where

Ii1, Ii2, etc., are semantic structures adorned with the locators of distinct RIF-BLD formulas (one can think of these adorned structures as locator-structure pairs).

All the structures in Î (adorned and non-adorned) are identical in all respects except for the following:

The mappings JC, IC, ICi1, ICi2, ... may differ on the constants in Const that belong to the rif:local symbol space.
☐

As will be seen from the next definition, the structure I in the above is used to interpret document formulas, and the adorned structures of the form Iik are used to interpret imported documents. The structure J is used in the definition of entailment tointerpretfor non-document formulas.

The semantics of RIF documents is now defined as follows.

Definition (Truth valuation of document formulas).
Let Δ be a document formula and let
Δ1, ..., Δn be all the RIF-BLD document formulas that are imported (directly or indirectly, according to Definition Imported document) into Δ.
Let Γ, Γ1, ..., Γn denote the respective group formulas associated with these documents.
Let Î = {J,I; Ii1, ..., Iin, ...} be a semantic multi-structure that contains the semantic structures adorned with the locators i1, ..., in of the documents Δ1, ..., Δn.
Then we define:

Note that this definition considers only those document formulas that are reachable via the one-argument import directives. Two argument import directives are not covered here. Their semantics is defined by the document RIF RDF and OWL Compatibility [RIF-RDF+OWL].

Also note that some of the Γi above may be missing since all parts in a document formula are optional. In this case, we assume that Γi is a tautology, such as And(), and every TVal function maps such a Γi to the truth value t.

The above definitions make the intent behind the rif:local constants clear: occurrences of such constants in different documents can be interpreted differently even if they have the same name. Therefore, each document can choose the names for the rif:local constants freely and without regard to the names of such constants used in the imported documents.

3.6 Logical Entailment

We now define what it means for a set of RIF-BLD rules (embedded in a group or a document formula) to entail another RIF-BLD formula. In RIF-BLD we are mostly interested in entailment of RIF condition formulas, which can be viewed as queries to RIF-BLD groups or documents. Entailment of condition formulas provides formal underpinning to RIF-BLD queries.

Definition (Models).
A multi-structure Î is a model of a formula, φ, written as Î |= φ, iff TValÎ(φ) = t. Here φ can be a document or a non-document formula. ☐

Definition (Logical entailment).
Let φ and ψ be (document or non-document) formulas. We say that φentailsψ, written as φ |= ψ, if and only if for every multi-structure, Î, Î |= φ implies Î |= ψ. ☐

Note that one consequence of the multi-document semantics of RIF-BLD is that local constants specified in one document cannot be queried from another document. For instance, if one document, Δ', has the fact "http://example.com/ppp"^^rif:iri("abc"^^rif:local) while another document formula, Δ, imports Δ' and has the rule "http://example.com/qqq"^^rif:iri(?X) :- "http://example.com/ppp"^^rif:iri(?X), then Δ |= "http://example.com/qqq"^^rif:iri("abc"^^rif:local) does not hold. This is because the symbol "abc"^^rif:local in Δ' and Δ is treated as different constants by semantic multi-structures.

This behavior of local symbols should be contrasted with the behavior of rif:iri symbols. Suppose, in the above scenario, Δ' also has the fact "http://example.com/ppp"^^rif:iri("http://cde.example.org"^^rif:iri). Then Δ |= "http://example.com/qqq"^^rif:iri("http://cde.example.org"^^rif:iri)does hold.

Recall that the syntax of RIF-BLD is not context-free and thus cannot be fully captured by EBNF or XML Schema. Still, validity with respect to XML Schema can be a useful test. To reflect this state of affairs, we define two notions of syntactic correctness. The weaker notion checks correctness only with respect to XML Schema, while the stricter notion represents "true" syntactic correctness.

Definition (Valid BLD document in XML syntax).
A valid BLD document in the XML syntax is an XML document that is valid with respect to the XML schema in Appendix XML Schema for BLD. ☐

The XML serialization for RIF-BLD is based on an alternating or striped syntax [ANF01]. A striped serialization views XML documents as objects and divides all XML tags into class descriptors, called type tags, and property descriptors, called role tags [TRT03]. We follow the tradition of using capitalized names for type tags and lowercase names for role tags.

The all-uppercase classes in the presentation syntax, such as FORMULA, become XML Schema groups in Appendix XML Schema for BLD. They are not visible in instance markup. The other classes as well as non-terminals and symbols (such as Exists or =) become XML elements with optional attributes, as shown below.

RIF-BLD also uses the ordered="yes" attribute to indicate that the children of
args and slot elements are ordered.

Example 6 (A RIF condition and its XML serialization).

This example illustrates XML serialization for RIF conditions. As before, the compact URI notation is used for better readability. Assume that the following prefix directives are found in the preamble to the document, whose XML form will be illustrated in Example 8:

Example 7 (An XML serialization of a RIF condition with a frame and a named-argument term).

This example illustrates XML serialization of RIF conditions that involve terms with named arguments. As in Example 6, we assume the following prefix directives, whose XML form will be illustrated in Example 8:

WhilethereisaRIF-BLDelementtagfortheImportdirective,theBaseandPrefixdirectivesarenotrepresentedbyRIF/XMLtags:theyarehandledasfollows(seealsoSectionMappingoftheRuleLanguage).ABasedirectiveinthepresentationsyntaxbecomesanxml:baseattribute[XML-Base]intheXMLDocumenttag.ThebaseIRIspecifiedasthevalueofthatattributeappliestocontentof the XMLSchemaDefinitionRIF/XMLelementthatdealswithrif:iriconstants,namelytorelative-IRIcontent of RIF-BLDisgiventhe<Consttype="&rif;iri">element.AcollectionofPrefixdirectives in AppendixXMLSchemathepresentationsyntaxbecomesaDOCTYPEDTD[XML1.0]precedingtheRIF-BLDDocumentandcontainingadeclarationofanENTITY for BLD.eachPrefixdirective.

This example shows a serialization for the document from Example 5. For convenience, the documentpresentationsyntax is reproduced at the toptop, and thenis followed by its serialization.
ThebaseIRIhttp://example.com/people#appliestotherelativerif:iriconstantswithcontentJohn(twice)andFred(once).

4.3 Mapping from the Presentation Syntax to the XML Syntax

This section defines a normative mapping, χbld, from the presentation syntax to the XML syntax of RIF-BLD.
The mapping is given via tables where each row specifies the mapping of a particular syntactic pattern in the presentation syntax. These patterns appear in the first column of the tables and the bold-italic symbols represent metavariables. The second column represents the corresponding XML patterns, which may contain applications of the mapping χbld to these metavariables. When an expression χbld(metavar) occurs in an XML pattern in the right column of a translation table, it should be understood as a recursive application of χbld to the presentation syntax represented by the metavariable. The XML syntax result of such an application is substituted for the expression χbld(metavar).
A sequence of terms containing metavariables with subscripts is indicated by an ellipsis.
For the subscript m it is understood that
m≥1, i.e. the ellipsis indicates at least one term.
For the subscript n it is understood that
n≥0, i.e. the ellipsis indicates zero or more terms.
A metavariable or a well-formed XML subelement is marked as optional by appending a bold-italic question mark, ?, on its right.

4.3.1 Mapping of the Condition Language

The χbld mapping from the presentation syntax to the XML syntax of the RIF-BLD Condition Language is specified by the table below.
Each row indicates a translation
χbld(Presentation) = XML. Thefunctionremove-outer-quotesusedinthetranslationremovesenclosingdoublequotesfromastringandleavesunquotedstringsuntouched.
Since the presentation syntax of RIF-BLD is context sensitive, the mapping must differentiate between the terms that occur in the position of individuals and the terms that occur as atomic formulas. To this end, in the translation table, the positional and named-argument terms that occur in the context of atomic formulas are denoted by expressions of the form pred(...) and the terms that occur as individuals are denoted by expressions of the form func(...).
In the table, each metavariable for an (unnamed) positional argumenti is assumed to be instantiated to values unequal to the instantiations of named arguments unicodestringnamej->fillerj. Regarding the last but first row, we assume that shortcuts for constants [RIF-DTB] have already been expanded to their full form ("..."^^symspace).

4.3.2 Mapping of the Rule Language

The χbld mapping from the presentation syntax to the XML syntax of the RIF-BLD Rule Language is specified by the table below. It extends the translation table of Section Mapping of the Condition Language. While the Import directive is handled by the presentation-to-XML syntax mapping, the Prefix and Base directives are not. Instead, these directives should be handled by expanding the associated shortcuts (compact URIs).
Namely, a prefix name declared in a Prefix directive is expanded into the associated IRI, while relative IRIs are completed using the IRI declared in the Base directive. The mapping χbld applies only to such expanded documents.
RIF-BLD also allows other treatments of Prefix and Base provided that they produce equivalent XML documents. One such treatment is employed in the examples in this document, especially Example 8. It replaces prefix names with definitions of XML entities as follows.
Each Prefix declaration becomes an ENTITY declaration [XML1.0] within a DOCTYPE DTD attached to the RIF-BLD Document. The Base directive is mapped to the xml:base attribute [XML-Base] in the XML Document tag.
Compact URIs of the form prefix:suffix are then mapped to &prefix;suffix.

4.3.3 Mapping of Annotations

The χbld mapping from RIF-BLD annotations in the presentation syntax to the XML syntax is specified by the table below.
It extends the translation tables of Sections Mapping of the Condition Language and Mapping of the Rule Language.
The metavariable Typetag in the presentation and XML syntaxes stands for any of the class names And, Or, External, Document, or Group, and Quantifier for Exists or Forall. The dollar sign, $, stands for any of the binary infix operator names #, ##, =, or :-, while Binop stands for their respective class names Member, Subclass, Equal, or Implies.
Again, each metavariable for an (unnamed) positional argumenti is assumed to be instantiated to values unequal to the instantiations of named arguments unicodestringnamej->fillerj.

5 Conformance Clauses

RIF-BLD does not require or expect conformant systems to implement the RIF-BLD presentation syntax. Instead, conformance is described in terms of semantics-preserving transformations between the native syntax of a compliant system and the XML syntax of RIF-BLD.

Let Τ be a set of datatypes and symbol spaces that includes the datatypes specified in
[RIF-DTB], and the symbol spaces rif:iri, and rif:local. Suppose Ε is a coherent set of external schemas that includes the built-ins listed in [RIF-DTB]. We say that a formula φ is a BLDΤ,Ε formula iff

it is a well-formed BLD formula,

all datatypes and symbol spaces used in φ are in Τ, and

all externally defined terms used in φ are instantiations of external schemas from Ε.

A RIF processor is a conformantBLDΤ,Εconsumer iff it implements a semantics-preserving mapping, μ, from the set of all BLDΤ,Ε formulas to the language L of the processor (μ does not need to be an "onto" mapping).

Formally, this means that for any pair φ, ψ of BLDΤ,Ε formulas for which φ |=BLD ψ is defined, φ |=BLD ψ iff μ(φ) |=L μ(ψ). Here |=BLD denotes the logical entailment in RIF-BLD and |=L is the logical entailment in the language L of the RIF processor.

A RIF processor is a conformantBLDΤ,Εproducer iff it implements a semantics-preserving mapping, ν, from the language L of the processor to the set of all BLDΤ,Ε formulas (ν does not need to be an "onto" mapping).

Formally, this means that for any pair φ, ψ of formulas in L for which φ |=L ψ is defined, φ |=L ψ iff ν(φ) |=BLD ν(ψ).

An admissible document is one which conforms to all the syntactic constraints of RIF-BLD, including ones that cannot be checked by an XML Schema validator (cf. Definition Admissible BLD document in XML syntax).

The above definitions are specializations to BLD of the general conformance clauses defined in the RIF framework for logic dialects [RIF-FLD]. The following clauses are further restrictions that are specific to RIF-BLD.

RIF-BLD specific clauses

Conformant BLD producers and consumers are required to support only the entailments of the form φ |=BLD ψ, where ψ is a closed RIF condition formula, i.e., a RIF condition in which every variable, ?V, is in the scope of a quantifier of the form Exists ?V. In addition, conformant BLD producers and consumers should preserve all annotations where possible.

A conformant RIF-BLDconsumerisaconformantBLD Τ,ΕconsumerinwhichΤconsistsonlyofthesymbolspacesanddatatypes,andΕconsistsonlyoftheexternal(functionandpredicate)schemasthatarerequiredbyRIF-BLD.Therequiredsymbolspacesarerif:iriandrif:local,andtherequireddatatypesandexternallydefinedschemasarethosespecifiedin[RIF-DTB].AconformantRIF-BLDconsumer must reject allinputsthatdonotmatchthesyntaxofBLD.Ifitimplementsextensions,anydocumentcontainingfeatures it maydosounderusercontrol--havinga"strictBLD"modeanda"run-with-extensions"mode.doesnotsupport.

A conformant BLD producer is a conformant BLDΤ,Ε producer, which produces documents that include only the datatypes and externals that are required by BLD.

FeatureAtRisk#3:StrictnessRequirementNote:Thisfeatureis"atrisk"andmaybealteredorremovedfromthisspecificationbasedonfeedback.Ifyouhaveconcernsaboutthisorinformationwhichmaybeusefulinoureventualdecision,pleasetellusatpublic-rif-comments@w3.org.Seethefulllistoffeatures"atrisk"inRIF.ThetwoprecedingclausesarefeaturesATRISK.Inparticular,the"strictness"requirementisunderdiscussion.RIF-BLD supports a wide variety of syntactic forms for terms and formulas, which creates infrastructure for exchanging syntactically diverse rule languages. It is important to realize, however, that the above conformance statements make it possible for systems that do not support some of the syntax directly to still support it through syntactic transformations. For instance, disjunctions in rule premises can be eliminated through a standard transformation, such as replacing p :- Or(q r) with a pair of rules p :- q, p :- r. Terms with named arguments can be reduced to positional terms by ordering the arguments by their names and incorporating the ordered argument names into the predicate name. For instance, p(bb->1 aa->2) can be represented as p_aa_bb(2 1).

6 RIF-BLD as a Specialization of the RIF Framework for Logic Dialects [RIF-FLD]

This normative section describes RIF-BLD by specializing RIF-FLD. The reader is
assumed to be familiar with RIF-FLD as described in RIF framework for
logic dialects [RIF-FLD]. The reader who is not interested in how RIF-BLD is
derived from the framework can skip this section.

6.1 The Presentation Syntax of RIF-BLD as a Specialization of RIF-FLD

This section defines the precise relationship between the presentation syntax of RIF-BLD and the syntactic framework of RIF-FLD.

Externalfunctionsignatureef.Thissignaturehasthesamearrowexpressionsasthesignaturef.Externalpredicatesignatureep.Thissignaturehasthesamearrowexpressionsasthesignaturep.In the RIF-BLD specialization of RIF-FLD, the argument names s1, ..., sk must be pairwise distinct.

Every symbol in Const has exactly one signatureoftheform:signature:individual, f, p,ef,or epp.

A constant cannot have the signature atomic,since-- only complex terms can have such signatures. Thus, by itself a symbol, ps, cannot be a proposition in RIF-BLD, but a term of the form p()s() can.

According to the above, each constant symbol in RIF-BLD can be either an individual, a plainfunction,aplainpredicate,anexternallydefinedfunction, or anexternallydefineda predicate. However, the same function orpredicate symbol (plain(normal or external) can occur with different numbers of arguments in different places.Similarly,predicatesymbolscanoccurwithdifferentnumbersofarguments.Notethatsuchpolyadictermswiththesamefunctionorpredicatesymbolbutdifferentaritiescouldbereplacedbytermswithfixedarities:thearityinformationcouldbeencodedinplaces.Also, the functionorpredicatenames.Forinstance,additionalrestrictionsspelledoutbelowensurethat the polyadicsamesymbolcannotrepresentbothanexternallydefined predicate termsp(?X)andp(?X,?Y)couldberepresented,Prolog-style,asp/1(?X)orfunction and p/2(?X,?Y),respectively,regardingtheslashaspartofthearegular predicate names.orfunction.

The constant symbols that correspond to RIF datatypes (XML Schema datatypes, rdf:XMLLiteral, rdf:PlainLiteral, etc.) all have the signature individual in RIF-BLD.

The symbols of type rif:iri and rif:local can have the following signatures in RIF-BLD: individual, f, p,ef,or epp.

All variables are associated with signature individual, so they can range only over individuals.

The signature for equality is ={(individual individual) ⇒ atomic}.

This means that equality can compare only those terms whose signature is individual; it cannot compare predicate or function symbols. Equality terms are also not allowed to occur inside other terms, since the above signature implies that any term of the form t = s has signature atomic and not individual.

Note that this precludes the possibility that a frame term might occur as an argument to a predicate, a function, or inside some other term.

The membership signature, #, is #{(individual individual) ⇒ atomic}.

Note that this precludes the possibility that a membership term might occur as an argument to a predicate, a function, or inside some other term.

The signature for the subclass relationship is ##{(individual individual) ⇒ atomic}.

As with frames and membership terms, this precludes the possibility that a subclass term might occur inside some other term.

RIF-BLD uses no special syntax for declaring signatures. Instead, the rule author specifies signatures contextually. That is, since RIF-BLD requires that each symbol is associated with a unique signature, the signature is determined from the context in which the symbol is used. If a symbol is used in more than one context, the parser must treat this as a syntax error. If no errors are found, all terms and atomic formulas are guaranteed to be well-formed. Thus, signatures are not part of the RIF-BLD language, and individualand,atomic,list,etc., are not reserved keywords.

Supported types of terms.

RIF-BLD supports the following types of terms defined by the syntactic framework (see the Section Terms of [RIF-FLD]):

constants

variables

positional

with named arguments

equality

frame

membership

subclass

list

external

formula

Compared to RIF-FLD, terms (both positional and with named arguments) have significant restrictionsinorderrestrictions,whichareintended to keep BLD relatively simple.

Variables: The signature for the variable symbols does not permit them to occur in the context of predicates, functions, or formulas. In particular, in the RIF-BLD specialization of RIF-FLD, a variable is not an atomic formula.

Likewise,Symbolsasatomicformulas: A symbol cannot be an atomic formula by itself. That is, if ps ∈ Const then ps is not a well-formed atomic formula. However, p()s() can be an atomic formula. Note that Propositional Logic can thus be expressed in RIF-BLD using zero-argument predicate formulas.

Functionsandpredicates: Signatures permit only constant symbols to occur in the context of functions or predicate. Indeed, RIF-BLD signatures ensure that all variables have the signature individual{ } and all other terms, except for the constants from Const, can have either the signature individual{ } or atomic{ }. Therefore, if t is a (non-Const) term then t(...) is not a well-formed term.

In an externally defined term, External(t), thesubtermt can be only a positional or a named-argument term.termoftheforms(...)whereshasthesignatureforp. Compared to RIF-FLD, this restricts t so that it cannot be a constant, a frame, an equality, or a classification term. RIF-FLD's two-argument form of External is not supported in RIF-BLD either.

Combinedwiththefactthatinawell-formedtermoftheformExternal(t)thesubtermtmustbeaninstantiationofanexternalschema(bythedefinitionofwell-formedexternaltermsinRIF-FLD),itfollowsthatapredicateorafunctionsymbol,p,thatoccursinanexternaltermExternal(p(...))cannotalsooccurasanon-externalsymbol.Ifaterm,t,isaninstantiationofanexternallydefinedschemafromthecoherentsetofexternalschemasassociatedwithFormula: The language,thentcanoccuronlyformulatermsarerestricted, as External(t),i.e.,specifiedinSupportedformulasbelow.Inparticular,theycannotappear as anexternaltermoratomicformula.argumentstopredicates,functions,etc.

A RIF-BLD condition is an atomic formula, andexternalatomicformula,or a conjunctive or disjunctive combination of such atomic formulas,oranexternalatomicformula.formulas. All these formulasandtheircombinations can be optionally haveprecededwith existential quantifiers.

RIF-BLD rule

A RIF-BLD rule is a universally quantified RIF-FLD rule with the following restrictions:

The conclusion of the rule is an atomic formula or a conjunction of atomic formulas.

Note:Thisfeature(Equalityintheruleconclusion)is"atrisk".Seefeatureatrisk#2None of the atomic formulas mentioned in the rule conclusion is externally defined (i.e., cannot have the form External(...)).

The premise of the rule is a RIF-BLD condition.

All free (non-quantified) variables in the rule must be quantified with Forall outside of the rule (i.e., Forall ?vars (conclusion :- premise)).

Universal fact

A universal fact is a universally quantified atomic formula with no free variables.

RIF-BLD group

A RIF-BLD group is a RIF-FLD group that contains only RIF-BLD rules,
universal facts, variable-free rule implications, variable-free atomic formulas, and RIF-BLD groups.

RIF-BLD document

A RIF-BLD document is a RIF-FLD document that consists of directives and a RIF-BLD group formula. There is no Dialect or Module directives, and the Import(<loc>) directive (with one argument) can import RIF-BLD documents only. Here loc must be a Unicode character sequence that forms an IRI. There are no BLD-specific restrictions on the two-argument directive Import except that the second argument must be a Unicode sequence of characters of the form <loc>, where loc is an IRI.

Negation (whetherclassicalordefault)(NegandNaf) is not allowed in RIF-BLD rules: neither in rule conclusions nor in premises.

6.2 The Semantics of RIF-BLD as a Specialization of RIF-FLD

This normative section defines the precise relationship between the semantics
of RIF-BLD and the semantic framework of RIF-FLD. Specification of the
semantics that does not rely on RIF-FLD is given in Section Direct Specification of RIF-BLD Semantics.

RIF-BLD does not support negation. This is the only obvious simplification with respect to RIF-FLD as far as the semantics is concerned. The restrictions on the signatures of symbols in RIF-BLD do not affect the semantics in a significant way.

Truth values.

The set TV of truth values in RIF-BLD consists of two values, t and f, such that f <tt.

Recall that logical entailment in RIF-FLD is defined with respect to an unspecified set of intended semantic structures and that dialects of RIF must make this notion concrete. For RIF-BLD, this set is defined as the set of all models.

Import directive.

The semantics of the two-argument Import directive is given in [RIF-RDF+OWL]. The semantics of the one-argument directive is the same as in RIF-FLD.

BLD further requires strictness, i.e., that a conformant producer produces only the documents where T are precisely the datatypes/symbol spaces and E are the external schemas specified in [RIF-DTB], and that a conformant consumer consumes only such documents.

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:
Jos de Bruijn, Gary Hallmark, Stella Mitchell, Leora Morgenstern, Adrian Paschke, Axel Polleres, and Dave Reynolds,
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.