W3C

RIF Basic Logic Dialect

W3C Editor's Draft 24 September19 October 2007

This version:
(@@not-published, expands on the first published version)http://www.w3.org/2005/rules/wg/bld/draft-2007-10-19
Previous Editor's Draft:
http://www.w3.org/2005/rules/wg/bld/draft-2007-09-24 (Color-coded diff)
Latest TR version:
http://www.w3.org/TR/rif-core
Previous version: http://www.w3.org/TR/2007/WD-rif-core-20070330Editors:
Harold Boley (National Research Council Canada)
Michael Kifer (State University of New York at Stony Brook)

Abstract

This document, developed by the Rule Interchange Format (RIF) Working Group, specifies the basic design fora basic format that allows logic rules to be translatedexchanged between rule languages and thus transferred between rulerule-based systems.

InAs part of its Phase 1 ,deliverable, the RIF Working Group firstdefines a condition language, which is envisioned to be a shared part of all RIF dialects. In this document,The RIF Condition Language is usedintended to define rulebe used in the bodies of the rules in RIF Basic Logic Dialect (RIF BLD). We give an abstract syntax (with UML visualization) and semantics (model theory) for positive and slotted conditions as well as for a(RIF-BLD). The condition language is then extended to Horn rule language. Examples inrules and this document are based onspecifies a human-orientedpresentation syntax and ana corresponding concrete XML syntax, which are derived from the abstract syntax, but in the current working draft these syntaxes are used onlysyntax for explanations and illustration.RIF-BLD. A model-theoretic semantics for the language is also defined.

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

Please Comment By DD MM 2007 The Rule Interchange Format (RIF)ASAP

Working Group seeks public feedback on this Second Public Working Draft.participants please send yourcomments to public-rif-comments@w3.org ( public archive ). Ifas soon as possible, please offer specific changes to the text which will address your concern.for a 30 October publication decision. There may be new editor's drafts before then.

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.


Table of Contents

1. RIF Overview

(Editor's Note: This text is maintained on wiki page RIF Overview).

Based on the RIF Use Cases and Requirements, this document develops RIF BLDRIF-BLD (the Basic Logic Dialect of the Rule Interchange Format) through a set of foundational concepts that are intended to be shared by all logic-based RIF dialects. The overall RIF design takes the form of a layered architecture organized around the notion of a dialect.

A dialect is a rule language with a well-defined syntax and semantics. This semantics must be model-theoretic, proof-theoretic, or operational in this order of preference. Some dialects might be proper extensions of others (both syntactically and semantically) and some may have incompatible expressive power. RIF BLD has been designed to be extended by all future logic-based dialects

are required to extend the RIF Basic Logic Dialect.From a theoretical perspective, RIF BLDRIF-BLD corresponds to the language of definite Horn rules (see Horn Logic) with equality (andand with a standard first-order semantics).semantics. Syntactically, however, RIF BLDRIF-BLD has a number of extensions to support features such as objects and frames, internationalinternationalized resource identifiers (or IRIs)IRIs, defined by RFC 3987) as identifiers for concepts, and XML Schema data types. These latter features make RIF a Web language. However, RIF is designed to enable interoperability among rule languages in general, and its uses are not limited to the Web. The semantics of RIF has provisions for future extensions towards dialects that support pure FOL, dialects that support negation as failure (NAF), business (or production) rules, reactive rules, and other features.

Eventually, it is hoped that RIF dialects will cover a number of important paradigms in rule-based specification and programming. Our main target paradigms include production rules, logic programming, FOL-based rules, reactive rules, and normative rules (integrity constraints).

The central part of RIF is its Condition Language. The condition language defines the syntax and semantics for the bodies of the rules in RIF BLDRIF-BLD and the syntax for thequeries. However, it is envisioned that the Condition Language will have wider use in RIF. In particular, it might be used as a sublanguage for specifying the conditional part in the bodies of production rules (RIF PRD), reactive rules, and normative rules.

As mentioned, IRI constants are used in RIF both as logical constants,constants and as names of predicate,for predicate and offunction symbols. RIF BLDRIF-BLD does not allow the same symbol to play more than one of these roles, but the dialects that extend the BLDRIF-BLD may support polymorphic symbols (i.e., symbols that have more than one contextual use; e.g., of a constant and of a predicate). Such polymorphism is common practice in Logic Programming (e.g., [Prolog], [F-logic], [HiLog]) and in [RDF]. This extensibility is achieved in RIF by building its syntax on the basis of signatures. This draft also introduces a frame-based syntax and semantics and defines a normative way for RIF rules to interact with RDF.

The current document is the second draft of the RIF BLDRIF-BLD specification (in the first draft called 'RIF Core'). A number of extensions are planned to support built-ins, additional primitive XML data types, the notion of RIF compliance, and so on. Tool support for RIF BLDRIF-BLD is forthcoming. RIF dialects that extend BLDRIF-BLD will be specified in other documents by this working group.

2. RIF Condition Language

(Editor's Note: This text is maintained on wiki page RIF Condition Language).

The RIFcondition Languagesublanguage of RIF-BLD is intended to be a common basis for severalthe dialects of RIF. First of all, it is used by RIF BLD, as described in this document. The otherRIF-BLD itself. Future dialects or groups of dialects where the Condition Language or its extensions might be used include:

  • Rule bodies and queries in declarative logic programming dialects (LP)

  • Rule bodies in first-order dialects (FO)

  • Conditions in the rule bodies of the Production Rule Dialect (RIF PRD)

  • The event and condition parts of the rule bodies in reactive rule dialects (RR)

  • Integrity constraints (IC)

It should be noted, however, that apart from RIF BLDRIF-BLD and RIF PRDRIF-PRD no decision has been made regarding which dialects will ultimately be part of RIF.

The RIFcondition Languagesublanguage of RIF-BLD is intended to be used only in rule bodies and queries, not in rule heads. The various RIF dialects diverge in the way they specify, interpret, or use rulethe formulas that occur in their heads and in other components of the rules. By focusing on the condition part of the rule bodies we achieve maximum syntactic anda great deal ofsyntactic and semantic reuse among the dialects.

This Condition Languagepart of the document describes Positive Conditions and Slotted Conditions.

2.1. Positive Conditions

(Editor's Note: This text is maintained on wiki page Positive Conditions).

The languagesublanguage of positive RIFconditions in RIF-BLD determines what can appear as a body (the if-part)of a rule (also known as the if-part, antecedent, or condition part of the rule) supported by the basic RIF logic.RIF-BLD. As explained in Section Overview, RIF's Basic Logic DialectRIF-BLD corresponds to definite Horn rules, and the bodies of such rules are conjunctions of atomic formulas without negation. However, it is well-known that disjunctions of such conditions can also be used in the bodies of rules without changing the essential properties of the rule language. This is based on the fundamental logical tautologies (h ← b ∨ c) ≡ ((h ← b) ∧ (h ← c)) and ∀ x (F ∧ G) ≡ (∀ x F ∧ ∀ x G). In other words, a rule with a disjunction in the body can be split into two or more rules that have no such disjunction.

The condition language is intended to be shared among the bodies of the rules expressed in future RIF dialects, such as LP, FO, PR and RR. The condition language might also be used to uniformly express integrity contraints and queries. This section presents a syntax and semantics for the RIF condition language.To make RIF dialects suitable as Web languages, RIF supports XML Schema primitive data types and some other primitivedata types. In addition, RIF promotes the use of Internationalized Resource Identifiers (or IRIs) RFC 3987 to refer to individuals, predicates, and functions.

To ensure extensibility and to provide for future higher-order dialects based on formalisms,formalisms such as HiLog and Common Logic, the RIF logic language does not draw a sharp boundary between the symbols used to denote individuals from symbols used as names for functions or predicates. Instead, all constant, preficate,predicate, and function symbols are drawn from the same universal set. RIF dialects control the contexts in which the different symbols can occur by attaching signatures to these symbols.

RIF's basic logic dialectRIF-BLD carefully selects signatures for the symbols so that the corresponding logic will be first-order: each symbol has a unique role as a symbol that represents an individual,individual object, a function symbol of a particular arity, or a predicate symbol of a particular arity. However, dialects extending the basic logicRIF-BLD will be allowed to use signatures in less restrictive fashions so that symbols could be polymorphic, polyadic, andpolymorphic (i.e. be allowed to occur in several different contexts (for example, bothcontexts; e.g., as individuals and as predicates).predicates) and polyadic (i.e take a varying number of arguments).

We begin by describing a syntax, which is more general than what the basic logic dialectRIF-BLD permits. This syntax can be used in the various dialects that extend RIF's basic logic dialect.RIF-BLD. Then we introduce the notion of a signature and specify the restrictions on the way signatures are allowed to be assigned to symbols. Next we define the presentation syntax using EBNF and describe the corresponding XML-based exchange syntax. Finally, we give a model-theoretic semantics to RIF-BLD.

2.1.1. Syntax

In this document we will introduce severaltwo related but distinct syntaxes:

  • FormalPresentation syntax. This syntax is used in formal definitions, especially for the definitions and follows the standard textbook conventions for logical syntax. Presentation syntax. This syntax is closely related to the formal syntax and is derived fromsemantics. It by elaborating on the various aspects of RIF (such as, for example, data types). Thisis a human-oriented syntax, whichsyntax and, therefore, we use it in our the examples. Abstract syntax. This is a normative version ofthe RIF syntax. It is also derived frommodel theory and the formal syntax, but is more verbose thanexamples. The presentation syntax (this verbose nature of the abstract syntaxis the main reasonnot meant to be used for the presentation syntax).exchange of RIF rules.

  • XML syntax. This syntax is the normative XML serialization of the abstractpresentation syntax. The key features of this syntax are derived from the presentation syntax, but some aspects related to rule exchange do not have counterparts in the presentation syntax.

2.1.1.1. Formal PreliminariesSymbols and Signatures

The languagealphabet of RIF Condition Language consists of a countably infinite set of constant symbols Const, a countably infinite set of variable symbols Var (disjoint from Const), connective symbols And ∨, quantifier ∃,and Or, quantifier Exists, auxiliary symbols like (, ),symbols, such as "(" and so on.")". In the RIF presentation syntax, variables are written as Unicode strings preceded with the symbol "?". The syntax for constant symbols is given in Section Symbol Spaces below.

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

The basic language construct is called term, which is defined inductively as follows:

  • If tConst or tVar then t is a term.

  • If t and t1, ..., tn are terms then t ( tt ( t1 ... tn ) is a termterm.

This definition is very general. It makes no distinction between constant symbols that represent individuals, predicates, and function symbols. The same symbol can occur in multiple contexts at the same time. For instance, p(p(a) p(a b c))if p, a, and b are symbols then p ( p ( a ) p ( a p c ) ) is a term. Even variables and general terms are allowed to occur in the position of predicates and function symbols. For instance, p(a)(p(b c) q)symbols, so p ( a ) ( ?v ( a c ) p ) is also a term. To control the context in which any given symbol can occur in a RIF dialects,dialect, the language associates a signature with each symbol (both constant and variable symbols).

Signatures. Let SigNames be a non-emptynon-empty, partially-ordered finite or countably infinite set of signature names. We require that this set includes at least the following signature names: i and bool . The signature name i represents the context where the constants that denote individual objects are allowed to appear. Thename boolatomic, which represents the context of atomic formulas. ADialects are free to introduce additional signature names. For instance, as we shall soon see, RIF-BLD also introduces another signature, term{ }. The partial order on SigNames is a statement ofdialect-specific (see, the form η{ especifics for RIF-BLD later); it is used in the definition of well-formed terms below.

We use the symbol < to represent the partial order on SigNames. Informally, α < β means that terms with signature α can be used wherever terms with signature β are allowed.

A signature is a statement of the form η{e1 ..., ..., en, ...} where η ∈ SigNames is the name of the signature and {e1 ..., ..., en, ...} is a countable set of signaturearrow expressions. ThisSuch a set can thus be empty,infinite, finite, or countably infinite.even empty. In RIF's basic logic dialect, this set willRIF-BLD, signatures can have at most one expression, but in more expressivearrow expression. Other dialects a signature can have(such as HiLog, for example) may require polymorphic symbols and thus allow signatures with more than one expression, and in this way they can support polymorphism. A signature expression can be a base signature expression or anarrow signatureexpression (as a special case,in them.

An arrow expression can be a Boolean signature expression ),is defined as follows, wherefollows:

  • If κ, κ1, ..., κn, and κn≥0, are signature names from SigNames : i and bool are basic signature expressions ., then1 ... κn) ⇒ κ, where n≥0,κ is an arrow signatureexpression. In particular, () ⇒ iterm and ( iterm) ⇒ iterm are arrow signatureexpressions.

  • If κ above is boolatomic then the signature is called a Boolean signatureexpression.

A set S of signatures is said to becoherent if itiff

  • S contains the signatures i { } and bool { },special signature atomic{ }, which representrepresents the context of individual objects andatomic formulas; and

  • no two different signatures inS have the samehas at most one signature for any given signature name.

  • Well-formed termsWhenever S contains a pair of signatures, ηS and formulas. RIF uses signatures to controlκR, such that η<κ then RS. Here ηS denotes a signature with the context in which terms can appear throughname η and the notionassociated set of well-formed terms and well-formed atomic formulas. First, as mentioned above, eacharrow expression S; similarly κR is a signature named κ with the set of expressions R. The requirement that RS ensures that symbols that have signature η can be used wherever the symbols with signature κ are allowed.

2.1.1.2. Well-formed Terms and Formulas

Signatures help control the context in which various symbols can occur through the notion of well-formed formulas. First, as mentioned above, each constant and variable symbol (constant or variable)is associated with exactly one signature from a coherent set of signatures. (DifferentDifferent symbols can be associated with the same signature, but oneno symbol cannotcan be associated with more than one signature.) If σ is asignature. Since signature thennames uniquely identify signatures in coherent signature sets, we will often use σ #signature names to denote the name ofrefer to signatures. For instance, we may say that signature.symbol f has signature atomic rather than that "f has signature atomic{ }" or that "f has signature named atomic."

  • If s is a constant or variable symbol with signature η{...} and a base expression i or bool belongs to the set {...} associated with that signatureη then s is a well-formed term with signature i { } or bool { }, respectively. Noteη.

  • A term t ( t1 ... tn ), 0≤n, is a well-formed term whose signature is σ iff

    • t is a well-formed term that if symbol shas a signature, say, κ{ i ( i )⇒ bool }which contains an arrow expression of the form 1 ... σn) σ; and

    • symbolEach t hasi is a well-formed term whose signature ρ{(is σ'i )⇒, such that σ'i (, < σi )⇒ bool } then, according to the above definition, s.

    • As a special case, when n=0 we obtain that t ( ) is a well-formed term, while t is not. Also, according to this definition theterm with signature of a symbol can be different from theσ, if t's signature ofcontains the same symbol when it is viewed as a term. For instance, in the above example, s has a signature κ{ i ( i )⇒ bool } as a symbol, but its signature as a term is i { }. Furthermore, a symbol always has just one signature (which might have many arrow expressions in it), but a term can have several signatures. For instance, if symbol q has the signature δ{ i bool } then q as a well-formed term has two signatures: i { } and bool { }. Although some symbols can have signatures as symbols and signatures as terms, it will be clear from the context which signature is meant. Complex terms (defined below) are not symbols and so they can have signatures only as terms. A term t ( t 1 ... t n ) is a well-formed term with signature σ iff t is a well-formed term with signature σ 0 ; Each t i is a well-formed term with signature σ j , j = 1,...,n (the σ j 's are not necessarily distinct); and σ 0 contains anarrow expression of the form 1 # ... σ n # )()σ #σ.

  • A term t ( tt ( t1 ... tn ) is a well-formed atomic formula iff it is a well-formed term with the signature bool { }.atomic.

Note that f()according to the above definition f ( ) and f are distinct terms andterms.

More general formulas are constructed out of atomic formulas with the proposed XML serialization also treats these as distinct fragmentshelp of XML:logical connectives. The nullary function application <Uniterm><Const>f</Const></Uniterm> vs.condition sublanguage of RIF-BLD defines the symbol <Const>f</Const>following general well-formed condition formulas.

  • RIF defines that thereIf φ is a special predicate, = , which denotes equality. Like other predicateswell-formed atomic formula then it hasis also a signature, and this signature includes the Boolean expression ( i iwell-formed condition formula.

  • If are φ1, ..., φn, n 0, are well-formed condition formulas then so is And ( φ1 ... φn ) bool. As a special case, And ( ) is allowed and possibly other expressions of the form ( s s ) bool , where sis treated as a signature name. No other signaturestautology true.

  • If φ1, ..., φn, n 0, are allowed for =well-formed condition formulas then so is Or ( φ1 ... φn ). When n=0, we note thatget Or ( ) as a special case; it is common practice to write the atomic formulas involving = using infix notation, i.e., a = b instead of =(a,b) . The equality predicate has special model-theoretic semantics,treated as explained in Section Model Theory for RIF's Basicfalse -- a formula that is always false.

  • If φ is a well-formed condition Language .formula and ?V1, ..., ?Vn are variables then Exists ?V1 ... ?Vn ( φ ) is a well-formed condition formula.

Examples. ToWe illustrate the above definitions, we give severaldefinitions with the following examples. In addition to atomic, the examples also use another signature, term{ }. As we shall soon see, this signature is used in RIF-BLD.

Consider the term p(p(a) p(a b c))p ( p ( a ) p ( a b c ) ). If p has the (polymorphic) signature myPsigmysig{( iterm)⇒ iterm, ( i iterm term)⇒ iterm, ( i i iterm term term)⇒ iterm} and a, b, c each has the signature i { }term{ } then p(p(a) p(a b c))p ( p ( a ) p ( a b c ) ) is a well-formed term with signature i { }. If, for instance,term{ }. If instead p 'shad the signature were myPsig2mysig2{( i iterm term)⇒ iterm, ( i i iterm term term)⇒ iterm} then p(a)p ( p ( a ) p ( a b c ) ) would not have beenbe a well-formed term and the entire termsince then p ( a ) would alsonot be ill-formed. Here is another, fancier, signature forwell-formed (in this case, p under which the above termwould be well-formed (and againhave no arrow expression which allows p to take just one argument).

For a more complex example, let r have the signature i{ }): myPsig3mysig3{( iterm)⇒ boolatomic, ( bool iatomic term)⇒ iterm, ( i i iterm term term)⇒ iterm}. Then r ( r ( a ) r ( a b c ) ) is well-formed. The interesting twist here is that r ( a ) is a Boolean rather than an individual, but this is allowed by the arrow expression (atomic term)⇒ term, which is part of r's signature. If pr's signature were myPsig4mysig4{( iterm)⇒ boolatomic, ( bool iatomic term)⇒ boolatomic, ( i i iterm term term)⇒ iterm} instead, then p(p(a) p(a,b,c))r ( r ( a ) r ( a b c ) ) would have beenbe not only a well-formed term with signature bool { } and, therefore, it would have beenterm, but also a well-formed atomic formula.

An even more advanced example of a signatureusing signatures is when the right-hand side of an arrow expression is a signaturesomething other than iterm or boolatomic. For instance, let John, Mary, NewYork, and Boston have signatures i { };term{ }; flight and ancestorparent have signaturessignature h2 {i ( i i{(term term)⇒ boolatomic}; and closure have signature hh1{(h2)⇒p2}, where the signature p2 is the name ofhas the signatureform p2{( i iterm term)⇒ boolatomic}. Then closure(flight)(NewYork,Boston)flight ( NewYork Boston ), closure ( flight ) ( NewYork Boston ), parent ( John Mary ), and closure(ancestor)(John,Mary)closure ( parent ) ( John Mary ) would be well-formed formulas. Such formulas are allowed in languages like HiLog, which support predicate constructors like closure in ourthe above example.

More general formulas are constructed out of atomic formulas with2.1.1.3. Symbol Spaces

Throughout this document, the helpxsd: prefix stands for the XML Schema namespace URI http://www.w3.org/2001/XMLSchema#, the rdf: prefix stands for http://www.w3.org/1999/02/22-rdf-syntax-ns#, and rif: stands for the URI of logical connectives. RIF's Basic Condition Language definesthe following general well-formed formulasRIF namespace, http://www.w3.org/2007/rif#. If φ isSyntax such as xsd:string should be understood as a well-formed atomic formula then it is alsocompact uri -- a general well-formed formula. If are φ and ψ are general well-formed formulas then so is φ ψ. If are φ and ψ are general well-formed formulas then so is φ ψ. If φ is a well-formed general formula and V 1 , ..., V n are variables then V 1 ... V n φ is a general well-formed formula. Signatures in the RIF Basic Condition Language. RIF's basic condition language presents a much simpler picturemacro that expands to a concatenation of the usercharacter sequence denoted by restrictingthe setprefix xsd and the string string. In the next version of well-formed termsthis document we intend to introduce a specific coherent set of signatures. Namely,syntax for defining prefixes for compact URIs.

TODO: Define CURIs.

The signatureset of RIF's basic logic language contains the following signatures: i { } and bool { } For every integer arity n 0, there are signatures f n {( i ... i ) i } and p n {( i ... i ) bool } (there are n i 's inside the parentheses), which represent functionall constant symbols in RIF has a number of arity npredefined subsets, called symbol spaces, which are used to represent XML data types, data types defined in other W3C specifications, such as rdf:XMLLiteral, and predicate symbolsto distinguish other sets of arity n, respectively. In additionconstants. Constant symbols that belong to i and bool ,the symbols f nvarious symbol spaces have special presentation syntax and p n are reserved signature names in the RIF basic logic dialect. In this way, each constantsemantics.

Formally, a symbol can be either an individual,space is a predicatenamed subset of one particular arity, or a function symbolthe set of one particular arity.all variables are associated with signature i { }, so they can range only over individuals. The equality symbol, = , has signature p 2 {( i i ) bool }. In this way, the equality predicate can compare onlyconstants, Const. The terms whose signature is i{ }; it cannot compare predicate names or function symbols.semantic aspects of symbol spaces. Throughout this document, the rif: prefix will stand for the XML Schema namespace URI http://www.w3.org/2001/XMLSchema and rif:spaces will standbe described in Section Model Theory for the URICondition Language of theRIF namespace, http://www.w3.org/2007/rifBLD.

The set of all constant symbols in RIFEach symbol space has an associated lexical space and a number of predefined subsets, called symbol spaces , which are used to represent XML data types, data types defined in other W3C specifications, such as rdf:XMLLiteral , and to distinguish other sets of constants.identifiers.

  • The following primitive data types are supported: xsd:long ( http://www.w3.org/2001/XMLSchema#long ), xsd:string ( http://www.w3.org/2001/XMLSchema#string ), xsd:decimal ( http://www.w3.org/2001/XMLSchema#decimal ), xsd:time ( http://www.w3.org/2001/XMLSchema#time ), xsd:dateTime http://www.w3.org/2001/XMLSchema#dateTime ), and rdf:XMLLiteral ( http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral ). Basic RIF logic defines two additional symbol spaces: rif:iri (for internationalized resource identifier or IRI ) and rif:local (for constant symbols that are not visible outsidelexical space of a particularsymbol space is a non-empty set of RIF formulas). Constant symbols that belong to the various symbol spaces will have special presentation syntax, and semantic structures will interpret them inUnicode character strings.

  • An identifier of a special way. Insymbol space is an absolute IRI. The formal syntax, however, support forsame symbol spaces only requires usspace is allowed to state thathave more than one identifier (but different symbol spaces cannot share an identifier).

    To simplify the set Const of all constant symbols has subsets Const xsd:long , Constlanguage, this document will often use symbol space identifiers to refer to the actual symbol spaces (for instance, we may say "symbol space xsd:string , Const xsd:decimal , Const xsd:time , Const xsd:dateTime , Const rdf:XMLLiteral , Const rif:iri , and Const rif:local . These sets" instead of symbols are described"symbol space identified by xsd:string").

To refer to a constant in more detail later. 2.1.1.2. Abstract Syntaxa particular RIF symbol space, we defineuse the Abstract Syntax of BLD with (strictly) alternating syntactic class/property categories, i.e. in a "(fully) striped" manner. Sectionfollowing presentation Syntax will then proceed to a "stripe-skipped" or "unstriped" human-readable syntax as well as tosyntax:

     LITERAL^^SYMSPACE

where LITERAL is a (fully) striped XML syntax. TODO: Explain "fully striped." To compare two approaches at [ F2F7 ], we representUnicode string, called the abstract syntaxlexical part of the RIF Condition Language both in Abstract Syntax Notationsymbol, and in Abstract EBNF Syntax. 2.1.1.2.1. Abstract Syntax Notation The abstract syntax of the condition languageSYMSPACE is given in asn06 as follows: class CONDITION subclass And property formula : list of CONDITION subclass Or property formula : list of CONDITION subclass Exists property declare : list of Var property formula : CONDITION subclass ATOMIC class ATOMIC subclass Uniterm subclass Equal class Uniterm property op: Const property arg: list of TERM class Equal property side: list of TERM class TERM subclass Const property name: CONSTNAME property type: TYPENAME? subclass Var property name: VARNAME subclass Uniterm The lengthan identifier of the list of Var ofsymbol space in the declare property (role)form of the Exists class is assumed toan absolute IRI string. LITERAL must be 1 or more.an element in the multiplicitylexical space of the side propertysymbol space. For instance, 1.2^^xsd:decimal and 1^^xsd:decimal are legal symbols because 1.2 and 1 are members of the Equal classlexical space of the XML data type xsd:decimal. On the other hand, a+2^^xsd:decimal is assumed to be exactly 2. 2.1.1.2.2. Abstract EBNF Syntax We representnot a legal symbol, since a+2 is not part of the abstract syntaxlexical space of xsd:decimal.

RIF-compliant implementations must support the following symbol spaces. Rule sets that are exchanged through RIF Condition Language withcan use additional symbol spaces as explained below.

  • xsd:long (http://www.w3.org/2001/XMLSchema#long).

  • xsd:string (http://www.w3.org/2001/XMLSchema#string).

  • xsd:integer (http://www.w3.org/2001/XMLSchema#integer).

  • xsd:decimal (http://www.w3.org/2001/XMLSchema#decimal).

  • xsd:time (http://www.w3.org/2001/XMLSchema#time).

  • xsd:dateTime http://www.w3.org/2001/XMLSchema#dateTime).

The helplexical spaces of usual EBNF , employed here to define BLD in a fully striped normal form. In this Abstract EBNF Syntax ,the propertiesabove symbol spaces are named using idioms ofdefined in the form ' name ->' , e.g. 'formula ->'document XML Schema Part 2: Datatypes.

  • CONDITION ::= 'And' '(' ('formula ->' CONDITION)* ')' | 'Or' '(' ('formula ->' CONDITION)* ')' | 'Exists' '(' ('declare ->' Var)+ 'formula ->' CONDITION ')' | ATOMIC ATOMIC ::= Uniterm | Equal Uniterm ::= 'Uniterm' '(' 'op ->' Const ('arg ->' TERM)* ')' Equal ::= 'Equal' '(' 'side ->' TERM 'side ->' TERM ')' TERM ::= 'Const'rdf:XMLLiteral ( '(' 'type ->' TYPENAME ')' )? '(' CONSTNAME ')' | 'Var' '(' VARNAME ')' | Unitermhttp://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral).

    This symbol space represents XML content. The above abstract syntax can be illustrated with a UML diagram, as shown below. Automatic transformation fromlexical space of rdf:XMLLiteral is defined in the document Resource Description Framework (RDF): Concepts and Abstract EBNFSyntax to UML can be implemented based on the earlier asn06-to-UML transformation.

  • rif:text (for text strings with language tags attached).

    This symbol space represents text strings with a language tag attached. The central classlexical space of RIF, CONDITION ,rif:text is specified recursively through its subclasses and their parts.the Equal class has two side roles. Two pairsset of roles distinguish between the declare and formula parts of the Exists class, and between the operation ( op ) and arguments ( arg )all Unicode strings of the Uniterm class, where multiple arguments are subject to an ordered constraint (the natural "left-to-right" order): The syntactic classes are partitioned into classesform ...@LANG, i.e., strings that will not be visible in serializations (writtenend with @LANG where LANG is a language identifier as defined in all-uppercase letters) and classesIETF RFC 3066.

  • rif:iri (for internationalized resource identifier or IRI).

    Constant symbols that willbelong to this symbol space are intended to be visibleused in instance markup (written witha leading uppercase letter only). The three classes Var , CONDITION , and ATOMIC will be required in the abstract syntax of Horn Rulesway similar to RDF resources. 2.1.1.3. Presentation SyntaxThe abstract syntaxlexical space consists of Section Abstract Syntax can be loweredall absolute IRIs as specified in RFC 3987; it is unrelated to a presentation syntax. The Presentation EBNF Syntax below, which lowersthe Abstract Syntax,XML primitive type anyURI. A rif:iri constant is used throughout this documentsupposed to be interpreted as a reference to explainone and illustratethe main ideas. This syntax is similarsame object regardless of the context in style to whatwhich that constant occurs.

  • rif:local (for constant symbols that are not visible outside of a particular set of RIF formulas).

    Symbols in OWL is called the Abstract Syntax http://www.w3.org/TR/owl-semantics/syntax.html . Presentation EBNF Syntax. The human-oriented presentation syntax, describedthis symbol space are used locally in their respective rule sets. This EBNF (usual except for whitespace handling), is workmeans that occurrences of the same rif:local-constant in progress and under discussion. CONDITION ::= 'And' '(' CONDITION* ')' | 'Or' '(' CONDITION* ')' | 'Exists' Var+ '(' CONDITION ')' | ATOMIC ATOMIC ::= Uniterm | Equal Uniterm ::= Const '(' TERM* ')' Equal ::= TERM '=' TERM TERM ::= Const | Var | Uniterm Const ::= CONSTNAME | '"'CONSTNAME'"''^^'TYPENAME Var ::= '?'VARNAMEdifferent rule sets are viewed as unrelated distinct constants, but occurrences of the above is a standard syntax for a variantsame constant in the same rule set must refer to the same object. The lexical space of first-order logic.rif:local is the applicationsame as the lexical space of axsd:string.

Symbols with an ill-formed lexical part. RIF constant symbols that belong to one of the aforesaid RIF-supported symbol from Constspaces must be well-formed, i.e., their lexical part must belong to the lexical space associated with the symbol space. For instance, 123^^xsd:long has a sequence of terms is called Uniterm ("Universal term")correct lexical part, since it can be used123 belongs to playthe rolelexical space of a function term or an atomic formula depending onthe syntactic contextdata type xsd:long. In which the application occurs. The non-terminal ATOMIC stands for (positive) atomic formula , which can later be complementedcontrast, abc^^xsd:long is ill-formed, as it does not have a correct lexical part. A compliant RIF-BLD interpreter must reject ill-formed symbols.

Symbols with "negated atomic formula".undefined symbol spaces. RIF allows symbols of the 'Exists' formula is an "existential formula", which in Horn-like conditionsform LITERAL^^SYMSPACE where SYMSPACE is not one of the only quantified formula butpre-defined RIF symbol spaces. These are treated as "uninterpreted" constant symbols in later conditions may be complemented with "universal formula" ( Var+ denotesthe listRIF language and the lexical space of free variables in CONDITION ).such a symbol space is considered to be the 'And' formula defines conjunctionsset of conditions, and 'Or' denotes disjunctions. Finally, CONDITION assembles everything into what we call RIF conditions . RIFall Unicode strings. Dialects willthat extend these conditionsRIF-BLD might appropriate some of the symbol spaces, which are left undefined in various ways. Note that individuals, function symbols,RIF-BLD, and predicate symbols all belonggive them special semantics.

2.1.1.4. Signatures Used in the RIF-BLD Language

The condition language of RIF-BLD presents a much simpler picture to the sameuser by restricting the set of symbols ( Const ). This syntax is more general than what RIF's basic logic dialect actually permits. As explained in Section Formal Preliminarieswell-formed terms to a specific coherent set of signatures restricts this syntax to allow onlysignatures. Namely, the terms that are allowed in standard first-order logic.signature set of RIF-BLD contains the above Presentation EBNF Syntax, where TERM* is understood as TERM* ::= | TERM TERM*following signatures:

  • term{ }, uses spaces to indicate Lisp-like whitespace ( SPACEatomic{ }, TABbi_atomic{ }, or NEWLINE ) character sequences inwhere bi_atomic<atomic.

    The defined language; these must consist of at least one whitespace character when used assignature term{ } represents the separator between adjacent TERM s, andcontext in which individual objects (but not atomic formulas) can consist of zero or more whitespace characters elsewhere. Where spaces are omitted fromappear. The Presentation EBNF Syntax,signature bi_atomic{ } represents atomic formulas for builtin predicates (such as between '?' and VARNAME in '?'VARNAMEfn:substring). Since bi_atomic<atomic, there must be no whitespace character in the defined language. Constant symbols can have two forms: CONSTNAMEbuiltin atomic formulas are also atomic formulas, but normally most atomic formulas are user-defined and "CONSTNAME"^^TYPENAME . The second form is more general. The first form is used as a shorthand for some symbol spaces, like long integers, decimals, local RIF constants, etc.they will have the precise syntaxsignature atomic rather than bi_atomic.

  • For RIF constants is given in Section Primitive Data Types . At this point we do not commit to any particular vocabulary for the names of variables. These are assumed to be alphanumeric character sequences starting with a ?-sign. **** MK: should probably be more specific: Varsevery integer n 0, there are alphanums starting with a ? or something like ?'.....', if non-alphanum characterssignatures fn{(term ... term) term}, pn{(term ... term) atomic}, and bin{(term ... term) bi_atomic} (in each case there are involved.n terms inside the loweringparentheses), which represent function symbols of arity n, (user-defined) predicate symbols of arity n, and n-ary builtin predicates, respectively. The abstract syntax to this presentation syntax can be done via automatic EBNF-to-EBNF mapping. The mapper, abs2con4g (" abs tract to con crete for g rammar"), uses a TokenTable parameter specifying how to map certain abstract classes,symbols fn pn, and bin are reserved signature names in prefix notation, to operators,RIF-BLD.

  • A symbol in infixConst can have exactly one signature, fn, pn, or prefix notation. This table is given inbin, where n 0. It cannot have the formsignature atomic or bi_atomic (only terms can have such signatures, not symbols). Thus, in RIF-BLD each constant symbol can be either an individual, a predicate of binary class2token facts, accessed viaone particular arity, a lookup function. The main mapper is given in the formbuiltin of (left-to-right oriented) equations defining abs2con4g asone particular arity, or a binaryfunction withsymbol of one particular arity -- it is not possible for the abstract syntax as first argument,same symbol to play more than one role.

  • The table as second argument,constant symbols that correspond to XML Schema data types all have the signature term in RIF-BLD. The symbols of type rif:iri and rif:local can have the presentation syntax as returned value. class2token('Equal','=') class2token('type','^^') class2token('Var','?') abs2con4g(?Production1 ... ?ProductionN, ?TokenTable) = abs2con4g(?Production1, ?TokenTable) ... abs2con4g(?ProductionN, ?TokenTable) abs2con4g(?LeftSymbol ::= ?RightExpression, ?TokenTable) = ?LeftSymbol ::= abs2con4g(?RightExpression, ?TokenTable) abs2con4g('And' '(' ('formula ->' CONDITION)* ')' | 'Or' '(' ('formula ->' CONDITION)* ')' | 'Exists' '(' ('declare ->' Var)+ 'formula ->' CONDITION ')' | ATOMIC, ?TokenTable) = 'And' '(' CONDITION* ')' | 'Or' '(' CONDITION* ')' | 'Exists' Var+ '(' CONDITION ')' | ATOMIC abs2con4g(Uniterm | Equal, ?TokenTable)following signatures in RIF-BLD: term, fn, pn, or bin, for n = Uniterm | Equal abs2con4g('Uniterm' '(' 'op ->' Const ('arg ->' TERM)* ')', ?TokenTable)0,1,....

  • All variables are associated with signature term{ }, so they can range only over individuals.

  • RIF-BLD also reserves a special constant, = Const '(' TERM* ')' abs2con4g('Equal' '(' 'side ->' TERM 'side ->' TERM ')', ?TokenTable), to represent the predicate of equality. The equality symbol, =, has signature p2{(term lookup('Equal',?TokenTable)term abs2con4g(Const | Var | Uniterm, ?TokenTable) = Const | Var | Uniterm abs2con4g('Const' ('(' 'type ->' TYPENAME ')')? '(' CONSTNAME ')', ?TokenTable) = CONSTNAME(lookup('type',?TokenTable)TYPENAME)? abs2con4g('Var' '(' VARNAME ')', ?TokenTable) = lookup('Var',?TokenTable)VARNAME Note) atomic}. This means that variables inthe RIF Condition Languageequality predicate can be free or quantified . All quantificationcompare only the terms whose signature is explicit. All variables introduced by quantification must also occur interm; it cannot compare predicate names or function symbols.

    The quantified formula. Initially, only existential quantificationequality predicate is used. Universal quantification will be introduced later.said to belong to the symbol space rif:local so, strictly speaking, we should write it as =^^rif:local. However, we adoptwill usually omit the usual scoping rulessymbol space, for quantifiers from first-order logic. Variables that are not explicitly quantified are free . Free variables arise because CONDITION can occur in an if partreadability.

    For convenience we will write equations using infix notation, i.e., a = b instead of a rule. When this happens,=(a,b). The free variablesequality predicate has special model-theoretic semantics, as explained in aSection Model Theory for Condition formula are precisely those variablesLanguage of RIF BLD.

    Note that also occuralthough = has a special semantics, it is not a builtin predicate. In the then partparticular, terms of the rule. We shall see in Section Horn Rules that such variables are quantified universally outside ofform a = b have the rule,signature atomic and the scope of such quantificationnot bi_atomic.

RIF-BLD requires no extra syntax for declaring signatures, since signatures can be inferred. Indeed, RIF-BLD requires that each symbol is associated with a unique signature. Therefore, the entire rule. For instance,signature can be determined from the variable ?Ycontext in which the first RIF condition of Example 1 is quantified, existentially, but ?Xsymbol is free. However, when this condition occurs in theused. If part of the second rule in Example 1, then this variablea symbol is quantified universally outside of the rule. (The precise syntax for RIF rules will be given in Section Horn Rules .) Example 1 (A RIF conditionused in and outside ofmore than one context, the parser should treat it as a rule) RIF condition: Exists ?Y (condition(?X ?Y)) RIF Horn rule: Forall ?X (then-part(?X) :- Exists ?Y (condition(?X ?Y))) When RIF conditionssyntax error. If no errors are used as queries, their free variables carry answer bindings back to the caller. 2.1.2. Symbol Spacesfound, all uniterms and Primitive Data Types Following N-Triples , we will use the following presentation syntax to specify the constant symbols that belongatomic formulas are guaranteed to be well-formed. As a symbol space label : "literal"^^label For instance, "123"^^xsd:long is a symbol that belongs toconsequence, signatures are not part of the symbol space xsd:longRIF-BLD language and term, "2007-11-23T03:55:44-02:30"^^xsd:dateTime is a symbol in symbol space xsd:dateTimeatomic, and "ftp://example.com/foobar"^^rif:iri is a symbol that belongsbi_atomic are not reserved keywords.

Builtin predicates are not subject to the symbol space rif:iri .above signature inference rule. The partsignatures of such a symbol that occurs insidethe double quotes is called the lexical form of the symbol. The surrounding double quotesbuiltin predicates are not part of the literal. If a double quote is included as part of a literal, it must be escapeddefined by List_of_functions_and_operators. In particular, all symbols with the backslash. Some data typeshttp://www.w3.org/2005/xpath-functions# prefix are considered to be builtins and have shorthand notation in whichsignatures of the ^^label part can be omitted (see below). A symbol spaceform bin{... bi_atomic}.

In dialects that extend RIF-BLD, signature inference may not always be possible. We expect that most dialects will use signature inference and RIF hasdoes not define any special sublanguage for signatures. However, signature inference may not always be possible or desirable in some dialects. In these cases, we expect those dialects to introduce their own primitives for defining signatures.

2.1.1.5. EBNF for the following components: A non-empty setPresentation Syntax of character strings calledthe lexical space ofRIF-BLD Condition Language

The symbol space.overall structure of the lexical space for a type, D , determines which character strings are allowed as value in a symbol like " value " D . For instance, "1.2"^^xsd:decimal and "1"^^xsd:decimal are two legal symbols because 1.2 and 1 are legalsyntax used in the lexical space of the XML datatype xsd:decimal .RIF-BLD condition sublanguage is depicted on the other hand, "a+2"^^xsd:decimal is not a legal symbol, since a+2following diagram.

@@@@

The central syntactic class of RIF, CONDITION, is not partspecified recursively through its subclasses and their parts. The Equal class has two side roles. Two pairs of roles distinguish between the lexical spacedeclare and formula parts of the XML datatype xsd:decimal . An absolute IRI that identifiesExists class, and between the symbol space. A constant symboloperation (op) and arguments (arg) of the form "xyz"^^label is well-formed if its lexical form, xyz belongsUniterm class, where multiple arguments are subject to an ordered constraint (the natural "left-to-right" order).

The lexical space associated with the symbol space label . In addition the semantics of a symbol space defines A non-empty set called the value space of the data type; and A mapping from the lexical space of the data type to its value space. These two componentssyntactic classes are partitioned into classes that will not be explainedvisible in Section Model Theory for RIF's Basic Condition Language . We would like to point out, however, that symbol spacesserializations (written in RIF include spaces, such as xsd:long , whose value space is fixed as well as spaces like rif:iriall-uppercase letters) and rif:local whose value spaces are not fixed. Weclasses that will refer to the former as primitive data types . A number of primitive typesbe visible in RIF are based oninstance markup (written with a leading uppercase letter only).

The XML Schema data types,three classes Var, CONDITION, and their namesATOMIC are references to the corresponding XML Schema types.used in this version ofthe RIF BLD document,syntax of Horn Rules.

We define the following symbol spaces, where the prefix xsd refers tonow give an EBNF for the XML Schema URI andRIF presentation syntax. This syntax is somewhat abstract in nature. In particular, it does not address the prefixconcrete details of how constants and variables are represented. For instance, it ignores the RIF language. The syntaxissues that have to do with delimiters, such as xsd:long should be understoodwhite spaces and escape symbols. Instead, white space is informally used as a compact uri , i.e., a macro, which expandsdelimiter. For instance, TERM* is to a concatenation of the character sequence denoted by the prefix xsd and the string longbe understood as TERM* ::= | TERM TERM*. In the next version ofThis document we will introduceis done on purpose, since RIF's presentation syntax is intended to be used for specifying semantics and to illustrate the main RIF concepts through examples. It is not intended as a concrete syntax for defining prefixesa rule language. RIF defines a concrete syntax only for compact URIsexchanging rules, and will also expand onthat syntax is XML-based.

  CONDITION   ::= 'And' ' ( ' CONDITION* ' ) ' |
                  'Or' ' ( ' CONDITION* ' ) ' |
                  'Exists ' Var+ ' ( ' CONDITION ' ) ' |
                  ATOMIC
  ATOMIC      ::= Uniterm | Equal
  Uniterm     ::= Const ' ( ' TERM* ' ) '
  Equal       ::= TERM ' = ' TERM
  TERM        ::= Const | Var | Uniterm
  Const       ::= LITERAL '^^' SYMSPACE
  Var         ::= '?' VARNAME

The above is a standard syntax for a variant of first-order logic. The symbols that can be used to denote RIF's primitive data types. xsd:long . Thisapplication of a constant (Const) symbol space correspondsto the XML data type xsd:long . Example: "123"^^xsd:long . Long integers also havea short notation, which does not require the "..."^^xsd:long wrapper. That is, long integerssequence of terms is called a Uniterm (Universal term); it can be written as constants fromplay the lexical spacerole of xsd:long , buta term or an atomic formula depending on the surrounding double quotes andsyntactic context in which the type label ^^xsd:long can be omitted. Example: 123 . xsd:decimal . This corresponds toapplication occurs. The XML data type xsd:decimalnon-terminal ATOMIC stands for atomic formula. Example: "123.45"^^xsd:decimal . Decimals also have an alternative short notation, which does not requireThe "..."^^xsd:decimal wrapper. That is, decimals can be written as constants fromExists formula, where Var+ stands for the lexical spacelist of xsd:decimalvariables that are free in CONDITION, but the surrounding double quotes and the type label ^^xsd:decimal can be omitted. Example: 123.45is an existential formula. The type xsd:decimalIt is a supertypethe only kind of xsd:long . xsd:string . This corresponds toquantified formulas in RIF-BLD, but other dialects may add universal quantification. The XML data type xsd:string . Example: "a string"^^xsd:stringAnd formula defines conjunctions of conditions, and 'Or' denotes disjunctions. Finally, CONDITION assembles everything into what we earlier called RIF condition formulas.

Double quotesNote that appear inside strings are escaped with a backslashindividuals, function symbols, and a backslash that is supposedpredicate symbols all belong to appear inthe string must be escaped with another backslash. xsd:timesame set of symbols Const. This correspondssyntax is more general than what RIF-BLD actually permits. As explained in Section Symbols and Signatures a set of signatures further restricts this syntax to allow only the XML data type xsd:time . Example: "18:33:44.2345"^^xsd:time . xsd:dateTime . This type correspondsstandard first-order logic terms.

RIF-BLD presentation syntax does not commit to any particular vocabulary for the XML data type xsd:dateTime . Example: "2007-03-12T21:22:33.44-01:30"^^xsd:dateTime . rdf:XMLLiteral . This type's lexical space isnames of variables or for the literals used to represent certain XML documents, as describedin Resource Description Framework (RDF): Concepts and Abstract Syntax . rif:iri . Symbolsconstant symbols. In this symbol spacethe examples, variables are denoted by Unicode character sequences beginning with a ?-sign. Constant symbols have the form "XYZ"^^rif:iriform: LITERAL^^SYMSPACE, where XYZSYMSPACE is an absoluteIRI as specified in RFC 3987 . rif:local . Symbols instring that identifies the symbol space haveof the form "XYZ"^^rif:local , where XYZconstant and LITERAL is any string of characters (provided that each occurrence of " and of \ in sucha Unicode string is escaped with a backslash). Thus,from the lexical space of rif:local is the same asthat symbol space.

In the lexical spacecondition language of xsd:stringRIF-BLD, a variable can be free or quantified. Local symbolsAll quantification is explicit and the variables introduced by quantification must also have an alternative short notation. Example: 'a local symbol' .occur in this notation, single quotes and backslashesthe quantified formula. Variables that occur inside such stringsare escaped with backslashes. TODO: Define CURIs. Other XML data types thatnot explicitly quantified are likely to be incorporated in RIF include xsd:double , xsd:date , and a type for temporal duration . At present, the partial order on the above primitive data types is imposed by the XML Schema hierarchy, so the only subtype relationship is between xsd:long and xsd:decimalfree.

This may be extended as more typesConditions with free variables are added. The symbol space rif:iri is intended to beused as queries and also in a way similar to RDF resources .the value spaceif part of a rule. In the symbol space rif:iri can be any set and nolatter case, the free variables in a priori equalities amongcondition formula must also occur in the membersthen part of the type rif:irirule. We shall see in Section Horn Rules that such variables are assumed. This domain is not the same as the value spacequantified universally outside of the XML primitive type anyURI .rule, and the symbol space rif:localscope of such quantification is usedthe entire rule. For constant symbols (including predicate and function symbols) that are local toinstance, the various sets ofvariable ?Y in the first RIF formulas. They are not visible outsidecondition of the rule set in which these constants occur (except, possibly, when such a constantExample 1 is equated to a constant of type rif:iri ). TODO. We will need to definequantified, existentially, but ?X is free. However, when this condition occurs in the notionif part of the second rule set more precisely. For instance, what is the rule setin which a particular rule occurs? Will we have #include statements? Import? AllExample 1, then this has to be hashed out. The constant symbols that correspond to XML Schema data types all havevariable is quantified universally outside of the signature i { }rule. (The precise syntax for RIF rules is given in Section Horn Rules.)

Example 1 (A RIF condition in  RIF's basic logic dialect. The symbols of type rif:iriand  rif:local can have any signature allowed by the basicoutside of a rule)

 RIF  logic: i , f n , or p n , for n = 0,1,.... Symbols with ill-formed lexical part.condition:
                        Exists ?Y ( condition ( ?X ?Y ) ) 

 RIF  constant symbols that belong toHorn rule:
        Forall ?X ( then_part ( ?X ) :-  Exists ?Y ( condition ( ?X ?Y ) ) )

2.1.1.6. XML Syntax

EDITORS' NOTE: The XML syntax for BLD presented here is one of the RIF-supported symbol spaces must be well-formed, i.e., their lexical form must belong to the lexical space associated withproposals the symbol space. For instance, "123"^^xsd:long has a correct lexical form, since 123 belongsWorking Group is considering. It is presented here to get feedback on this strawman and to give readers an idea for the lexical spacekind of information that will be presented in this section.

The data type xsd:long .XML serialization for RIF-BLD presentation syntax given in contrast, "abc"^^xsd:long is ill-formed, as it does not have a correct lexical form. A compliant RIF interpreter must reject such symbols. Symbols with undefined symbol spaces. RIF allows symbols of the form "..."^^label where label is not one of the previously defined standard symbol spaces (such as xsd:long , rif:local , etc.). These are treated as uninterpreted constant symbols in the RIF language. For instance, "abc"^^cde is such an uninterpreted symbol. Dialects that extend the basic RIF logic dialect might appropriate some of the symbol spaces, which are undefined in the basic RIF dialect, and give them special semantics. 2.1.3. XML serialization EDITOR'S NOTE: The XML syntax for BLD presented here is one of the proposals the Working Group is considering. It is presented here to get feedback on this strawman and to give readers an idea for the kind of information that will be presented in this section. The XML serialization for RIF abstract syntax presented in Section Abstract Syntaxthis section is fully striped. Positional information is optionally exploited only for the arg role elements. For example, role elements (declare and formula) are explicit within the Exists element. Following the examples of Java and RDF, we use capitalized names for class elements and names that start with lowercase for role elements.

The all-uppercase classes in the abstractpresentation syntax, such as CONDITION, become XML entities. They act like macros and 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 (see also Appendix Specification ).below.

- 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 CONDITION formula)
- Uniterm (atomic or function-expression formula)
- op      (operation role)
- arg     (argument  role, positional/non-positional without/with optional 'index' attribute)role)
- Equal   (prefix version of term equation '=')
- side    (left-hand and right-hand side role)
- Const   (predicate symbol, function symbol, or individual, with optional 'type' attribute)
- Var     (logic variable)

For the XML Schema Definition (XSD) of the RIF-BLD condition language see Appendix Specification.

The XML syntax for symbol spaces utilizes the type attribute associated with XML term elements such as Const. For instance, a literal in the xsd:dateTime data type can be represented as <Const type="xsd:dateTime">2007-11-23T03:55:44-02:30</Const>.

The following example illustrates XML serialization of RIF conditions.

Example 2 (A RIF condition and its XML serialization):
  We use the prefix bks as an abbreviation for http://example.com/books#
  and curr for http://example.com/currencies#

a. RIF  condition:condition

  And ( Exists ?Buyer  (purchase(?Buyer( purchase^^rif:local ( ?Buyer
                                              ?Seller
                                               book(?Author "http://example.com/books#LeRif"^^rif:iri) "http://example.com/currencies#USD"^^rif:iri(49)))book^^rif:local ( ?Author bks:LeRif^^rif:iri )
                                              curr:USD^^rif:iri ( 49^^xsd:integer ) )
        ?Seller=?Author )

b. XML  serialization:serialization

  <And>
    <formula>
      <Exists>
        <declare><Var>Buyer</Var></declare>
        <formula>
          <Uniterm>
            <op><Const type="rif:local">purchase</Const></op>
            <arg><Var>Buyer</Var></arg>
            <arg><Var>Seller</Var></arg>
            <arg>
              <Uniterm>
                <op><Const type="rif:local">book</Const></op>
                <arg><Var>Author</Var></arg>
                <arg><Const  type="rif:iri">http://example.com/books#LeRif</Const></arg>type="rif:iri">bks:LeRif</Const></arg>
              </Uniterm>
            </arg>
            <arg>
              <Uniterm>
                <op><Const  type="rif:iri">http://example.com/currencies#USD</Const></op>type="rif:iri">curr:USD</Const></op>
                <arg><Const  type="xsd:long">49</Const></arg>type="xsd:integer">49</Const></arg>
              </Uniterm>
            </arg>
          </Uniterm>
        </formula>
      </Exists>
    </formula>
    <formula>
      <Equal>
        <side><Var>Seller</Var></side>
        <side><Var>Author</Var></side>
      </Equal>
    </formula>
  </And>

2.1.3.1. Specifying Signatures in RIF Dialects DaveR: Not clear what's2.1.1.7. Translation Between the value of giving an informal example instance XML document for signature specifications here. Either formally definePresentation and the XML syntax for signatures or dropSyntaxes

The example. We will now explain how signatures are defined intranslation between the Basic Condition Languagepresentation syntax and its extensions. In RIF's basic Logic dialect, there is no need to declare signatures, since they can be inferred. Indeed,the basic logic dialect requires that each symbolXML syntax is associated with a unique signature. Therefore, the signature can be determinedgiven by the context in which the symbol is used. Ifa symbol is used in more than one context, the parser should deem ittable as afollows.

Presentation Syntax error. In dialects that extend RIF's Basic Condition Language, signature inference of the above kind is not possible, in general, and advanced signature inference might not always be appropriate even when it is possible. For this reason, we introduce the attribute sig for theXML elements ConstSyntax
And  Var(
  conjunct1
  .  The value of such an attribute is supposed to be the signature. .
  conjunctn
    )
<And>
  <formula>conjunct1</formula>
   . . .
  <formula>conjunctn</formula>
</And>
Or (
  disjunct1
  . . .
  disjunctn
   )
<Or>
  <formula>disjunct1</formula>
   . . .
  <formula>disjunctn</formula>
</Or>
Exists
  variable1
  . . .
  variablen (
             body
             )
<Exists>
  <declare>variable1</declare>
   . . .
  <declare>variablen</declare>
  <formula>body</formula>
</Exists>
predfunc (
  argument1
  . . .
  argumentn
          )
<Uniterm>
  <op>predfunc</op>
  <arg>argument1</arg>
   . . .
  <arg> argumentn</arg>
</Uniterm>
left = right
<Equal>
  <side>left</side>
  <side>right</side>
</Equal>
name^^space
<Const type="space">name</Const>
?name
<Var>name</Var>

2.1.2. Model Theory for Condition Language of RIF BLD

The corresponding symbol. For instance,first step in the above example, purchase wasdefining a 4-ary predicate, so it could be specified as <Const sig="p4">purchase</Const> . Since variables in the basic conditionmodel-theoretic semantics for a logic-based language always haveis to define the signature inotion of a semantic structure, we could write <Var sig="i">Author</Var>also known as an interpretation. The sig attribute is optional, and its value can be inferred for the basic language. For instance, in our example, the values p4 and i for the attribute sig could be inferred from the usage of the symbols purchase and Author . Dialects that extend the basic logic dialect can adopt their own rules for omitting this attribute and for inferring its values. The basic language does not need any special syntax for defining signatures -- all signature names are already defined: bool , i , f0 , f1 , p0 , p1 , etc. The dialects, however, will need a special sublanguage for defining signatures. The signature mysig{ (s1 s2 s3) -> bool (s i) -> i } can, for example, be defined using the following XML excerpt: <Signature signame="mysig"> <element> <Sigexpr sighead="bool"> s1 s2 s3 </Sigexpr> </element> <element> <Sigexpr sighead="i"> s i </Sigexpr> </element> </Signature> 2.1.4. Model Theory for RIF's Basic Condition Language The first step in defining a model-theoretic semantics for a logic-based language is to define the notion of a semantic structure , also known as an interpretation . (See end note on(See end note on the rationale.) In this section we define basic semantic structures. This definition will be extended in Extension of Semantic Structures for Frames when we introduce frame syntax.

2.1.2.1. Basic semantic structures. A basicstructures

Semantic structure , I , isstructures are used to assign a tuple of the form < D , I C , I V , I F , I R >, which determines thetruth value of every formula, as explained below.to each formula. Currently, by formula we mean anything produced by the CONDITION production in the presentation EBNFsyntax. Later on, formulas will also include rules. Other dialects might extend thisWe first define the notion even further.of a truth value formally and then introduce semantic structures. Next we give the semantics to symbol spaces and, finally, define truth values of formulas with respect to semantic structures.

Truth values. The set of truth values is denoted by TV. For RIF's basic logic dialect,RIF-BLD, TV includes only two values, t (true) and f (false). (See end note on truth values.)

The setIn RIF, TV has a total or partial order, called the truth order ; it is, and denoted with <t. In the basic RIF logic,RIF-BLD, f <t t, and it is a total order. (See end note on ordering truth values.)

To define howSemantic structures determine the truth values of RIF formulas, we introducestructures. A basic semantic structure, I, is a tuple of the following sets:form <D -,IC, IV, IF, IR>.

Here D is a non-empty set of elements called the domain of interpretation of I ,. We will continue to use Const -to refer to the set of individuals, predicate names,all constant symbols and function symbols,Var -to refer to the set of variables.all variable symbols.

The mappings that constitute an interpretation,other components of I ,are mappings defined as follows:

  • IC from Const to elements of D

  • IV from Var to elements of D

  • IF from Const to functions from D* into D (here D* is a set of all tuples of any length over the domain D)

  • IR from Const to partial truth-valued mappings D*TV

    ItThe equality predicate, =, is convenientalways interpreted in the same way by all semantic structures: IR(=) is a truth-valued mapping such as IR(=)(<a,a>) = t for every a D; it maps other tuples of elements of D to f.

We also define a more generalthe following mapping, I, based on the mappings IC, IV, I F ,and I RF:

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

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

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

Truth valuation for formulas. Observe thatSemantics of symbol spaces. Symbol spaces affect the notiondomain of signaturesI and the mapping IC as follows. First, some symbol spaces, called primitive data types, have a value space, denoted VSsymsp, and a mapping from Section Formal Preliminaries is used onlythe lexical space to constrainthe syntaxVSsymsp, denoted Lsymsp, where symsp is an identifier for the symbol space.

The value space and does not appear inthe definitionlexical-to-value-space mapping are defined as part of the semantic structure. This is because when we define truth valuationsdata type definition and do not depend on I. For formulas, below, all formulas are assumed to be well-formed. Truth valuationevery primitive datatype symsp it must hold that:

  • VSsymsp D; and

  • For well-formed formulaseach constant lit^^symsp in RIF's basic condition language is determined usingthe following function, denoted I Truth : Atomic formulas: I Truth (r(t 1 ... t n )) = I R (r)( I (t 1 ),..., I (t n )) Equality: I Truth (t 1 =t 2 ) = t iff I (t 1 ) = I (t 2 ); I Truth (t 1 =t 2 ) = f otherwise. Conjunction:symbol space symsp, I Truth (And(c 1 ...C n )) = min t( I Truth (c 1 ),..., I Truth (c n )), where min t is minimum with respect to the truth order. Disjunction: I Truth (Or(c 1 ... c n ))lit^^symsp) = max tLsymsp( I Truth (c 1 ),..., I Truth (c n )), where max t is maximum with respectlit).

    That is, when restricted to the truth order. Quantification: I Truth ( Exists ?v 1 ... ?v n (c)) = max t ( I * Truth ( c )), where max t is taken over all interpretations I * of the form < Da symbol space, symsp, IC , I * V , I F , I R >, where the mapping I * V has the same value as I V on all variables except, possibly, onmust map the variables ?v 1 ,..., ?v ncorresponding constants according to Lsymsp.

Notice that the mapping I Truth is uniquely determined by the four mapping comprising I and, therefore, itRIF-BLD does not need to be listed explicitly.impose restrictions on the interpretation of symbol spaces. We now explain howconstants (the mapping IC) in symbol spaces which are integrated into the semanticsnot primitive datatypes. Other dialects may do so. An example of such a restriction is that no constant in a particular symbol space may be mapped to an element in the basic RIF logic. As mentioned earlier,value space of any XML data type.

The above semantics is not limited to any particular set of asymbol spaces or primitive data types. Any symbol space defines an associatedis covered as long as its lexical space is well-defined, and any data type is acceptable as long as its value space and a mapping fromthe lexical space tolexical-to-value mapping are known. For the primitive data types that are currently supported by RIF, their value space.spaces and the value space may be constrained in various ways or it can be completely fixed.lexical-to-value-space mappings are defined as follows:

  • For instance,XML data types (xsd:long, xsd:integer, xsd:decimal, xsd:string, xsd:time, and xsd:dateTime), these are defined in the XML Schema Part 2: Datatypes specification defines a concretespecification.

  • The value space for each XML data type, includingthe primitive data types such as xsd:decimaltype rdf:XMLLiteral is defined in Resource Description Framework (RDF): Concepts and Abstract Syntax.

  • The value space of rif:text is the set of all pairs of the form (string, lang), where string is a Unicode character sequence and lang is a lowercase Unicode character sequence which areis a natural language identifier as defined by RFC 3066. The lexical-to-value mapping of text, L,,text,,, maps each symbol string@lang in the lexical space of interestrif:text to RIF.(string, lower-case(lang)), where lower-case(lang) is lang written in all-lowercase letters.

    The value space is different fromand the lexical-to-value mapping for rif:text defined here are compatible with RDF's semantics for strings with named tags.

The value space of a data type should not be confused with the lexical space. Lexical space refers tospaces define the syntax of the constant symbols that belong to a particularthe various primitive data type. Fortypes. In contrast, value spaces define the meaning of the constants in data types. The lexical and the value spaces are often not even isomorphic. For instance, "1.2"^^xsd:decimal1.2^^xsd:decimal and "1.20"^^xsd:decimal1.20^^xsd:decimal are two legal constants in RIF because 1.2 and 1.20 belong to the lexical space of xsd:decimal. However, these two constants are interpreted by the same element of the value space of the xsd:decimal type. Other symbol spaces may have their value spaces constrained in some ways, but not fixed. For instance, the value space of rif:iriTherefore, 1.2^^xsd:decimal = 1.20^^xsd:decimal is defined below as the entire domain of interpretation. This means that this value space cannot be an arbitrary subset of that domain. Some symbol spaces may have their value spaces restricted in other ways.a RIF tautology. Likewise, RIF semantics for data types implies certain inequalities. For instance, abc^^xsd:string abcd^^xsd:string is a value space may be required to be disjoint fromtautology, since IC must map these two constants into distinct elements in the value space of xsd:string. On the XML data types. Formally, each data type comes with a value space, denoted by D type (for instance, D xsd:decimal ), andother hand, abc^^rif:local abcd^^rif:local is not a mapping,tautology in RIF, since IC : Const type D type . We require that D type D for each XML data type, where Const type denotesis not restricted over the setlexical space of rif:local and these two constants incan be mapped to the same element in D in some semantic structures and to different elements in others.

Semantics of undefined symbol spaces. Section Symbol space type . The valueSpaces andaddressed the corresponding mappings forsyntactic aspects of the XML data typestreatment of "unknown" symbol spaces, i.e., symbol spaces that are not defined by the XML Schema Part 2: DatatypesRIF specification. In some cases,It defined the XML Schema specification defineslexical space of those symbols as the subdomains D s and D t for different XML primitive types s and t as being disjoint or as subsetsset of each other. For instance, theall Unicode strings. Semantically, unknown symbol spaces are treated as follows. First, they are not assigned any value space of xsd:long is definedspace. Thus, such symbol spaces are not considered to be a subset of xsd:decimal . The requirements imposedprimitive data types by the XML Schema specificationRIF even though they may have interesting consequences for the mappings from the lexical space to the value space. For instance,be viewed as data types by some concrete rule languages that use RIF for xsd:decimalexchange. Second, RIF does not impose any restrictions on the mapping IC : Const xsd:decimal D xsd:decimal is such that, for instance, I C ( "1.2"^^xsd:decimal ) = I C ( "1.20"^^xsd:decimal ) in every semantic structure. So, it follows that "1.2"^^xsd:decimal = "1.20"^^xsd:decimal is a RIF tautology.over the semanticsunknown symbol spaces.

Truth valuation of XML also implies some inequalities. For instance, since distinct strings are different in the value space forformulas. Observe that the xsd:string data type, something like "abc"^^xsd:string "abcd"^^xsd:string is a tautology, since itnotion of signatures from Section Symbols and Signatures is true in all RIF semantic structures. Onused only to constrain the other hand, "abc"^^rif:iri "abcd"^^rif:iri issyntax and does not a tautology in RIF, since it is possibleappear in somethe definition of the semantic structures (but notstructure. This is because when we define truth valuations for formulas, below, all such structures) that,formulas are assumed to be well-formed.

Truth valuation for example,well-formed formulas in RIF-BLD is determined using the following function, denoted I CTruth:

  • Atomic formulas: ITruth(r ( "abc"^^rif:iri )t1 ... tn )) = I C ( "abcd"^^rif:iri ). The value space forR(r)(I(t1),...,I(tn))

    Note that the RDF data type rdf:XMLLiteraldefinition of IR(=) implies that ITruth(t1 = t2) = t iff I(t1) = I(t2); ITruth(t1=t2) = f otherwise.

  • Conjunction: ITruth(And ( c1 ... cn )) = mint(ITruth(c1),...,ITruth(cn)), where mint is defined in Resource Description Framework (RDF): Concepts and Abstract Syntax . For the symbol space rif:iri ,minimum with respect to the corresponding mapping istruth order.

  • Disjunction: ITruth(Or ( c : Const rif:iri D , i.e., D rif:iri1 ... cn )) = D . That is, the interpretation allowsmaxt(ITruth(c1),...,ITruth(cn)), where maxt is maximum with respect to map any IRI into any value in the domain of the semantic structure. The value space ofthe local RIF symbolstruth order.

  • Quantification: ITruth(Exists ?v1 ... ?vn ( c )) = maxt(I*Truth(c)), where maxt is alsotaken over all interpretations I* of the entire domainform <D and,IC, I*V, IF, IR>, where the correspondingmapping looks as follows:I C : Const rif:local D . Thus, local constants can denote any element of*V has the domain of discourse, including integers, strings, etc.same value as IV on all variables except, possibly, on the variables ?v1,...,?vn.

Notice that the mapping ITruth is uniquely determined by the four mappings comprising I and, therefore, it does not need to be listed explicitly.

2.2. Slotted Conditions

(Editor's Note: This text is maintained on wiki page Slotted Conditions).

In this section we extend Positive Conditions, defined in Section Positive Conditions, with slotted Uniterms and Frame formulas. A slot can be represented by an individual symbol or, more generally, by a Uniterm. It can be represented by an IRI or be known only locally. Semantically, a frame slot is a set-valued function that represents a property of an object. Such a function maps an object id to a set of values of the property. This can be a singleton set or even an empty set. In contrast, a uniterm slot semantically behaves like a unary uninterpreted function symbol. In both cases, however, the order of the slots is immaterial (in contrast to positional uniterms).

Syntactically, the extension is achieved by enrichingextending the notion of a uniterm with slots and by complementing these withadding a new kind of formula, called frame formulas.formula. For uniformity and greater syntactic convenience, frame formulas can be nested inside other frame formulas. However, this feature is syntactic sugar, however, as explained later in this section.sugar that does not extend the expressive power.

2.2.1. Syntax

2.2.1.1. Formal Preliminaries The most important additions toSlotted Terms and Frames

The syntax for positive conditions in Section Formal Preliminaries are the notions ofSymbols and Signatures is extended with slotted terms (includingterms, slotted predicates)predicates, and frames.

Slotted terms. A term is either a term in the sense of Section Formal PreliminariesSymbols and Signatures or a slotted term.

  • Slotted terms are defined as follows:A slotted term is of the form t ( pt ( p1 -> v1 ... pn -> vn ),), where t is a term; p1, ..., pn are terms, which represent the names of the slots; and v1 , ..., vn are terms. Slotted terms are like regular terms except that the arguments of such a term are named. Since the argumentsare named,named and their order is considered to be immaterial.

In order to talk about the slotted terms that are also well-formed, we need to extend the notion of a signature to include slots. As before, a slotted signature is a statement of the form η{e1 ..., ..., en, ...} where η ∈ SigNames is the name of the signature and {e1 ..., ..., en, ...} is a countable set of signature expressions , which can be empty, finite, or countably infinite. But now a signature expression can be not only a base expression or an arrow expression; it can, in addition, be aslotted arrow expressionexpressions. A slotted arrow expression is a statement of the form

  • 1 →κ-> κ1 ..., ..., γn →κ-> κn) => κ, where n≥0. The order of the arguments in a slotted signaturearrow expression is assumed to be immaterial, so any permutation of arguments is assumed to yield the same signatureexpression. For instance, ( i i i iterm -> term, term -> term) i=> term is a slotted arrow signature expression. By analogy with earlier definitions, if κ is boolatomic then the expression is also a slotted Boolean signatureexpression. For instance, ( i i i iterm -> term, term -> term) bool=> atomic is a slotted Boolean signature expression.

A term t ( pt ( p1 -> v1 ... pn -> vn ) is a well-formed slotted term with signature σ if

  • Each pi is a well-formed term with some signature γi.

  • Each vi is a well-formed term (slotted or non-slotted) with some signature σi, i=1, ..., n.

  • The signature of t includes thea slotted arrow expression of the form1 # →σ-> σ1 #... γn # →σ-> σn #) σ # . Recall that if σ is a signature then σ # denotes its name.=> σ.

  • The aforesaid term t is a well-formed slotted atomic formula if σ is bool { }.atomic.

    A slotted atomic formula is just like an atomic formula of Section Formal PreliminariesSymbols and Signatures except that the arguments of the predicate are named and their order is considered immaterial. This is analogous to names of columns in tables in relational databases.

Frames. A well-formed frame formula is one of the following:

  • Membership formula: o#co # c, where o, c are well-formed terms.

    Informally, such a formula says that object o is a member of class c. A RIF class is an object, which can have other classes are also objects. For instance,as members, as specified by membership formulas. Thus, classes are also objects and they can be members of some other classes. (In object-oriented languages these latter classes are sometimes known as meta-classes.)

  • Subclass formula: s##cs ## c, where s, c are well-formed terms.

    Informally, this formula states that class s is a membersubclass of class c.

  • Frame: t [ pt [ p1 -> v ->  v1 ... pn -> v -> vn ],], where t is a well-formed term, a membership formula, or a subclass formula; p1, ..., pn are well-formed terms; and each v1 , ..., vn is either a well-formed term or a well-formed frame formula.

    When t, all the pi, and all the vi are terms, such a formula should be understood as a statement that object t has properties pi, ..., pn, and for each i = 1,...,n, the value of property pi is a set that contains the object vi. When t, pi, or vi are not just terms but frame formulas themselves, the above is treated as a conjunction of simpler frame formulas, as defined by the unnest transformation in the section on semantics (below).

The use of membership and subclass formulas is an open issue in the current draft http://www.w3.org/2005/rules/wg/track/issues/41.

Atomic formulas and general condition formulas. The syntax for atomic formulas is extended with slotted formulas and frame formulas. More precisely, an atomic well-formed formula is

The notion of well-formed generalcondition formulas needs no adjustments with respect to itsthe earlier definition (without frames).frames or slots). As before, such formulas are constructed from well-formed atomic formulas using the logical connectives ∧, etc.And, Or, and the quantifier Exists.

Extended signatures for RIF's Basic Logic Dialect.RIF-BLD. Section Formal PreliminariesSymbols and Signatures defined the allowed signatures for the basic logic dialect of RIF.RIF-BLD. With the introduction of slotted signatures, we augmentadd the set of allowedfollowing signatures in the basic dialect as follows:to those already defined for RIF-BLD:

  • For every n≥0 there are signatures fsn{( i i ... i iterm -> term, ..., term -> term) i=> term} and psn{( i i ... i iterm -> term, ..., term -> term) bool=> atomic} (in both cases the number of arguments inside the parentheses is n).

In addition, RIF's Basic Logic DialectRIF-BLD imposes the following restrictions:

  • The terms that are allowed as slot names in slotted terms
    • must have the signature i{ };term{ }; and

    • they must have the form s , where s is abe constant symbol.symbols.
    This means that, in the basic logic dialect, nothat RIF-BLD does not allow variables or complex terms are allowed(like f(), f(a,b)) as slot names in slotted uniterms (variables iver slots(but there are allowedno such restrictions on slots in frames).
  • In frame formulas, all terms must have the signature i { }.term.

    Therefore, in the frame formulas t # st # s, t ## st ## s, or t [ r s ],t [ r -> s ], the terms t, s, and r cannot have the signature bool { }atomic -- they can represent individuals, but not predicates.

2.2.1.2. Abstract Syntax To compare two approaches at [ F2F7 ], we representEBNF for the abstractPresentation Syntax

The overall structure of the RIF Slotted Condition Language both in Abstractsyntax Notation andused in Abstract EBNF Syntax. 2.2.1.2.1. Abstract Syntax Notation The abstract syntax ofthe RIF-BLD slotted condition languagesublanguage is given in asn06 as follows: class CONDITION subclass And property formula : listdepicted on the following diagram.

Upload new attachment "SlottedConditionModel.png"

We now extend the presentation syntax of CONDITION subclass Or property formula : list of CONDITION subclass Exists property declare : list of Var property formula : CONDITION subclass ATOMIC class ATOMIC subclass Uniterm subclass Equal subclass CLASSIFICATION subclass Frame class Uniterm property op: Const property subproperty arg: list of TERM subproperty slot: list of list Const TERM class Equal property side: list TERM TERM class CLASSIFICATION subclass Instance property oid: TERM property op: TERM subclass Subclass property sub: TERM property op: TERM class Frame property subproperty oid: TERM subproperty classinst: CLASSIFICATION property slot: list of list TERM TERMFRAME class TERMFRAME subclass TERM subclass Frame class TERM subclass Const property name: CONSTNAME property type: TYPENAME? subclass Var property name: VARNAME subclass Uniterm The above asn06 is generalized with a fixed-arity list constructor (complementing the unfixed-arity list of constructor) so that the multiplicity of the side property (role) of the Equal class no longer requires the assumption of being exactly 2 (the 2 TERM s are just list ed). Also, optional of and subproperty constructs are assumed. 2.2.1.2.2. Abstract EBNF Syntax The abstract syntax of the slotted condition language is given in Abstract EBNF Syntax as follows:Positive Conditions to a presentation syntax for slotted terms and frames.

  CONDITION      ::= 'And'  '(' ('formula ->' CONDITION)* ')'' ( ' CONDITION* ' ) ' |
                     'Or'  '(' ('formula ->' CONDITION)* ')'' ( ' CONDITION* ' ) ' |
                     'Exists'  '(' ('declare ->' Var)+ 'formula ->'Var+ ' ( ' CONDITION  ')'' ) ' |
                     ATOMIC
  ATOMIC         ::= Uniterm | Equal | CLASSIFICATION | Frame
  Uniterm        ::=  'Uniterm' '(' 'op ->'Const ' (  ('arg ->' TERM)*' (TERM* |  ( 'slot ->' '(' Const TERM ')' )*(Const ' -> ' TERM)*) ' )  ')''
  Equal          ::=  'Equal' '(' 'side ->'TERM  'side ->''=' TERM
   ')'CLASSIFICATION ::=  'Instance' '(' 'oid ->'TERM  'op ->'' # ' TERM  ')'|  'Subclass' '(' 'sub ->'TERM  'op ->'' ## ' TERM
   ')'Frame          ::=  'Frame' '(' ( 'oid ->' TERM(TERM |  'classinst ->' CLASSIFICATION ) ( 'slot ->' '(' TERMCLASSIFICATION) ' [ ' (TERM ' -> ' (TERM |  Frame) ')' )* ')'Frame))* ' ] '
  TERM           ::=  'Const' ( '(' 'type ->' TYPENAME ')' )? '(' CONSTNAME ')'Const |  'Var' '(' VARNAME ')'Var | Uniterm
   Note that the name and filler of a slot are defined asConst          ::= LITERAL '^^' SYMSPACE
  Var            ::= '?' VARNAME

A sequence of two classes. Also,Uniterm applies a symbolic constant (from Const can have an optional type property.) to positional TERM arguments or to maintainslotted Const  ->  TERM arguments. A CLASSIFICATION specifies that one object is a clean separation of concerns, the unorderedness of slots within Uniterms and Frames is taken care of by the semantics in Section Semantics . The above abstract syntax can be described by a UML diagram as shown below. Upload new attachment "SlottedConditionModel.png" The syntactic classes are partitioned into classes that will not be visible in serializations (written in all-uppercase letters) and classes that will be visible in instance markup (written with a leading uppercase letter only). The three classes Var , CONDITION , and ATOMIC will be required in the abstract syntax of Horn Rules . 2.2.1.3. Presentation Syntax The abstract syntax of Section Abstract Syntax can be lowered to a presentation syntax which is an extension to the presentation syntax of Positive Conditions for slotted Uniterms. The Presentation EBNF Syntax below, which lowers the abstract syntax, is used throughout this document to explain and illustrate the main ideas. The human-oriented presentation syntax, described in this EBNF (usual except for whitespace handling), is work in progress and under discussion. CONDITION ::= 'And' '(' CONDITION* ')' | 'Or' '(' CONDITION* ')' | 'Exists' Var+ '(' CONDITION ')' | ATOMIC ATOMIC ::= Uniterm | Equal | CLASSIFICATION | Frame Uniterm ::= Const '(' (TERM* | (Const '->' TERM)*) ')' Equal ::= TERM '=' TERM CLASSIFICATION ::= TERM '#' TERM | TERM '##' TERM Frame ::= (TERM | CLASSIFICATION) '[' (TERM '->' (TERM | Frame))* ']' TERM ::= Const | Var | Uniterm Const ::= CONSTNAME | '"'CONSTNAME'"''^^'TYPENAME Var ::= '?'VARNAME A Uniterm () -applies a Const to positional TERM arguments or to slotted Const -> TERM arguments. A CLASSIFICATION specifies that one object is a member (in casemember (in case of the #-connective) or a subclass (in case of the ##-connective) of another object (classes are treated as objects).object. A Frame is a TERM or a CLASSIFICATION applied to toslotted TERM -> ->  (TERM | Frame) arguments.

The lowering of the abstract syntax to the presentation syntax can again be done via automatic EBNF-to-EBNF mapping. For this, the mapper, abs2con4g , and the table, class2token , of Section Positive Conditions are extended. class2token('slot','->') class2token('Instance','#') class2token('Subclass','##') abs2con4g(Uniterm | Equal | CLASSIFICATION | Frame, ?TokenTable) = Uniterm | Equal | CLASSIFICATION | Frame abs2con4g('Uniterm' '(' 'op ->' Const (('arg ->' TERM)* | ('slot ->' '(' Const TERM ')')*) ')', ?TokenTable) = Const '(' (TERM* | (Const lookup('slot',?TokenTable) TERM)*) ')' abs2con4g('Instance' '(' 'oid ->' TERM 'op ->' TERM ')' | 'Subclass' '(' 'sub ->' TERM 'op ->' TERM ')', ?TokenTable) = TERM lookup('Instance',?TokenTable) TERM | TERM lookup('Subclass',?TokenTable) TERM abs2con4g('Frame' '(' ('oid ->' TERM | 'classinst ->' CLASSIFICATION) ('slot ->' '(' TERM (TERM | Frame) ')')* ')', ?TokenTable) = (TERM | CLASSIFICATION) '[' (TERM lookup('slot',?TokenTable) (TERM | Frame))* ']' Example 3 shows Uniterm and Frame conditions,Example 3 shows Uniterm and Frame conditions, the latter with variables for the three major (combinations of) syntactic categories, corresponding to the three components of RDF triples.

Example 3 (A RIF condition with bound variables)
   We use the prefix bks to abbreviate http://example.com/books#
   and the prefix auth for http://example.com/authors#.

RIF conditions using

   Positional Uniterms:
                         book("http://example.com/authors#rifwg"^^rif:iri "http://example.com/books#LeRif"^^rif:iri)book^^rif:local ( auth:rifwg^^rif:iri bks:LeRif^^rif:iri )

                        Exists ?X  (book(?X LeRif))( book^^rif:local ( ?X LeRif^^rif:local ) )

   Slotted Uniterms:
                         book(author->"http://example.com/authors#rifwg"^^rif:iri title->"http://example.com/books#LeRif"^^rif:iri)book^^rif:local ( author^^rif:local -> auth:rifwg^^rif:iri
                                          title^^rif:local -> bks:LeRif^^rif:iri )

                        Exists ?X  (book(author->?X title->"http://example.com/books#LeRif"^^rif:iri))( book^^rif:local ( author^^rif:local -> ?X
                                                      title^^rif:local -> bks:LeRif^^rif:iri ) )

   Frames:
                         wd1[author->"http://example.com/authors#rifwg"^^rif:iri title->"http://example.com/books#LeRif"^^rif:iri]wd1^^rif:local [ author^^rif:local -> auth:rifwg^^rif:iri
                                         title^^rif:local -> bks:LeRif^^rif:iri ]

                        Exists ?X  (wd2[author->?X title->"http://example.com/books#LeRif"^^rif:iri])( wd2^^rif:local [ author^^rif:local -> ?X
                                                     title^^rif:local -> bks:LeRif^^rif:iri ] )

                        Exists ?X  (wd2#book[author->?X title->"http://example.com/books#LeRif"^^rif:iri])( wd2^^rif:local # book^^rif:local [ author^^rif:local -> ?X
                                                                       title^^rif:local -> bks:LeRif^^rif:iri ] )

                        Exists ?I ?X  (?I[author->?X title->"http://example.com/books#LeRif"^^rif:iri])( ?I [ author^^rif:local -> ?X
                                            title^^rif:local -> bks:LeRif^^rif:iri ] )

                        Exists ?I ?X  (?I#book[author->?X title->"http://example.com/books#LeRif"^^rif:iri])( ?I # book^^rif:local [ author^^rif:local -> ?X
                                                              title^^rif:local -> bks:LeRif^^rif:iri ] )

                        Exists ?S  (wd2[author->"http://example.com/authors#rifwg"^^rif:iri ?S->"http://example.com/books#LeRif"^^rif:iri])( wd2^^rif:local [ author^^rif:local -> auth:rifwg^^rif:iri
                                                     ?S -> bks:LeRif^^rif:iri ] )

                        Exists ?X ?S  (wd2[author->?X ?S->"http://example.com/books#LeRif"^^rif:iri])( wd2^^rif:local [ author^^rif:local -> ?X
                                                        ?S -> bks:LeRif^^rif:iri ] )

                        Exists ?I ?X ?S  (?I#book[author->?X ?S->"http://example.com/books#LeRif"^^rif:iri])( ?I # book^^rif:local [ author -> ?X
                                                                 ?S -> bks:LeRif^^rif:iri ] )

2.2.1.3. XML Syntax

EDITORS' NOTE: The XML syntax for BLD presented here is one of the proposals the Working Group is considering. It is presented here to get feedback on this strawman and to give readers an idea for the kind of information that will be presented in this section.

The following is a possiblean XML-serializing mapping of the abstractpresentation syntax in Section AbstractEBNF for the Presentation Syntax, extending the one in Section Positive Conditions (see also Appendix Specification )..

- 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 CONDITION formula)
- Uniterm   (positional or slotted Uniterm formula)
-  Instance (instance-ofMember    (member formula)
- Subclass   (subclass-of(subclass formula)
- Frame      (slotted Frame(Frame formula)
-  classinst (Frameobject    (Member/Frame role  for Subclass or Instance) - oid (Instance/Frame identifier role,containing a  TERM)TERM or an object description)
- op         (Uniterm/Instance/Subclass predicate/class(Uniterm function/predicate role)
-  sub (Subclass role for included class)upper     (Member/Subclass upper class role)
- lower     (Member/Subclass lower instance/class role)
- slot      (Uniterm/Frame slot role, prefix version of slot infix  '->')' -> ')
- Equal     (prefix version of term equation '=')
- side       (left-hand(Equal left-hand and right-hand side role)
- Const     (slot, individual, function, or predicate symbol)
- Var       (logic variable)

For the XML Schema Definition (XSD) of the RIF-BLD slotted condition language see Appendix Specification.

The following example illustrates XML serialization of Slotted RIF conditions.

Example 4 (A RIF condition and its XML serialization):
   We use the prefix bks to abbreviate http://example.com/books#,
   the prefix auth for http://example.com/authors#, and
   curr for http://example.com/currencies#,

a. RIF condition:

  And ( Exists ?Buyer ?P  (?P#purchase[buyer->?Buyer seller->?Seller item->book(author->?Author title->"http://example.com/books#LeRif"^^rif:iri) price->49 currency->"http://example.com/currencies#USD"^^rif:iri])( ?P # purchase^^rif:local [
                                      buyer^^rif:local -> ?Buyer
                                      seller^^rif:local -> ?Seller
                                      item^^rif:local -> book^^rif:local ( author^^rif:local -> ?Author
                                                                           title^^rif:local -> bks:LeRif^^rif:iri )
                                      price^^rif:local -> 49^^xsd:integer
                                      currency^^rif:local -> curr:USD^^rif:iri ] )
        ?Seller=?Author )

b. XML serialization:

  <And>
    <formula>
      <Exists>
        <declare><Var>Buyer</Var></declare>
        <declare><Var>P</Var></declare>
        <formula>
          <Frame>
             <classinst> <Instance> <oid><Var>P</Var></oid> <op><Const type="rif:local">purchase</Const></op> </Instance> </classinst><object>
              <Member>
                <lower><Var>P</Var></lower>
                <upper><Const type="rif:local">purchase</Const></upper>
              </Member>
            </object>
            <slot><Const type="rif:local">buyer</Const><Var>Buyer</Var></slot>
            <slot><Const type="rif:local">seller</Const><Var>Seller</Var></slot>
            <slot>
              <Const type="rif:local">item</Const>
              <Uniterm>
                <op><Const type="rif:local">book</Const></op>
                <slot><Const type="rif:local">author</Const><Var>Author</Var></slot>
                <slot><Const type="rif:local">title</Const><Const  type="rif:iri">http://example.com/books#LeRif</Const></slot>type="rif:iri">bks:LeRif</Const></slot>
              </Uniterm>
            </slot>
            <slot><Const type="rif:local">price</Const><Const  type="xsd:long">49</Const></slot>type="xsd:integer">49</Const></slot>
            <slot><Const type="rif:local">currency</Const><Const  type="rif:iri">http://example.com/currencies#USD</Const></slot>type="rif:iri">curr:USD</Const></slot>
          </Frame>
        </formula>
      </Exists>
    </formula>
    <formula>
      <Equal>
        <side><Var>Seller</Var></side>
        <side><Var>Author</Var></side>
      </Equal>
    </formula>
  </And>

2.2.2. Semantics2.2.1.4. Translation Between the syntax of RIF frames permits nesting of two kinds. First, a classification formula ofPresentation and the form obj1#obj2 or obj1##obj2 can appear inXML Syntaxes

The object position of a frame. Second, a frame may appear intranslation from the value position of an attribute. This nested notation is convenient and allows succinct representation of object properties, butpresentation syntax to the XML syntax is no more than a shorthand notation. A nested frame representsgiven by a conjunctiontable, below, which extends the translation table of flat frames. For instance, a#b[cPositive Conditions.

Presentation SyntaxXML Syntax
predfunc (
  key1 ->  e##f[gfiller1
  . . .
  keyn ->  h]] == a#b /\ a[cfillern
         )
<Uniterm>
  <op>predfunc</op>
  <slot>key1 filler1</slot>
   . . .
  <slot>keyn fillern</slot>
</Uniterm>
inst [
  key1 ->  e] /\ e##f /\ e[gfiller1
  . . .
  keyn ->  h] Formally, given a frame, f , we define the Unnest transformation and postulate f to be true in a semantic structure iff Unnest(f) is true. In this way, we reduce the semantics of nested frames to that of flat frames. Then we extend the basic semantic structures defined in Model Theory for the Core RIF Condition Language and define an interpretation for flat frames. The rest of the semantic definitions does not change, since it is defined in terms of atomic formulas (the ATOMIC production in the BNF syntax). 2.2.2.1. The Unnest Transformation If a formula, f , has the form a#b or a##b then define Obj(f) to be afillern
     ]
<Frame>
  <object>inst</object>
  <slot>key1 filler1</slot>
   .  If f has the form o[a->v] , where o , a , and v are terms, then Obj(f) is recursively defined to be Obj(o).  Now, if f is a term then we define Unnest(f) = true , where true is a formula that is always true (a tautology, a formula whose truth value is t ). If f is a classification formula then Unnest(f) = f.
   Otherwise, if f is a frame of the form o[a->v] then Unnest(f) = Unnest(o) /\ Obj(o)[a -> Obj(v)] /\ Unnest(v) For instance, in case of the frame a#b[c->e##f[g->h]] above, unnesting yields: Unnest(a#b[c<slot>keyn fillern</slot>
</Frame>
inst # class [
  key1 ->  e##f[gfiller1
  . . .
  keyn ->  h]]) = a#b /\ a[cfillern
             ]
<Frame>
  <object>
    <Member>
      <lower>inst</lower>
      <upper>class</upper>
    </Member>
  </object>
  <slot>key1 filler1</slot>
   . . .
  <slot>keyn fillern</slot>
</Frame>
sub ## super [
  key1 ->  e] /\ e##f /\ e[gfiller1
  . . .
  keyn ->  h] /\ true This is almost the same conjunction as we have seen earlier. The only difference is the trailing true conjunct, which comes from Unnest(h) and can be omitted. 2.2.2.2. Extension of Semantic Structures for Frames A semantic structure , I , is a tuple of the form < D , I C , I V , I F , I R , I slot , I SF , I SR , Ifillern
             ]
<Frame>
  <object>
    <Subclass>
      <lower>sub , I isa >. All the components except the last five, I slot , I SF , I SR , I sub , I isa , are the same as before. The new mapping I slot is used to interpret frames; the mappings I SF and I SR interpret terms and predicates with named arguments, respectively; I sub gives meaning to the subclass hierarchy; and I isa interprets class membership. I slot is a function from the domain D to truth-valued functions of the form D × D  TV . The intuitive meaning of frame slots is that they are functions that take objects and return sets of objects, where every member of the set has a certain degree of truth. In the two-valued case, a set of objects associated with the truth value true represents the (set of) values that the slot returns when applied to an object. Formally, this is expressed by extending I Truth to flat frames as follows: I Truth ( T[p 1 ->V 1  ... p k ->V k ] ) = min i=1...k ( I Truth ( T[p i ->V i ] )), where T , p i , and V i are terms. I Truth ( T[p->V ]) = I slot ( I ( p ))( I ( T ), I ( V )) I SF interprets terms with named arguments. It is a function from Const to the mappings SetOfFiniteSubbags ( D × D )  D . This is analogous to the interpretation of regular (positional) terms with two differences: Each pair <s,v>  D × D represents a slot-name/slot-value pair instead of just a value in positional terms. The argument to a slotted term is a finite bag of slot/value pairs rather than an ordered sequence. Bags are used here because, for slotted terms, the order of slot/value pairs is immaterial, but sets cannot be used, since I may happen to map different slots into the same value in D . We can now extend the mapping I from Section Model Theory for RIF's Basic Condition Language as follows (where only the last item is new with respect to the earlier definition of I ): I (k) = I C (k) if k is a symbol in Const I (?v) = I V (?v) if ?v is a variable in Var I (f(t 1 ... t n )) = I F (f)( I (t 1 ),..., I (t n )) I (f( p 1 -> t 1 ... p n -> t n )) = I SF (f)({ < I ( p 1 ), I (t 1 ) > ,..., < I ( p n ), I (t n ) > }) Here we use {...} to denote bags. I SR is used to interpret predicates with slotted arguments. It is a function from the set Const to truth-valued mappings SetOfFiniteSubbags ( D × D )  TV . This is analogous to the interpretation of regular (positional) predicates except for two differences: Each pair <s,v>  D × D represents a slot-name/slot-value pair instead of just a value in positional predicates. The argument to a slotted predicate is a finite bag of slot/value pairs rather than an ordered sequence. Bags (also known as multisets ) are used here because for slotted predicates the order of slot-value pairs does not matter, but sets cannot be used, since I may happen to map different slots into the same value in D . We can now define I Truth for slotted predicates as follows: I Truth (p( p 1 ->val 1 ... p k ->val k )) = I SR (p)({ < I ( p 1 ) I ( val 1 ) > , ... , < I ( p k ) I ( val k ) > }), where p , p i  Const and val i is a term for i=1,...k . I sub gives meaning to the subclass relationship. It is a truth-valued function D × D  TV . The truth valuation for classification formulas of the form sc##cl , where sc and cl are terms, is defined as follows: I Truth ( sc##cl ) = I sub ( I ( sc ), I ( cl )) In addition, we want the operator ## to be transitive, i.e., we would like c1##c2 and c2##c3 to imply c1##c3 . To this end, we require that the mapping I sub defines a partial order on D . More precisely, For all elements ec1 , ec2 , ec3  D , the following must hold: min t ( I sub ( ec1 , ec2 ), I sub ( ec2 , ec3 ))    t   I sub ( ec1 , ec3 ) where  t denotes the truth order on TV (see Section Model Theory for RIF's Basic Condition Language ) and min t is the minimum with respect to that truth order. I isa gives meaning to class membership. It is a truth-valued function D × D  TV . The truth valuation for classification formulas of the form o#cl , where o and cl are terms, is defined as follows: I Truth ( o#cl ) = I isa ( I ( o ), I ( cl )) We also want # and ## to have the usual property that all members of a subclass are also members of the superclass, i.e., we want o#cl and cl##scl to imply o#scl . To this end, we introduce the following restriction on the mappings I isa and I sub : For all elements eo , ec , es  D , the following must hold:   min t ( I isa ( eo , ec ), I sub ( ec , es ))    t   I isa ( eo , es ) where  t and min t are as before. MK: ***** Need to decide if we want to extend signatures to restrict what can appear in the object/attribute/value places in a frame ******** 2.3. List Constructor (Editor's Note: This text is maintained on wiki page List Constructor ). This page is not up-to-date, and currently acts as a place-holder only. In order to represent lists as Lisp-like dotted pairs (head . tail) or Prolog-like lists [head | tail] , a refinement of Const '(' TERM* ')' from Positive Conditions , namely the specialized syntax 'List' '(' TERM TERM ')' is used by employing a distinguished binary function symbol, List , and a distinguished constant symbol, Nil . Besides dealing with these two distinguished symbols, nothing else changes (especially, in the semantics). 2.3.0.1. Abstract Syntax The abstract syntax of lists extends the class TERM in Positive Conditions by a class LIST as follows: class TERM subclass Var property name: xsd:string subclass Const property name: xsd:string subclass Uniterm property op: Const property arg: list of TERM subclass LIST subclass Nil subclass PAIR property arg1: TERM property arg2: TERM Here, Nil is a special singleton class. The properties ("role stripes") arg1 and arg2 at the same time suggest minimal use of positional information in concrete syntaxes: the natural order of the two elements of a LIST that is a PAIR . This will considerably support readability of the concrete syntaxes (see below). There is an obvious 1-to-1 mapping between the above LIST class and the following earlier-considered LIST class: subclass LIST subclass Nil subclass PAIR property first: TERM property rest: TERM The abstract syntax is visualized by a UML diagram. (***TBD***) Upload new attachment "ListConditionModel.png" 2.3.0.2. Concrete Syntax The abstract syntax of Section Abstract Syntax can again be instantiated to a concrete EBNF syntax. For this, TERM s, in Positive Conditions defined as TERM ::= Const | Var | Uniterm are extended to TERM ::= Const | Var | Uniterm | LIST with LIST ::= 'Nil' | 'List' '(' TERM TERM ')' For example, the Prolog list [a,Y,c] or [a | [Y | [ c | []]]] becomes the List nesting List( a List( ?Y List( c Nil ) ) ) The following is a possible XML-serializing mapping of the abstract syntax in Section Abstract Syntax (and of the above EBNF syntax): <List> <Const>a</Const> <List> <Var>Y</Var> <List> <Const>c</Const> <Nil/> </List> </List> </List> This shortens an equivalent earlier-considered version using explicit arg stripes: <List> <arg index="1"><Const>a</Const></arg> <arg index="2"> <List> <arg index="1"><Var>Y</Var></arg> <arg index="2"> <List> <arg index="1"><Const>c</Const></arg> <arg index="2"><Nil/></arg> </List> </arg> </List> </arg> </List> Lists can be decomposed using syntactic equality (unification). For example, [?head | ?tail] = [a ?Y c] : <List> <Var>head</Var> <Var>tail</Var> </List> unifies with <List> <Const>a</Const> <List> <Var>Y</Var> <List> <Const>c</Const> <Nil/> </List> </List> </List> by binding <Var>head</Var> to <Const>a</Const> and <Var>tail</Var> to <List> <Var>Y</Var> <List> <Const>c</Const> <Nil/> </List> </List> Nested Prolog Lists such as [a,[X,b],c] or [a | [[X | [b | []]] | [ c | []]]] are of course allowed: <List> <Const>a</Const> <List> <List> <Var>X</Var> <List> <Const>b</Const> <Nil/> </List> </List> <List> <Const>c</Const> <Nil/> </List> </List> </List> The mapping to RDF lists is even more direct than in OWL 1.1 , since its source are binary List constructor applications rather than n-ary SEQ constructor applications. 3. RIF Rule Language (Editor's Note: This text is maintained on wiki page RIF Rule Language ). This section develops a RIF Rule Language by extending the RIF Condition Language , where conditions become rule bodies. RIF Phase I covers only Horn Rules and a number of extensions that do not increase the expressive power of the language. The envisioned RIF dialects will extend the BLD rule language by generalizing the positive RIF conditions and by other means. 3.1. Horn Rules (Editor's Note: This text is maintained on wiki page Horn Rules ). This section defines Horn rules for RIF Phase 1. The syntax and semantics incorporates RIF Positive Conditions defined in Section Positive Conditions . 3.1.1. Syntax 3.1.1.1. Abstract Syntax To compare two approaches at [ F2F7 ], we represent the abstract syntax of the RIF Horn Rule Language both in Abstract Syntax Notation and in Abstract EBNF Syntax. 3.1.1.1.1. Abstract Syntax Notation The abstract syntax of the Horn rule language extending Positive Conditions is given in asn06 as follows: class Ruleset property formula : list of RULE class RULE subclass Forall property declare : list of Var property formula : CLAUSE class CLAUSE subclass ATOMIC subclass Implies class Implies property if: CONDITION property then: ATOMIC 3.1.1.1.2. Abstract EBNF Syntax The abstract syntax of the Horn rule language extending Positive Conditions is specified using Abstract EBNF Syntax as follows: Ruleset ::= 'Ruleset' '(' ('formula ->' RULE)* ')' RULE ::= 'Forall' '(' ('declare ->' Var)* 'formula ->' CLAUSE ')' CLAUSE ::= ATOMIC | Implies Implies ::= 'Implies' '(' 'if ->' CONDITION 'then ->' ATOMIC ')' This syntax can be represented using a UML diagram, which extends the diagram shown in Section Positive Conditions as shown below. The class Ruleset contains zero or more RULE s, which are universally quantified RIF CLAUSE s. The class Forall is specified through its parts, i.e., zero or more variable ( Var ) declarations and a CLAUSE formula, which can be an Implies or an ATOMIC formula. The Implies class distinguishes if - CONDITION from then - ATOMIC parts. The classes Var , CONDITION , and ATOMIC were specified in the abstract syntax of Positive Conditions . The combined RIF BLD abstract syntax and its visualization are given in Appendix Specification . 3.1.1.2. Presentation Syntax The abstract syntax of Section Abstract Syntax can again be lowered to a presentation syntax. The human-oriented presentation syntax, described in this Presentation EBNF Syntax extends the syntax for Positive Conditions with the following productions. It is work in progress and under discussion. Ruleset ::= RULE* RULE ::= 'Forall' Var* '(' CLAUSE ')' CLAUSE ::= Implies | ATOMIC Implies ::= ATOMIC ':-' CONDITION Var , ATOMIC , and CONDITION were defined as part of the syntax for positive conditions in Positive Conditions . The symbol :- denotes the implication connective used in rules. The statement ATOMIC :- CONDITION should be informally read as if CONDITION is true then ATOMIC is also true. RIF deliberately avoids using the connective  here because in some RIF dialects, such as LP and PR, the implication :- will have different meaning from the meaning of the first-order implication ←. Rules are generated by the Implies production. Facts are generated by the ATOMIC production, and can be viewed as the then part of an Implies with an empty conjunctive if (or with true as the if part). The RULE production generates a universally closed rule or fact. A ruleset is a set of RIF rules; it is generated by the production Ruleset . Note also that, since CONDITION permits disjunction and existential quantification, the rules defined by the Implies production are more general than pure Horn rules. This extension was explained in the introduction to Section Positive Conditions . Well-formed rules. A rule is well-formed if its ATOMIC part is a well-formed atomic formula and the CONDITION part is a well-formed condition formula. The lowering of the abstract syntax to this presentation syntax can again be done via automatic EBNF-to-EBNF mapping. For this, the mapper, abs2con4g , and the table, class2token , of Section Positive Conditions are extended. class2token('Implies',':-') abs2con4g('Ruleset' '(' ('formula ->' RULE)* ')', ?TokenTable) = RULE* abs2con4g('Forall' '(' ('declare ->' Var)* 'formula ->' CLAUSE ')', ?TokenTable) = 'Forall' Var* '(' CLAUSE ')' abs2con4g(ATOMIC | Implies, ?TokenTable) = ATOMIC | Implies abs2con4g('Implies' '(' 'if ->' CONDITION 'then ->' ATOMIC ')', ?TokenTable) = ATOMIC lookup('Implies',?TokenTable) CONDITION The document RIF Use Cases and Requirements includes a use case "Negotiating eBusiness Contracts Across Rule Platforms", which discusses a business rule slightly modified here: 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. In the Presentation EBNF Syntax used throughout this document, this rule can be written in one of these two equivalent ways: Example 3 (A RIF rule in the presentation syntax) a. Universal form: Forall ?item ?deliverydate ?scheduledate ?diffdate ( reject("http://example.com/people#John"^^rif:iri ?item) :- And ( perishable(?item) delivered(?item ?deliverydate "http://example.com/people#John"^^rif:iri) scheduled(?item ?scheduledate) timediff(?diffdate ?deliverydate ?scheduledate) greaterThan(?diffdate 10) ) ) b. Universal-existential form: Forall ?item ( reject("http://example.com/people#John"^^rif:iri ?item) :- Exists ?deliverydate ?scheduledate ?diffdate ( And ( perishable(?item) delivered(?item ?deliverydate "http://example.com/people#John"^^rif:iri) scheduled(?item ?scheduledate) timediff(?diffdate ?deliverydate ?scheduledate) greaterThan(?diffdate 10) ) ) ) In form (a), all variables are quantified universally outside of the rule. In form (b), the variables that do not appear in the rule then part are instead quantified existentially in the if part. It is well-known that these two forms are logically equivalent. The following extends the XML syntax of Positive Conditions , by serializing the above Abstract EBNF Syntax of RIF Horn rules in XML. The Forall element contains the role elements declare and formula , which were earlier used within the Exists element of Positive Conditions . The Implies element contains the role elements if and then to designate these two parts of a rule (see also Appendix Specification ). - Ruleset (collection of rules) - Forall (quantified formula for 'Forall', containing declare and formula roles) - Implies (implication, containing if and then roles) - if (antecedent role, containing CONDITION) - then (consequent role, containing ATOMIC) For instance, the rule in Example 3a can be serialized in XML as shown below as the first element of a rule set whose second element is a business rule for Fred. Example 4 (A RIF rule set in XML syntax) <Ruleset> <formula> <Forall> <declare><Var>item</Var></declare> <declare><Var>deliverydate</Var></declare> <declare><Var>scheduledate</Var></declare> <declare><Var>diffdate</Var></declare> <formula> <Implies> <if> <And> <formula> <Uniterm> <op><Const type="rif:local">perishable</Const></op> <arg><Var>item</Var></arg> </Uniterm> </formula> <formula> <Uniterm> <op><Const type="rif:local">delivered</Const></op> <arg><Var>item</Var></arg> <arg><Var>deliverydate</Var></arg> <arg><Const type="rif:iri">http://example.com/people#John</Const></arg> </Uniterm> </formula> <formula> <Uniterm> <op><Const type="rif:local">scheduled</Const></op> <arg><Var>item</Var></arg> <arg><Var>scheduledate</Var></arg> </Uniterm> </formula> <formula> <Uniterm> <op><Const type="rif:local">timediff</Const></op> <arg><Var>diffdate</Var></arg> <arg><Var>deliverydate</Var></arg> <arg><Var>scheduledate</Var></arg> </Uniterm> </formula> <formula> <Uniterm> <op><Const type="rif:iri">http://www.w3.org/2007/rif/builtin/greaterThan</Const></op> <arg><Var>diffdate</Var></arg> <arg><Const type="xsd:long">10</Const></arg> </Uniterm> </formula> </And> </if> <then> <Uniterm> <op><Const type="xsd:long">reject</Const></op> <arg><Const type="rif:iri">http://example.com/people#John</Const></arg> <arg><Var>item</Var></arg> </Uniterm> </then> </Implies> </formula> </Forall> </formula> <formula> <Forall> <declare><Var>item</Var></declare> <formula> <Implies> <if> <Uniterm> <op><Const type="rif:local">unsolicited</Const></op> <arg><Var>item</Var></arg> </Uniterm> </if> <then> <Uniterm> <op><Const type="rif:local">reject</Const></op> <arg><Const type="rif:iri">http://example.com/people#Fred</Const></arg> <arg><Var>item</Var></arg> </Uniterm> </then> </Implies> </formula> </Forall> </formula> </Ruleset> 3.1.2. Semantics 3.1.2.1. Interpretation and Models of Rules Section Positive Conditions defined the notion of semantic structures and how such structures determine truth values of RIF conditions. The current section defines what it means for such a structure to satisfy a rule. While semantic structures can be multivalued in RIF dialects that extend the BLD, rules are typically two-valued even in dialects that support inconsistency and uncertainty. Consider a rule of the form Q then :- if , where Q is a quantification prefix for all the variables in the rule. For the Horn subset, Q is a universal prefix, i.e., all variables in the rule are universally quantified outside of the rule. We first define the notion of rule satisfaction without the quantification prefix Q : I |= then :- if iff I Truth ( then )  t I Truth ( if ). (Recall that the set of truth values, TV , has a partial order  t .) We define I |= Q then :- if iff I* |= then :- if for every I* that agrees with I everywhere except possibly on some variables mentioned in Q . In this case we also say that I is a model of the rule . I is a model of a rule set R , denoted I |= R , if it is a model of every rule in the set, i.e., if it is a semantic structure such that I |= r for every rule r  R . The above defines the semantics of RIF BLD using standard first-order semantics for Horn clauses. Various RIF dialects will extend this semantics in the required directions. Some of these extended semantics might not have a model theory (for example, production rules) and some will have non-first-order semantics. However, all these extensions are required to be compatible with the above definition when the rule set is completely covered by RIF BLD. For further details on defining the semantics for RIF dialects see end note on intended models for rule sets . 3.1.2.2. Entailment of RIF Conditions by Rulesets We will now define what it means for a set of rules to entail a RIF condition. Let S be a RIF ruleset and φ a closed RIF condition (a condition with no free variables). Then we say that S entails φ, written as S |= φ if for every semantic structure I , such that I |= S , it is the case that I truth (φ)= t . 4. RIF Compatibility (Editor's Note: This text is maintained on wiki page RIF Compatibility ). The compatibility of RIF BLD is currently focussed on the Semantic Web standards OWL and RDF . The section RIF-OWL Compatibility provides a number of starting points for compatibility with OWL. The section RIF-RDF Compatibility provides a concrete specification of RDF compatibility. In future versions, these two sections may be moved into a separate deliverable about RDF and OWL compatibility. 4.1. RIF-OWL Compatibility (Editor's Note: This text is maintained on wiki page RIF-OWL Compatibility ). In its current version this page lists a number of possible approaches to combining RIF (BLD) and OWL. It is meant to evolve to a specification of OWL compatibility for BLD. Besides this page, the working group might create a page which exemplifies typical usage patterns when combining OWL and rules. This section, together with the mentioned usage patterns, are expected to be included in Recommendation-track deliverable on using RIF in combination with OWL, as called for by the working group charter . There are some inherent discrepancies between OWL DL and rules languages, as pointed out on the OWL Compatibility page. In order to specify OWL compatibility the working group needs to make a number of decisions, outlined below. 4.1.1. Species OWL specifies three increasingly expressive species, namely Lite, DL, and Full. OWL Lite is a syntactic subset of DL, but the semantics is the same. The semantics of DL and Full are somewhat different; the latter is an extension of the semantics of RDFS, whereas the former has a direct semantics. The OWL semantics specification also defines an RDF-compatible semantics for OWL DL, but the direct semantics is normative. The OWL Full semantics does not directly extend the RDF-compatible OWL DL semantics; however, every OWL DL entailment is an OWL Full entailment. Finally, the OWL DL syntax does not extend the RDF syntax, but rather restricts it; every OWL DL ontology is an RDF graph. OWL Full and RDF have the same syntax. Note, however, that the RDF-compatible semantics of OWL DL is defined for arbitrary RDF graphs, not just OWL DL ontologies. *** The working group will have to decide whether to specify compatibility with both OWL DL and Full, or with just one of the two. If the working group decides to specify compatibility with OWL DL, then the working group has to decide whether to be compatible with the direct or the RDF-compatible semantics of OWL DL; see also the subsection "OWL DL" in this section "semantic correspondence" *** 4.1.2. Syntactic correspondence The correspondence between URI references and literals in OWL and constant symbols in RIF can and should be defined in the same way as in RDF Compatibility . The only question which remains is how the correspondence of atomic formulas is defined. We distinguish between syntactic correspondence for the cases of combination with OWL Full and OWL DL, respectively. 4.1.2.1. OWL Full For the case of compatibility with OWL Full, syntactic correspondence should be defined in the same way as in RDF Compatibility , because the syntax is the same as that of RDF: a triple s p o . corresponds to an atomic formula s'[p' -> o'] , where s' , p' , and o' are RIF symbols corresponding to the RDF symbols s , p , and o , respectively. 4.1.2.2. OWL DL In the case of compatibility with OWL DL, there seem to be two reasonable alternatives: Correspondence is defined with respect to the abstract syntax of OWL DL, in which the atomic formulas are essentially unary and binary predicate expressions. In this case, class membership expressions in OWL DL correspond to unary predicate expressions in RIF, and property value expressions in OWL DL corresponds to binary predicate expressions in RIF. Correspondence is defined with respect to the RDF representation of OWL DL. In this case, correspondence of atomic formulas would be defined in the same way as for OWL Full, i.e. a triple s p o . corresponds to an atomic formula s'[p' -> o'] . *** Their is a slight discrepancy between the abstract syntax of OWL DL and the RDF graph representation of it. Namely, the RDF representation is required to fulfill certain disjointness conditions which are not required in the abstract syntax. If we go for correspondence with the abstract syntax, we probably want to require these conditions to hold. *** In case option 2 is chosen, it might be necessary, depending on the choice of the semantics of the combination, to restrict the syntactic shape of the RIF rules (e.g. forbid formulas of the form a[rdf:type -> ?x , because ?x is a variable occurring in the class position, which is generally incompatible with the direct semantics of OWL DL). Note that option 1 might also require certain syntactical restrictions in the rules, e.g. because OWL DL makes a distinction between object and datatype properties. These restrictions would be less severe than the ones required for option 2, and are probably only necessary for reasoning purposes. Note, however, that such restrictions are not necessary if the combined semantics uses the RDF-compatible semantics of OWL DL, because this semantics is defined for all RDF graphs. In that case, no guarantees whatsoever can be given about reasoning. *** If the working group decides to define compatibility with OWL DL, then the working group has to decide between options 1 and 2. The main arguments for option 1 are that (i) it is more natural with respect to the abstract syntax of OWL, (ii) more familiar and easier to implement the for people with an understanding of Description Logics, and (iii) it might require fewer syntactic restrictions in the RIF rules in order to allow effective processing. The main argument for option 2 is that it is consistent with the correspondence defined for RDF and (possibly) OWL Full, allowing the (to some extent) uniform processing of RDF, OWL DL and OWL Full. *** 4.1.3. Semantic correspondence [here, the tough choices need to be made] Many approaches for the combination of Description Logics and rules have been described in the academic literature. Most of these approaches are applicable to OWL DL or subsets thereof. For a brief overview of some of the approaches, see the corresponding section on the OWL Compatibility page . We are currently not aware of any approach to combining OWL Full with rules; there is an approach to combining a subset of OWL Full, called pD*-entailment, with rules, described in [1]. A straightforward approach to combining OWL DL and RIF is to define a notion of combined models and define appropriate restrictions on RIF rules, similar to the SWRL proposal . Such a combination is hard to process in the general case (reasoning is undecidable). There are, however, several known decidable subsets which impose certain restrictions either on the OWL ontology or the RIF rules. For example, direct rule-based processing can be done by suitably restricting the OWL component to a so-called DLP subset. This approach is, however, not straightforward to extend to the case of rules with negation. Several approaches has been developed for this case, the two most prominent being [2], in which the notion of a combined model is defined, and [3], in which an external DL knowledge bases "queried" using special query atoms in the body of a rule. The main advantage of the former approach is that there is a tighter integration of the semantics. The main advantage of the latter approach is that processing can be done using out-of-the-box rules and DL engines (with minimal modifications). For completeness we also mention [4] and [5], in which even tighter integration (than [2]) is proposed, based on the embeddings in nonmonotonic logics. This is probably out of scope for this working group. 4.1.3.1. OWL Full Realistically speaking, RIF can define compatibility with OWL Full in the following ways: Since OWL Full is an extension of RDF, the most straightforward way is to define the combination of RIF and OWL Full as an extension of the combination of RIF and RDF , i.e. based on correspondence of models. However, such a combination would not be suited for rule-based processing; i.e., there is no embedding of such a combination in RIF. If the working group goes for this option, it might recommend users to use only a subset of OWL Full; the working group might even decide to allow (or recommend) reasoners to implement a weaker (intentional) semantics than the normative (extensional) semantics, saying that it is acceptable to have fewer entailments; RIF would recommend to use that subset of OWL Full which can be processed with rule-based reasoners, and say that anyone going beyond that subset is on their own wrt. processing. An OWL Full knowledge base can be seen as an external oracle, which is queried using special query atoms in the body. It should be noted at this point that most, if not all, currently available OWL Full reasoners are rule-based and implement a semantic (and sometimes also syntactic) subset. Hence, option 1. seems closer to current practice than option 2. *** The main arguments for option 1 are (i) that it is more elegant, the semantics of the combination extends both the semantics of OWL Full and RIF, (ii) it builds on existing standards, and (iii) it is closer to the current implementation practice. The main arguments for option 2 are (i) that it is easier to implement (assuming there are complete OWL Full reasoners around, which is actually not a very realistic assumption) and (ii) easier to extend towards rule languages with negation. *** 4.1.3.2. OWL DL *** The working group has to decide whether to define correspondence with respect to the (1) direct semantics or the (2) RDF-compatible semantics of OWL DL. The main argument for option 1 is that it is the normative semantics of OWL DL. The main arguments for option 2 are (i) it is closer to the semantics of RDF and OWL Full, thereby enabling more uniform definitions of compatibility and (ii) it is defined for a larger set of RDF graphs, and thus possibly requires fewer restrictions on RIF rule sets in the combination. The decision on this point is strongly related to the decision on syntactic correspondence. If syntactic correspondence is defined based on the abstract syntax, then it seems reasonable to define the semantic correspondence with respect to the direct semantics. If syntactic correspondence is defined with respect to the RDF representation, then option (2) appears more natural. *** The other choices regarding semantic compatibility are similar to those for OWL Full: The combination is based on correspondence of models. However, such a combination would not be suited for rule-based processing; i.e., there is no embedding of such a combination in RIF. Nonetheless, there is a syntactic subset of OWL DL (called OWL DLP) which can be processed using rule-based reasoners. So, there are three sub-options: a) There are no requirements on the shape of the OWL DL ontology. b) RIF recommends to use only the DLP subset of OWL DL in combination with RIF; anyone wanting to go beyond this subset is on their own wrt. processing. c) RIF only defines the combination for the DLP subset of OWL DL. For both 1a and 1b, the implementor is more-or-less on his own. However, these choices are probably the only ones which fulfill the requirements for the Interchanging Rule Extensions to OWL use case. An OWL DL knowledge base can be seen as an external oracle, which is queried using special query atoms in the body. *** The main arguments for option 1 are that it is more elegant; the semantics of the combination extends both the semantics of OWL DL and RIF, it builds on existing standards, and is closer to the current implementation practice. The main arguments for option 2 are that it is easier to implement (than 1a and 1b) and easier to extend (than 1a and 1b) towards rule languages with negation. Finally, most people who care about OWL DL find the semantics for the case of option 1 more natural. *** [1] Herman J. ter Horst: Combining RDF and Part of OWL with Rules: Semantics, Decidability, Complexity . International Semantic Web Conference 2005: 668-684 [2] Riccardo Rosati. DL+log: Integration of Description Logics and Disjunctive Datalog In Proceedings of the Tenth International Conference on Principles of Knowledge Representation and Reasoning (KR 2006), pages 68-78, 2006. ISBN 978-1-57735-271-6. [3] Thomas Eiter, Thomas Lukasiewicz, Roman Schindlauer, Hans Tompits: Combining Answer Set Programming with Description Logics for the Semantic Web . KR 2004: 141-151 [4] Boris Motik, Riccardo Rosati: A Faithful Integration of Description Logics with Logic Programming . IJCAI 2007: 477-482 [5] Jos de Bruijn, Thomas Eiter, Axel Polleres, Hans Tompits: Embedding Non-Ground Logic Programs into Autoepistemic Logic for Knowledge-Base Combination . IJCAI 2007: 304-309 4.2. RIF-RDF Compatibility (Editor's Note: This text is maintained on wiki page RIF-RDF Compatibility ). *** The working group is chartered to deliver a Recommendation document about using RIF in combination with OWL. The working group might consider moving the definition of RIF-RDF combinations to that document as well. *** *** See http://lists.w3.org/Archives/Public/public-rif-wg/2007Sep/0012.html , http://lists.w3.org/Archives/Public/public-rif-wg/2007Sep/0045.html , and the ensuing threats for a discussion about the definition of the semantics of RIF-RDF combinations. *** [examples to be added throughout] This section defines combinations of RIF rules with RDF graphs, taking into account the various (normative) entailment regimes defined by RDF. A typical case where RIF rules and RDF graphs are combined is when an RIF rule set refers to one or more RDF data sets or RDFS ontologies (which are also RDF graphs). Four semantics are defined for the combination, corresponding to the simple, RDF, RDFS, and D (datatype) entailment regimes of RDF, with the sense that D entailment is only defined for a fixed set of datatypes, because the set of data types supported by RIF is fixed. *** RDF D-entailment extends RDFS entailment with support for an arbitrary number of datatypes, which is given by a datatype map (a mapping from URIs to datatypes). The only requirement on these datatype maps is that the rdf:XMLLiteral datatype must be in there; apart from that, an arbitrary number of datatypes can be used. OWL uses the same mechanism, but additionally requires the datatypes corresponding to xsd:string and xsd:integer to be defined. It is proposed in http://lists.w3.org/Archives/Public/public-rif-wg/2007Sep/0079.html to adopt the same (extensible) mechanism in RIF. *** Combinations are pairs of RIF rule sets and sets of RDF graphs. The semantics of combinations is defined in terms of combined models. Intuitively, given an RIF semantic structure, we define the corresponding RDF interpretation. If the RDF interpretation satisfies the RDF graphs, as well as the RIF rule set, then it is a model of the combination. Entailment is defined as model inclusion, as usual. It turns out that reasoning with combinations can be reduced to reasoning with RIF rule sets, assuming the RDF graphs are finite, thereby showing how translators can take a combination and translate it to a set of rules, to enable reasoning with combinations using a local rule system. *** Currently, this document only defines how combinations of RIF rule sets and RDF graphs should be interpreted; it does not suggest how such combinations are specified, or exchanged, nor does it specify which of the RDF entailment regimes (simple, RDF, or RDFS) should be used. The preliminary suggestion for the specification of combinations, as well as entailment regimes, through meta data in RIF rule sets was formulated in a preliminary section in the architecture document. Note that no agreement has yet been reached on this issue, and that especially the issue of the specification of entailment regimes is controversial (see http://lists.w3.org/Archives/Public/public-rif-wg/2007Jul/0030.html and the ensuing thread). *** 4.2.1. Syntax An RDF vocabulary V consists of sets of RDF URI references V U , plain literals V PL (i.e. character strings with an optional language tag), and typed literals V TL (i.e. pairs of character strings and URI references, identifying data types), as defined in [RDF-Concepts]. Given an RDF vocabulary V and a set of blank nodes B , disjoint from the symbols in V , an RDF graph is a set of RDF triples s p o . , where s is either a blank node or a URI reference, p is a URI reference, and o is a blank node, a URI reference, a plain literal, or a typed literal; see also RDF-Concepts . The RDF Core working group has listed two issues questioning the restrictions that literals may not occur in subject and blank nodes may not occur in predicate positions in triples. Anticipating lifting of these restrictions in a possible future version of RDF, we define the notion of generalized RDF graph. We note that the definitions in the RDF semantics document immediately apply to such generalized RDF graphs. Given an RDF vocabulary V and a set of blank nodes B , disjoint from the symbols in V , a generalized RDF graph is a set of generalized RDF triples s p o . , where s , p and o are blank nodes, URI references, plain literals, or typed literals. *** Note that our notion of generalized RDF graphs is more liberal than the notion of RDF graphs used by SPARQL; we additionally allow blank nodes and literals in predicate positions. *** Even though RDF allows the use of arbitrary datatype URIs in typed literals, not all such datatype URIs are recognized in the semantics. In fact, simple entailment does not recognize any datatype and RDF and RDFS entailment recognize only the XML content datatype (identified with rdf:XMLLiteral ). Furthermore, RDF allows to express typed literals such that the literal string is not in the lexical space of the datatype; such literals are called ill-typed literals. RIF, on the contrary, recognizes a number of different data types, and does not allow to express ill-typed literals. Finally, D-entailment is defined with respect to arbitrary datatype maps (mappings from URIs to datatypes) which include rdf:XMLLiteral , whereas RIF has a fixed number of datatypes, so it essentially has a fixed datatype map. Combinations of RIF with RDF under D-entailment are only defined for the case where D corresponds to the fixed datatype map of RIF. A datatype map is a mapping from URIs to datatypes. RIF has a fixed number of datatypes it supports. The datatype map of RIF, denoted with D RIF , is the mapping of datatype identifiers to datatypes as described in the section "Symbol Spaces and Primitive Datatypes". *** If RIF were to adopt datatypes maps in the way they are used in RDF, as proposed in http://lists.w3.org/Archives/Public/public-rif-wg/2007Sep/0079.html , then such combinations could be defined for arbitrary datatype maps. *** In order to ensure that typed literals are interpreted according to the datatypes recognized by RIF, which include the datatypes recognized by RDF and RDFS, we define the notions of well-typed and ill-typed literal relative to the data types recognized by RIF. A typed literal ( s , u ) is a well-typed literal if u is in the domain of D RIF and s is in the lexical space of D RIF ( u ) u is the URI of a symbol space defined by RIF and s is in the lexical space of the symbol space, or u is not in the domain of D RIF and is not a symbol space defined by RIF. Otherwise ( s , u ) is an ill-typed literal</lower>
      <upper>super</upper>
    </Subclass>
  </object>
  <slot>key1 filler1</slot>
   .  We define the RIF equivalent of the RDF names, given an RDF vocabulary V.  V U * is obtained from V U by replacing every RDF URI reference URI in V U with "URI"^^rif:iri.
   *** Note that the symbol space of rif:iri , i.e. the set of absolute IRIs, is a subset of the set of RDF URI references that omits spaces. *** V PL * is obtained from V PL by replacing every plain literal without a language tag "abc" in V PL with "abc"^^xsd:string and every plain literal with a language tag "abc"@lang in V PL with "abc'@lang"^^rif:text , where abc' is obtained from abc by replacing every occurrence of @ in abc with @@ , thereby escaping the character. *** The value space of RDF plain literals without language tags consists of all Unicode strings. Both in the current specification of XML schema datatypes and in the current working draft of XML schema 1.1 data types the value space of the string datatype is restricted to<slot>keyn fillern</slot>
</Frame>
inst # class
<Member>
  <lower>inst</lower>
  <upper>class</upper>
</Member>
sub ## super
<Subclass>
  <lower>sub</lower>
  <upper>super</upper>
</Subclass>

2.2.2. Semantics

The sequencessyntax of Unicode characters excluding the surrogate blocks, FFFE, and FFFF; these characters are not actual Unicode characters, but rather reserved codes in UTF-16 encoding. There are some further differences between the specificationRIF frames permits nesting of the string datatype in XML schema 1.0 and XML schema 1.1; in the former case, the datatype is based on the Char production in XML 1.0 ; in the latter case, the datatype is based on the Char production in XML 1.1 ; so, the string datatype in 1.1 istwo kinds. First, a supersetclassification formula of the string datatype in 1.0. Allform obj1 # obj2 or obj1 ## obj2 can appear in all, it appears thatthe value spaceobject position of the string datatype in XML Schema 1.1 isa superset of the value space of the RDF plain literals without language tags, but there are RDF plain literals which are not strings in XML Schema 1.0. So, if RIF speaks with the XML Schema 1.0 data types, then we have an issue here. See also http://lists.w3.org/Archives/Public/public-rif-wg/2007Sep/0002.html and the subsequent messages in the thread. *** *** We equate RDF plain literals with language tags with symbolsframe. Second, a frame may appear in the lexical space of the rif:text datatype. We assume that thevalue spaceposition of a slot. This datatype consists of all possible pairs of strings, i.e. the value space of xsd:string ,nested notation is convenient and language tags, i.e. a language identifiers as defined by RFC 3066 , which corresponds to the value space of the xsd:language datatype; therefore, it suffers from the same potential issue as plain literals without language tags, pointed out in the preceding discussion. We assume that the lexical space consists of Unicode stringsallows succinct representation of the form abc@lang , where abcobject properties, but is no more than a shorthand notation. A nested frame represents a conjunction of flat frames. For instance,

   a # b [ c -> e ## f [ g -> h ] ]   =    And ( a  string obtained from# b  a  string in the lexical space of xsd:string by replacing every @ with @@[ c -> e ]  e ## f  e [ g -> h ] )

Formally, given a frame, f, we define the Unnest transformation and lang ispostulate f to be true in a stringsemantic structure iff Unnest(f) is true. In this way, we reduce the lexical spacesemantics of xsd:language. *** V TL * is obtained from V TL by replacing every ill-typed literal ( s , u ) with http://www.w3.org/2005/rif/rdf-ill-typed-literal/uri-encode("s"^^u) and including all other typed literals as such. *** Becausenested frames to that of flat frames. Then we extend the differencebasic semantic structures defined in interpretation of ill-typed literals,Model Theory for the proposal is toCore RIF Condition Language and define the corresponding URIan interpretation for every ill-typed literal. A canonical definition of this corresponding URI enablesflat frames. The reconstructionrest of the original ill-typed literal, e.g. for round-tripping. Agreement needs to be reached on what this URI looks like. The proposal is: http://www.w3.org/2005/rif/rdf-ill-typed-literal/uri-encode("s"^^u) , where uri-encode is a function which appropriately encodes a typed literal; this function is to be defined. For example, an ill-typed literal "a"^^xsd:int could be encoded as http://www.w3.org/2005/rif/rdf-ill-typed-literal/%22a%22%5E%5Ehttp:/www.w3.org/TR/xmlschema-2/#string *** *** (blank nodes) It wassemantic definition does not necessary to define corresponding symbols for blank nodes, because blank nodes are interpreted locally in an RDF graph. The equivalent of blank nodes in RIF are existentially quantified variableschange, since it is defined in the body of the rule. For some considerations on the useterms of blank nodesatomic formulas (the ATOMIC production in rules and exchanging RDF rule languages, seethe preliminary section inBNF syntax).

2.2.2.1. The architecture document. *** An RIF-RDF combination isUnnest Transformation

If a tuple C=< Rformula, f, S >, where R is a Rule set over sets of constant symbols Const and variable symbols Varhas the form a # b or a ## b then define Obj(f) to be a. If f has the form o [ a -> v ], where Consto, a, and Varv are disjoint, and Sterms, then Obj(f) is defined to be Obj(o). If f is a set of RDF graphs of an RDF vocabulary Vterm then Obj(f) = f. Now, if f is a term then we define Unnest(f) = true, where Consttrue is the union of V U * , V PL * , V TL * , anda set of untyped constants. ***Noticeformula that the vocabulariesis always true (a tautology). If f is a classification formula then Unnest(f) = f. Otherwise, if f is a frame of the RIF rule set (excluding the untyped constants) and the RDF graph are isomorphic.form o [ a -> v ] then

   Unnest(f) = And(Unnest(o)  Obj(o) [ a -> Obj(v) ]  Unnest(v))

For instance, in case of the frame a # b [ c -> e ## f [ g -> h ] ] above, unnesting yields:

   Unnest(a # b [ c -> e ## f [ g -> h ] ])    =    And(a # b  a [ c -> e ]  e ## f  e [ g -> h ]  true)

This way, both semantics (the RIF andis almost the RDF semantics) apply to all symbols insame conjunction as we have seen earlier. The combination. *** In RIF-RDF combinations, thereonly difference is a correspondence between RDF triples ofthe form s p o .trailing true conjunct, which comes from Unnest(h) and RIFcan be omitted.

2.2.2.2. Extension of Semantic Structures for Frames

A semantic structure, I, is a tuple of the form

  • s'[p' -> o']<D, where s'IC, p'IV, and o' are RIF symbols corresponding toIF, IR, Islot, ISF, ISR, Isub, Iisa>.

All the RDF symbols scomponents except the last five, Islot, ISF, ISR, pIsub, and oIisa, respectively. 4.2.2. Semanticsare the semantics of RIF-RDF combinations is defined in terms of common models.same as before. The RDF Semantics document defines 4 (normative) kinds of interpretations: simple interpretations (which do not pose any conditions onnew mapping Islot is used to interpret frames; the RDFmappings ISF and RDFS vocabularies), RDF interpretations (which impose additional conditions on the RDF vocabulary), RDFS interpretations (which impose additional conditions on the RDFS vocabulary),ISR interpret terms and D-interpretations (which impose additional conditions on the treatment of datatypes, relativepredicates with named arguments, respectively; Isub gives meaning to a datatype map D). We only treatthe case of D-interpretation wheresubclass hierarchy; and Iisa interprets class membership.

  • Islot is a function from the datatype mapdomain D correspondsto the fixed datatype maptruth-valued functions of RIF,the form D RIF× D TV. 4.2.2.1. Common Interpretations We defineThe notion of common interpretation , which is an interpretationintuitive meaning of both an RIF rule sets and an RDF graph. This common interpretationframe slots is the basis for the semantic definitions in the following sections. A common interpretation extends both an RIF semantic structure and an RDF simple interpretation, thereby guaranteeingthat the semantics of the combination is an extensionthey are functions that take objects and return sets of the semanticsobjects, where every member of both formalisms. The correspondence between the RIF structures andthe RDF interpretation is defined throughset has a numbercertain degree of conditions which ensure the correspondencetruth. In the interpretationtwo-valued case, a set of names (i.e. URIs and literals) and formulas, i.e.objects associated with the correspondence between RDF triples oftruth value true represents the form s p o . and RIF(set of) values that the slot returns when applied to an object. Formally, this is expressed by extending ITruth to flat frames of the form s'[p' -> o'] ,as follows:

    • ITruth(T [ p1 -> V1 ... pk -> Vk ]) = mini=1...k(ITruth(T [ pi -> Vi ])), where s'T, p'pi, and o'Vi are RIF symbols correspondingterms.

    • ITruth(T [ p -> V ]) = Islot(I(p))(I(T),I(V))

  • ISF interprets terms with named arguments. It is a function from Const to the RDF symbols s , p , and o , respectively.. As defined inmappings SetOfFiniteSubbags(D × D) D. This is analogous to the RDF Semantics specification, a simpleinterpretation of regular (positional) terms with two differences:

    • Each argument <s,v> D × D represents a vocabulary V isslot-name/slot-value pair instead of just a tuple I=< IR,IP,IEXT,IS,IL,LV >, where IR isvalue in positional terms.

    • The argument to a non-empty set of resources (the domain), IPslotted term is a setfinite bag of properties, IEXT isslot/value pairs rather than an extension function, which is a mapping from IP intoordered sequence.

      Bags are used here because, for slotted terms, the power setorder of IR x IR, ISslot/value pairs is a mapping fromimmaterial, but sets cannot be used, since I may happen to map different slots into the RDF URI referencessame value in V into (IR union IP), IL is aD.

      We can now extend the mapping I from typed literals in V into IR, and LV is the set of literal values, which is a subsetSection Model Theory for Condition Language of IR, and includes all plain literals in V . A common interpretationRIF BLD as follows (where only the last item is a combinationnew with respect to the earlier definition of an RIF semantic structure and an RDF interpretation (I):

    • I(k) = < D ,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 ,(f)(I R ,(t1),...,I slot ,(tn))

    • I(f ( p1 -> t1 ... pn -> tn )) = ISF ,(f)({<I SR ,(p1),I sub ,(t1)>,...,<I isa >, I=<IR, IP, IEXT, IS, IL, LV>) such that the following conditions hold: IR(pn),I(tn)>})

    • Here we use {...} to denote bags.
  • ISR is a subset of D ; IPused to interpret predicates with slotted arguments. It is a superset offunction from the set of all k in D such that there exist a,b inConst to truth-valued mappings SetOfFiniteSubbags(D and I slot (k)(a,b)=t; (IR union IP) =× D ; LV) TV. This is a supersetanalogous to the interpretation of (regular (positional) predicates except for two differences:

    • Each pair <s,v> D intersection (V d1 union V d2 union ... union V dn )), where d1 ... dn are× D represents a slot-name/slot-value pair instead of just a value in positional predicates.

    • The rangeargument to a slotted predicate is a finite bag of D RIF , and V di denotesslot/value pairs rather than an ordered sequence.

      Bags (also known as multisets) are used here because for slotted predicates the value spaceorder of a datatype di, for all 1 slot-value pairs does not matter, but sets cannot be used, since I n; IEXT(k) =may happen to map different slots into the set of all pairs (a, b), with a,bsame value in D , such that.

    • We can now define I slot (k)(a,b)=t,Truth for every k in D ; IS( u ) =slotted predicates as follows:

      • I CTruth(p ( "u"^^rif:iri ) for every URI reference u in V U ; IL(( s , up1 -> val1 ... pk -> valk )) = I CSR(p)({<I( "s"^^up1) for every well-typed literalI( s , uval1) in V TL ; IL(( s>, u )) =... , <I C( "http://www.w3.org/2005/rif/rdf-ill-typed-literal/uri-encode("s"^^u)"^^rif:iripk) for every ill-typed literalI( s , uvalk) in V TL>}), where p, pi Const and vali is a term for i=1,...k.

  • *** Simple interpretations require the set of plain literals V PLIsub gives meaning to be included in LV; this condition is met through the inclusion of the subset of the value spaces ofthe string and rif:text datatypes insubclass relationship. It is a truth-valued function D × D TV. *** *** (explanation of the conditions) RDF makes a distinction betweenThe setstruth valuation for classification formulas of resources and properties; RIF does not. Condition 1 ensures that all resources in an RDF interpretation correspond to elements in the RIF domain. Condition 2 ensures thatthe set of properties at least includes all elements whichform sc ## cl, where sc and cl are usedterms, is defined as propertiesfollows:

    • ITruth(sc ## cl) = Isub(I(sc), I(cl))

    • In addition, we want the RIF domain. Condition 3 ensures that the combination of resourcesoperator  ##  to be transitive, i.e., we would like c1 ## c2 and properties corresponds exactlyc2 ## c3 to the RIF domain; noteimply c1 ## c3. To this end, we require that ifthe mapping I is an rdf- or rdfs-interpretation, IP issub defines a subset of IR, and thus IR=partial order on D. Condition 4 ensures thatMore precisely,

      • For all literal values inelements ec1, ec2, ec3 D are included in LV. Condition 5 ensures that RDF triples are interpreted in, the same way as properties frames. Condition 6 ensures that IRIs are interpreted infollowing must hold: mint(Isub(ec1, ec2), Isub(ec2,ec3))   t   Isub(ec1, ec3)

      where t denotes the same way. Finally, conditions 7truth order on TV (see Section Model Theory for Condition Language of RIF BLD) and 8 ensure that typed literals are interpreted inmint is the same way. *** *** Alternatively, IR could be requiredminimum with respect to be equalthat truth order.

  • Iisa gives meaning to class membership. It is a truth-valued function D × D TV. This will already beThe casetruth valuation for RDF and RDFS entailment, because IP is required to be a subset of IR. However, in simple entailment IP is not required to be a subset of IR. Another possibility would be to additionally require IR to be a supersetclassification formulas of D \IP, although it is at this point is not entirely clear what this would buy us. *** 4.2.2.2. Satisfactionthe form o # cl, where o and Modelscl are terms, is defined as follows:

    • ITruth(o # cl) = Iisa(I(o), I(cl))

    • We now define the notion of satisfiability for common interpretation, i.e.also want  #  and  ##  to have the conditions under which a common interpretation ( I , I) is a modelusual property that all members of a combination C=< R , S >. We define notions of satisfiability for all 4 entailment regimessubclass are also members of RDF (simple, RDF, RDFS,the superclass, i.e., we want o # cl and D).cl ## scl to imply o # scl. To this end, we introduce the definitions are all analogous. Intuitively, a common interpretation ( I , I) satisfies a combination C=< R , S > iffollowing restriction on the mappings I satisfies Risa and I satisfies S . A common interpretation ( Isub:

      • For all elements eo, I) simple-satisfies an RIF-RDF combination C=< Rec, S > if I satisfies Res D, the following must hold:   mint(I is a simple interpretationisa(eo, andec), I satisfies every RDF graph S in S ; in this casesub(ec,es))   t   Iisa(eo, I)es)

      where t and mint are as before.

3. RIF Rule Language

(Editor's Note: This text is calledmaintained on wiki page RIF Rule Language).

This section develops a simple model , or simply modelRIF-BLD Rule Sublanguage by extending the RIF Condition Language, of C,where conditions become rule bodies. RIF Phase I covers only Horn Rules and C is simple-satisfiable .a simple interpretation Inumber of a vocabulary Vextensions that do not increase the expressive power of the language. The envisioned RIF dialects will extend the RIF-BLD rule language by generalizing the positive RIF conditions and by other means.

3.1. Horn Rules

(Editor's Note: This text is an rdf-interpretation if V includesmaintained on wiki page Horn Rules).

This section defines Horn rules for RIF Phase 1. The RDF vocabularysyntax and thesemantics incorporates RIF Positive Conditions on rdf-interpretations describeddefined in the [RDF-Semantics] document hold for I.Section Positive Conditions.

3.1.1. Syntax

3.1.1.1. Rules

A common interpretation ( I , I) rdf-satisfies an RIF-RDF combination C=< R , S > if I satisfies R , I is an rdf-interpretation , and I satisfies every RDF graph S in S ; in this case ( I , I)rule is called an rdf-modela statement of C, and Cthe form head :- body, where head is rdf-satisfiable . An rdf-interpretation I ofa vocabulary Vnon builtin atomic well-formed formula (i.e., formula with signature atomic but not bi_atomic); body is an rdfs-interpretation if V includes the RDFS vocabularya well-formed condition formula as defined in Sections Symbols and the conditions on rdfs-interpretations describedSignatures and Slotted Terms and Frames. All bound variables that occur in the [RDF-Semantics] document holdrule are implicitly or explicitly universally quantified outside of the rule.

3.1.1.2. EBNF for I. A common interpretation ( I , I) rdfs-satisfies an RIF-RDF combination C=< R , S > if I satisfies R , I is a rdfs-interpretation , and I satisfies every RDF graph Sthe Presentation Syntax

The overall structure of the syntax used in S ;the RIF-BLD Horn rule sublanguage can be depicted using the following diagram, which extends the diagram shown in this case ( I , I) is called a rdfs-model ,Section Positive Conditions.

@@@@

The class Ruleset contains zero or simply model , of C, and Cmore RULEs, where each RULE is rdfs-satisfiable . Given a datatype map D, an rdfs-interpretation Ione of a vocabulary Vthe following classes:

  • Implies, which distinguishes if-CONDITION from then-ATOMIC parts

  • ATOMIC, which represents facts

  • Forall, which is specified through its parts, i.e. one or more variable (Var) declarations and, recursively, a D-interpretation if V includesRULE as the URIsformula in their scope

Although not reflected in the domain of D RIF and the conditions on each ofdiagram above or the <URI, datatype> pairs in DEBNF syntax below, RIF described indoes not allow implicitly quantified variables: all the [RDF-Semantics] document holdvariables that are to be universally quantified in I. A common interpretation ( I , I) D RIF -satisfiesan RIF-RDF combination C=< R , S > if I satisfies R , I is a D^RIF^-interpretation , and I satisfies every RDF graph S in S ;Implies or an ATOMIC MUST be declared in this case ( I , I) is called a rdfs-model ,an explicit Forall containing, ultimately, the Implies or simply modelATOMIC as its formula.

The syntactic classes Var, CONDITION, of C,and C is D RIF -satisfiable . 4.2.2.3. Entailment Using the notions of models defined above, we define entailmentATOMIC were specified in the usual way, i.e. through inclusion of sets of models. A combination C 1 simple-entails a combination C 2 if every simple model of C 1 is a model of C 2 . A combination C 1 rdf-entails a combination C 2 if every rdf-model of C 1 is a model of C 2 . A combination C 1 rdfs-entails a combination C 2 if every rdfs-model of C 1 is a model of C 2 . A combination C 1 D RIF -entails a combination C 2 if every D RIF -model of C 1 is a model of C 2Section Positive Conditions.

4.2.3. Embeddings (informative) RIF-RDF combinations can be embedded into RIF Rule sets in a fairly straightforward way, thereby demonstrating how an RIF-compliant translator without native support for RDF can process RIF-RDF combinations. ForThe embedding we usepresentation syntax for Horn rules extends the concretesyntax of RIFfor Positive Conditions with the following productions.

  Ruleset  ::= RULE*
  RULE     ::= ' Forall ' Var+ ' ( ' RULE ' ) ' | Implies | ATOMIC
  Implies  ::= ATOMIC ' :- ' CONDITION

Var, ATOMIC, and CONDITION were defined as part of the N-Triplessyntax for RDF. Throughout this sectionpositive conditions in Positive Conditions. The function trsymbol :- denotes the implication connective used in rules. The statement ATOMIC :- CONDITION should be informally read as if CONDITION is defined, which maps symbols, triples, and RDF graphs totrue then ATOMIC is also true. RIF symbols, statements,deliberately avoids using the connective here because in some RIF dialects, such as LP and rule sets. 4.2.3.1. Embedding SymbolsPR, the function tr maps RDF symbolsimplication :- will have different meaning from the meaning of a vocabulary Vthe first-order implication ←.

Rules are generated by the Implies production. Facts are generated by the ATOMIC production, and a set of blank nodes B to RIF symbols,can be viewed as defined in following table. RDF Symbol RIF Symbol Mapping RDF URI reference uri in V U Constant with datatype rif:iri tr( uri ) = "uri"^^rif:iri Blank node x in B Variable symbols ? x tr( x ) = ? x Plain literal without a language tag xxx in V PL Constant withthe datatype xsd:string tr( "xxx" ) = "xxx"^^xsd:string Plain literalsthen part of an Implies with a language tag ( xxx , lang ) in V PL Constantan empty conjunctive if (or with true as the datatype rif:text tr( "xxx"@lang ) = "xxx'@lang"^^rif:text , where xxx' is obtained from xxxif part). The RULE production generates a rule or fact, possibly universally closed.

Note that, by replacing every occurrence of @definition, atomic formulas that correspond to builtin predicates (i.e., formulas with @@ Well-typed literal ( s , usignature bi_atomic) are not allowed in V TL Constant withthe datatype u tr( "s"^^u ) = "s"^^u Ill-typed literal ( s , u )rule heads. This restriction is not reflected in V TL Generated constant with the datatype rif:iri  tr( "s"^^u ) = "http://www.w3.org/2005/rif/rdf-ill-typed-literal/uri-encode("s"^^u)"^^rif:iri 4.2.3.2. Embedding Triples and Graphsthe mapping function trdiagram or EBNF syntax above.

A ruleset is extended to embed triples as RIF statements and graphs as setsa set of RIF statements. Finally, two embedding functions, tr R and tr Q embed RDF graphs as RIF rule setsrules; it is generated by the production Ruleset.

Note also that, since CONDITION permits disjunction and conditions, respectively.existential quantification, the following section shows how these embeddings can be used for reasoning with combinations. We define two mappings for RDF graphs, one (tr R ) in which variablesrules defined by the Implies production are Skolemized, i.e. replaced with constant symbols, and one (tr Q )more general than pure Horn rules. This extension was explained in which variables are existentially quantified.the function sk takes as argumentsintroduction to Section Positive Conditions.

Well-formed rules. A rule is well-formed iff its ATOMIC part is a well-formed atomic formula with variables R,and returnsthe CONDITION part is a formula R',well-formed condition formula.

The document RIF Use Cases and Requirements includes a use case "Negotiating eBusiness Contracts Across Rule Platforms", which discusses a business rule slightly modified here:

If an item is  obtained from R by replacing every variable symbol ? x in R with "new-uri"^^rif:iri , where new-uriperishable and it is  a new globally unique URI. *** alternatively, sk could be defineddelivered to  replace variables with new globally unique constants withJohn more than 10 days after the
 datatype rif:bNode , as proposed by DaveReynolds . However, as this embedding is onlyscheduled delivery date then the item will be rejected by him.

In the Presentation EBNF Syntax used for reasoning, I ( JosDeBruijn ) don't thinkthroughout this is necessary.document, this datatype mightrule can be necessary for the exchangewritten in one of RDFthese two equivalent ways:

Example 5 (A RIF rule  languages; see the corresponding preliminary sectionin the  architecture document. *** RDF Constructpresentation syntax)
  Here we use the prefix ppl as an abbreviation for http://example.com/people#.
  The prefix op is used for a yet-to-be-determined IRI, which will be used for
  RIF  Construct Mapping Triple s p o . Property frame tr( sbuiltin predicates.

a. Universal form:

  Forall ?item ?deliverydate ?scheduledate ?diffdate
      (
        reject^^rif:local ( ppl:John^^rif:iri ?item )  [ tr( p:-
           And ( perishable^^rif:local ( ?item )
                  -> tr( odelivered^^rif:local ( ?item ?deliverydate ppl:John^^rif:iri )
                  ] tr( s p o .scheduled^^rif:local ( ?item ?scheduledate )
                  = tr( stimediff ( ?diffdate ?deliverydate ?scheduledate )
                  [ tr( pop:numeric-greater-than ( ?diffdate 10 )  -> tr( o)
       ] Graph S Rule set tr R (S) tr R (S) = the set of all sk(Forall tr( s p o . )) such that s p o . is a triple in S Graph S Condition (query) tr Q (S) tr Q (S) = Exists  tr( ?x1 ) , ...,  tr( ?xn )  And( tr( t1 )  ...  tr( tm)

b. Universal-existential form:

  Forall ?item
      (
        reject^^rif:local ( ppl#John^^rif:iri ?item )  , where x1 , ..., xn:-
           Exists ?deliverydate ?scheduledate ?diffdate
               (
                 And ( perishable^^rif:local ( ?item )
                       delivered^^rif:local ( ?item ?deliverydate ppl:John^^rif:iri )
                       scheduled^^rif:local ( ?item ?scheduledate )
                       timediff ( ?diffdate ?deliverydate ?scheduledate )
                       op:numeric-greater-than ( ?diffdate 10 ) )
               )
      )

In form (a), all variables are quantified universally outside of the blank nodes occurringrule. In tr(S) and t1 , ..., tmform (b), the variables that do not appear in the rule then part are instead quantified existentially in the if part. These two forms are logically equivalent.

3.1.1.3. XML Syntax

EDITORS' NOTE: The XML syntax for BLD presented here is one of the proposals the Working Group is considering. It is presented here to get feedback on this strawman and to give readers an idea for the tripleskind of information that will be presented in S 4.2.3.3. Embedding Simple Entailmentthis section.

The following theorem shows how checking simple-entailment of combinations can be reduced to checking entailmentextends the XML syntax of RIFPositive Conditions, by usingserializing the embeddingsabove EBNF Syntax of RDF graphsRIF Horn rules in XML. The Forall element contains the role elements declare and formula, which were earlier used within the Exists element of Positive Conditions. The previous section. TheoremImplies element contains the role elements if and then to designate these two parts of a combination <R 1 ,{S1,...,Sn}> simple-entailsrule.

- Ruleset (rule collection, containing rule roles)
- Forall  (quantified formula for 'Forall', containing declare and formula roles)
- Implies (implication, containing if and then roles)
- if      (antecedent role, containing CONDITION)
- then    (consequent role, containing ATOMIC)

For the XML Schema Definition (XSD) of the RIF-BLD Horn rule language see Appendix Specification.

For instance, the rule in Example 5a can be serialized in XML as shown below as the first element of a combination <c,{T1,...,Tm}>, where crule set whose second element is a condition, iff (R 1 union tr R (S1) union ... union tr R (Sn)) entails c, tr Q (T1),..., and tr Q (Tm). 4.2.3.4. Built-ins requiredbusiness rule for Fred.

Example 6 (A RIF rule set in XML syntax)

<Ruleset>
 <rule>
  <Forall>
    <declare><Var>item</Var></declare>
    <declare><Var>deliverydate</Var></declare>
    <declare><Var>scheduledate</Var></declare>
    <declare><Var>diffdate</Var></declare>
    <formula>
      <Implies>
        <if>
          <And>
            <formula>
              <Uniterm>
                <op><Const type="rif:local">perishable</Const></op>
                <arg><Var>item</Var></arg>
              </Uniterm>
            </formula>
            <formula>
              <Uniterm>
                <op><Const type="rif:local">delivered</Const></op>
                <arg><Var>item</Var></arg>
                <arg><Var>deliverydate</Var></arg>
                <arg><Const type="rif:iri">ppl:John</Const></arg>
              </Uniterm>
            </formula>
            <formula>
              <Uniterm>
                <op><Const type="rif:local">scheduled</Const></op>
                <arg><Var>item</Var></arg>
                <arg><Var>scheduledate</Var></arg>
              </Uniterm>
            </formula>
            <formula>
              <Uniterm>
                <op><Const type="rif:local">timediff</Const></op>
                <arg><Var>diffdate</Var></arg>
                <arg><Var>deliverydate</Var></arg>
                <arg><Var>scheduledate</Var></arg>
              </Uniterm>
            </formula>
            <formula>
              <Uniterm>
                <op><Const type="rif:iri">op:numeric-greater-than</Const></op>
                <arg><Var>diffdate</Var></arg>
                <arg><Const type="xsd:long">10</Const></arg>
              </Uniterm>
            </formula>
          </And>
        </if>
        <then>
          <Uniterm>
            <op><Const type="xsd:long">reject</Const></op>
            <arg><Const type="rif:iri">ppl:John</Const></arg>
            <arg><Var>item</Var></arg>
          </Uniterm>
        </then>
      </Implies>
    </formula>
  </Forall>
 </rule>
 <rule>
  <Forall>
    <declare><Var>item</Var></declare>
    <formula>
      <Implies>
        <if>
          <Uniterm>
            <op><Const type="rif:local">unsolicited</Const></op>
            <arg><Var>item</Var></arg>
          </Uniterm>
        </if>
        <then>
          <Uniterm>
            <op><Const type="rif:local">reject</Const></op>
            <arg><Const type="rif:iri">ppl:Fred</Const></arg>
            <arg><Var>item</Var></arg>
          </Uniterm>
        </then>
      </Implies>
    </formula>
  </Forall>
 </rule>
</Ruleset>

3.1.1.4. Translation Between the embeddings of RDFPresentation and RDFS entailment require a number of built-in predicate symbols to be available to appropriately deal with literals. *** Alternatively, these predicates might be axiomatized. However, as this requires a large number of facts, we deem such axiomatization undesirable. *** Given a vocabulary V , the unary predicate wellxml V /1 is interpreted as the set of XML values corresponding tothe well-typedXML literals in V TL ,Syntaxes

The unary predicate illxml V /1 is interpreted astranslation between the set of objects corresponding to ill-typed XML literals in V TL ,presentation syntax and the unary predicate illD V /1XML syntax is interpreted asgiven by a table that extends the settranslation tables of objects corresponding to ill-typed literals in V TL ,Positive Conditions and the unary predicate lit/1 is interpretedSlotted Conditions as the unionfollows.

Presentation SyntaxXML Syntax
Ruleset (
  clause1
   . . .
  clausen
        )
<Ruleset>
  <rule>clause1</rule>
   . . .
  <rule>clausen</rule>
</Ruleset>
Forall
  variable1
  . . .
  variablen (
             body
            )
<Forall>
  <declare>variable1</declare>
   . . .
  <declare>variablen</declare>
  <formula>body</formula>
</Forall>
head :- body
<Implies>
  <if>body</if>
  <then>head</then>
</Implies>

3.1.2. Semantics

3.1.2.1. Interpretation and Models of Rules

Section Positive Conditions defined the value spacesnotion of all data types. *** Depending on the built-in predicates which will eventually be available in RIF (BLD), the suggested built-in predicates might not be necessary. *** 4.2.3.5. Embedding RDF Entailment We axiomatize the semanticssemantic structures and how such structures determine truth values of the RDF vocabulary using the followingRIF rules andconditions. The compact URIs usedcurrent section defines what it means for such a structure to satisfy a rule.

While semantic structures can be multivalued in RIF dialects that extend the RIFBLD, rules are typically two-valued even in this sectiondialects that support inconsistency and uncertainty. Consider a rule of the next are short for the complete URIs with the rif:iri datatype, e.g. rdf:type is short for "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"^^rif:iri R RDF = ( Forall  tr( s p o . )) for every RDF axiomatic triple s p o . ) union ( Forall ?x ?x[rdf:type -> rdf:Property] :- Exists ?y,?z (?y[?x -> ?z])form Q then :- if, Forall ?x ?x[rdf:type -> rdf:XMLLiteral] :- wellxml(?x) ) C RDF = ( Exists ?x (And(?x[rdf:type -> rdf:XMLLiteral] illxml(?x)) ) Theorem A combination <R 1 ,{S1,...,Sn}> is rdf-satisfiable iff ( R RDF union R 1 union tr S1 (S1) union ... union tr Sn (Sn)) does not entail C RDF . Theorem An rdf-satisfiable combination <R 1 ,{S1,...,Sn}> rdf-entails a combination <c,{T1,...,Tm}>,where cQ is a condition, iff ( R RDF union R 1 union tr S1 (S1) union ... union tr Sn (Sn)) entails c, tr Q (T1),..., and tr Q (Tm). 4.2.3.6. Embedding RDFS Entailment We axiomatize the semantics ofquantification prefix for all the RDF(S) vocabulary usingvariables in the following RIF rules and conditions. R RDFS = R RDF union ( Forall  tr( s p o . ))rule. For every RDFS axiomatic triple s p o . ) union ( Forall ?x ?x[rdf:type -> rdfs:Resource] , Forall ?u,?v,?x,?y ?u[rdf:type -> ?y] :- And(?x[rdfs:domain -> ?y] ?u[?x -> ?v]) , Forall ?u,?v,?x,?y ?v[rdf:type -> ?y] :- And(?x[rdfs:range -> ?y] ?u[?x -> ?v]) , Forall ?x ?x[rdfs:subPropertyOf -> ?x] :- ?x[rdf:type -> rdf:Property] , Forall ?x,?y,?z ?x[rdfs:subPropertyOf -> ?z] :- And (?x[rdfs:subPropertyOf -> ?y] ?y[rdfs:subPropertyOf -> ?z]) , Forall ?x,?y,?z1,?z2 ?z1[y -> ?z2] :- And (?x[rdfs:subPropertyOf -> ?y] ?z1[x -> ?z2]) , Forall ?x ?x[rdfs:subClassOf -> rdfs:Resource] :- ?x[rdf:type -> rdfs:Class] , Forall ?x,?y,?z ?z[rdf:type -> ?y] :- And (?x[rdfs:subClassOf -> ?y] ?z[rdf:type -> ?x]) , Forall ?x ?x[rdfs:subClassOf -> ?x] :- ?x[rdf:type -> rdfs:Class] , Forall ?x,?y,?z ?x[rdfs:subClassOf -> ?z] :- And (?x[rdfs:subClassOf -> ?y] ?y[rdfs:subClassOf -> ?z]) , Forall ?x ?x[rdfs:subPropertyOf -> rdfs:member] :- ?x[rdf:type -> rdfs:ContainerMembershipProperty] , Forall ?x ?x[rdfs:subClassOf -> rdfs:Literal] :- ?x[rdf:type -> rdfs:Datatype] , Forall ?x ?x[rdf:type -> rdfs:Literal] :- lit(?x) ) C RDFS = ( Exists ?x (And(?x[rdf:type -> rdfs:Literal] illxml(?x)) ) Theorem A combination <R 1 ,{S1,...,Sn}> is rdfs-satisfiable iff ( R RDFS union R 1 union tr S1 (S1) union ... union tr Sn (Sn)) does not entail C RDF . *** Some more detailed analysisthe Horn subset, Q is still to do to see whether more conditions are requireda universal prefix, i.e., all variables in C RDFS to check for ill-typed literals whichthe rule are universally quantified outside of the type rdfs:Literal. *** Theorem An rdfs-satisfiable combination <R 1 ,{S1,...,Sn}> rdfs-entails a combination <c,{T1,...,Tm}> iff ( R RDFS union R 1 union tr S1 (S1) union ... union tr Sn (Sn)) entails c, tr Q (T1),..., and tr Q (Tm). 4.2.3.7. Embedding D^RIF^-Entailmentrule. We axiomatizefirst define the semanticsnotion of rule satisfaction without the data types using the following RIF rules and conditions. R D = R RDFS union ( Forall u[rdf:type -> rdfs:Datatype] | for every URI in the domain of D RIF ) union ( Forall "s"^^u[rdf:type -> "u"^^rif:iri] | for every well-typed literalquantification prefix Q:

I |= then :- if

iff ITruth( , ) in V TLthen) uniont ITruth( Forall ?x, ?y dt(?x,?y) :- And(?x[rdf:type -> ?y] ?y[rdf:type -> rdfs:Datatype]) ) ***Noteif). (Recall that the existenceset of certain built-ins corresponding to data types (e.g.truth values, TV, has a built-in string/1 whichpartial order t.)

We define I |= Q then :- if iff I* |= then :- if for every I* that agrees with I everywhere except possibly on some variables mentioned in Q. In this case we also say that I is always interpreted as the set of xsd:strings) would simplify the axiomatization. *** C D = ( Exists ?x (And(?x[rdf:type -> rdfs:Literal] illD(?x)) ) Theorema combination <R 1 ,{S1,...,Sn}>, where R 1 does not containmodel of the equality symbol,rule. I is D RIF -satisfiable iff (a model of a rule set R D union, denoted I |= R 1 union tr S1 (S1) union ... union tr Sn (Sn)) does not entail C D, does not entail Exists ?x And(dt(?x,u) dt(?x,u')) for any two URIs u and u'iff it is a model of every rule in the domain of D RIFset, i.e., iff it is a semantic structure such that I |= r for every rule r R.

The value spacesabove defines the semantics of D RIF ( u ) and DRIF ( u' ) are disjoint, and does not entail Exists ?x dt(s^^u,"u'"^^rif:iri)BLD using standard first-order semantics for any ( s , u ) in V TL and u' in the domain of DHorn clauses. Various RIF such that s is notdialects will extend this semantics in the lexical spacerequired directions. Some of D RIF ( u' ). *** Since this condition is very complex wethese extended semantics might wantnot have a model theory (for example, production rules) and some will have non-first-order semantics. However, all these extensions are required to leave outbe compatible with the above definition when the rule set is completely covered by RIF BLD. This theorem, and suggestmeans that the the aboveset of rules ( R D ) as an approximationintended models of the semantics. *** Theoremsuch a D RIF -satisfiable combination <R 1 ,{S1,...,Sn}>, where R 1 does not containrule set with respect to the equality symbol, Dextending dialect must coincide with the intended models defined by RIF -entails a combination <c,{T1,...,Tm}> iff ( R RDFS union R 1 union tr S1 (S1) union ... union tr Sn (Sn)) entails c, tr Q (T1),..., and tr Q (Tm). ***BLD. For further details on defining the restriction to equality-freesemantics for RIF dialects see end note on intended models for rule sets is necessary because D-interpretations impose stronger conditions on the interpretation.

3.1.2.2. Entailment of typed literals in case different datatype URIs are equal thanRIF does. *** 4.2.3.8. Finite EmbeddingsConditions by Rulesets

We will now define what it means for a set of RDFrules to entail a RIF condition. Let S be a RIF ruleset and RDFSφ a disadvantageclosed RIF condition (a condition with no occurrences of using the axiomatization R RDF isfree variables). Then we say that S entails φ, written as

S |= φ

iff for every semantic structure I, such that I |= S, it is infinite, due tothe factcase that the RDF vocabularyItruth(φ)=t.

4. References

(Editor's Note: This text is infinite. Therefore, we define a finite subset of R RDFmaintained on wiki page References).

4.1. Normative References

[RDF-CONCEPTS]

Resource Description Framework (RDF): Concepts and Abstract Syntax, R RDF-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/.

[RDF-SEMANTICS]

RDF Semantics, which can be used for reasoning. Note that this subset does not change the semantics; the embedding is still faithful with respect toPatrick Hayes, Editor, W3C Recommendation, 10 February 2004, http://www.w3.org/TR/2004/REC-rdf-mt-20040210/. Latest version available at http://www.w3.org/TR/rdf-mt/.

[RFC-3066]

RFC 3066 - Tags for the semanticsIdentification of combinations. R RDF- = R RDF \{ Forall  tr( s p o . ) | s p o .Languages, H. Alvestrand, IETF, January 2001. This document is an RDF axiomatic triple of the form rdf:_i rdf:type rdf:Property .http://www.isi.edu/in-notes/rfc3066.txt.

[XML-SCHEMA2]

XML Schema Part 2: Datatypes, with i a positive integer, such that rdf:_i does not occur in the context in which R RDF-W3C Recommendation, World Wide Web Consortium, 2 May 2001. This version is used}. Theorem A combination <R,{S1,...,Sn}> rdf-entails a combination <c,{T1,...,Tm}> iff ( R RDF- union R 1 union tr S1 (S1) union ... union tr Sn (Sn)) entails c, tr Q (T1),..., and tr Q (Tm), wherehttp://www.w3.org/TR/2001/REC-xmlschema-2-20010502/. The context of R RDF- consistslatest version is available at http://www.w3.org/TR/xmlschema-2/.

4.2. Informational References

[F-logic]

Logical foundations of the combinations <R 1 ,{S1,...,Sn}>object-oriented and <c,{S1,...,Sn}>. We define a finite subset of R RDFS analogous to the definition of R RDF- . R RDFS- = R RDFS \{ Forall  tr( s p o . ) | s p o . is an RDF axiomatic tripleframe-based languages, M. Kifer, G. Lausen, J. Wu. Journal of the form rdf:_i rdf:type rdf:Property . , with iACM, July 1995, pp. 741--843.

[HiLog]

HiLog: A positive integer, such that rdf:_i does not occurFoundation for higher-order logic programming, W. Chen, M. Kifer, D.S. Warren. Journal of Logic Programming, vol. 15, no. 3, February 1993, pp. 187--230.

[SortedHiLog]

Sorted HiLog: Sorts in the contextHigher-Order Logic Data Languages, W. Chen, M. Kifer. Sixth Intl. Conference on Database Theory, Prague, Czech Republic, January 1995, Lecture Notes in which R RDF- is used}. Theorem A combination <R,{S1,...,Sn}> rdfs-entails a combination <c,{T1,...,Tm}> iff ( R RDFS- union R 1 union tr S1 (S1) union ... union tr Sn (Sn)) entails c, tr Q (T1),..., and tr Q (Tm), where the context of R RDFS- consists of the combinations <R 1 ,{S1,...,Sn}> and <c,{S1,...,Sn}>.Computer Science 893, Springer Verlag, pp. 252--265.

[RDF-SYNTAX]

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

5. Appendix: Specification

(Editor's Note: This text is maintained on wiki page Appendix: Specification).

A syntactic specification of RIF BLD is given here as the combination of the RIF Condition and RIF Rule syntaxes.

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

The abstract syntax of RIF BLD is specified in asn06 as follows: core0308.asn It is visualized by a UML diagram as follows: Automatic asn06-to-UML transformation has been employed for this, using the available tool. The concrete syntax , in particular an XML Schema, will be derived from this (to follow in a later Working Draft).Preliminary XML schemas for the RIF BLD sublanguages are alsoavailable, which already helped to find and fix invalid parts in the examples.

6. End Notes

(Editor's Note: This text is maintained on wiki page End Notes).

6.1. Notes on Semantic Structures

Rationale: There are several equivalent ways to define first-order semantic structures. The one we adopted has the advantage that it generalizes to rule sets with negation as failure (NAF) and to logics for dealing with uncertainty and inconsistency. The difficulty is that some popular theories for NAF, such as the well-founded semantics, are based on three-valued semantic structures. Some popular ways to handle uncertain or inconsistent information (which is certainly important in the Web environment) rely on four-valued and other multi-valued logics. Therefore, following M. Fitting, Fixpoint Semantics for Logic Programming A Survey, Theoretical Computer Science, 1999, we build our definitions to be compatible with future RIF dialects, which will be based multivalued logics.

Truth values: Some RIF dialects will have additional truth values. For instance, some versions of NAF use three truth values: t, f, and u (undefined). Handling of contradictions and uncertainty requires at least four truth values: t, u, f, and i (inconsistent).

Ordering truth values: In the well-founded semantics for NAF, f <t u <t t, and it is again a total order. But in four-valued logics, which are often used for dealing with uncertain or inconsistent information, the truth order is partial: f <t u <t t and f <t i <t t. Such logics also have another partial order, called the knowledge order <k: u <k t <k i; and u <k f <k i. Under the knowledge order, true and false are incomparable, and facts that are both true and false receive the truth value i, which is the least upper bound of f and t in the knowledge order.

Intended models for rule sets: The notion of a model is only the basic ingredient in the definition of a semantics of a rule set. In general, a semantics of a rule set R is the set of its intended models (see Y. Shoham. Nonmonotonic logics: meaning and utility. In: Proc. 10th International Joint Conference on Artificial Intelligence, Morgan Kaufmann, pp. 388--393, 1987). There are different theories of what the intended sets of models are supposed to look like depending on the features of the particular rule sets.

For the basic logic dialect, which is based on Horn rules, which we use in this document,the intendedset of intended models of R is commonly agreed upon: it is the set of all modelsunique minimal model of R.

However, when rule bodies contain literals negated with the negation-as-failure connective naf, then only some of the minimal models of a rule set are viewed as intended. This issue will be addressed in the appropriate dialects of RIF. The two most common theories of intended models are based on the so called well-founded models and stable models. Here we will just illustrate the problem with a simple example.

Suppose R consists of a single rule p :- naf q. If naf were interpreted as classical negation, not, then this rule would be simply equivalent to p \/ q, and so it would have two kinds of models: one in which p is true and one where q is true. In contrast to first-order logic, most rule-based systems do not consider p and q symmetrically. Instead, they view the rule p :- naf q as a statement that p must be true if it is not possible to establish the truth of q. Since it is, indeed, impossible to establish the truth of q, such theories will derive p even though it does not logically follow from p \/ q. The logic underlying rule-based systems also assumes that only the minimal models as intended (minimality here is with respect to the set of true facts). Therefore, the intended models of the above rule set R must have the property that not only p is true but also that q is false.