Difference between revisions of "RIF FAQ"

From RIF
Jump to: navigation, search
(How do I serialize RIF rules in RDF?: updated!)
(How do I store RIF rules in my triplestore?)
Line 103: Line 103:
  
 
See [http://www.w3.org/TR/rif-in-rdf RIF in RDF].
 
See [http://www.w3.org/TR/rif-in-rdf RIF in RDF].
 
=== How do I store RIF rules in my triplestore? ===
 
 
See 3.2 above.
 
  
 
=== How do I put RIF rules in RDF, so I can reason about them with more rules? ===
 
=== How do I put RIF rules in RDF, so I can reason about them with more rules? ===

Revision as of 17:27, 4 February 2013

__NUMBEREDHEADINGS__


Please send comments or additional questions to public-rif-comments@w3.org (public archive).

Answers have not necessarily been reviewed by the Working Group. The question are real, having been asked via e-mail or in person.

Some questions here have not yet been answered.


Contents

1 About RIF

1.1 What is RIF?

RIF is the W3C Rule Interchange Format. It's an XML language for expressing rules which computers can execute.

Because of the serious tradeoffs in the design of rule language, RIF provides multiple versions, called dialects. If you're not sure which dialect to use, start with RIF Core. Then, if you need rule features that are not available in RIF Core, consider the other standard dialects and third-party dialects.

1.2 What is RIF-BLD? (and RIF-Core, PRD, FLD)

The standard RIF dialects are Core, BLD, and PRD:

Core
This is the fundamental RIF language. It is designed to be the common subset of most rule engines. (It provides "safe" positive datalog with builtins.)
BLD (Basic Logic Dialect)
This adds a few things that Core doesn't have: logic functions, equality in the then-part, and named arguments. Each of these features can sort of be simulated in Core. (This is positive Horn logic, with equality and builtins.)
PRD (Production Rules Dialect)
adds a notion of forward-chaining rules, where a rule fires and then performs some action, such as adding more information to the store or retracting some information.

Note that FLD (the Framework for Logic Dialects) provides a menu for coherently assembling dialects more expressive than BLD. Links to unofficial, community-contributed RIF dialects can be found here.

More generally, the Overview provides a guide to the RIF architecture.

1.3 Is RIF only for interchange?

No. Although RIF dialects were designed primarily for interchange, each dialect is a standard rule language and can be used even when portability and interchange are not required.

1.4 "Reduction In Force"?

Yes, in some other situations, RIF stands for reduction in force, a term for reducing headcount, downsizing, layoffs, etc. We're still waiting to hear a really good pun based on this double meaning.

1.5 Can I use RIF to map between vocabularies?

Yes. It should be good for this. It's one of the use cases.

1.6 Which RIF syntax should I use?

The XML syntax is the only one defined as a standard for interchange. Various presentation syntaxes are used in the specification, but they are not recommended for sending between different systems.

1.7 Is there a mime type for RIF?

Yes, it's "application/rif+xml". See RIF Media Type Registration.

2 RIF Software

2.1 What tools (open source and commercial) currently support RIF?

Implementation plans continue to evolve. Please report any to public-rif-comments@w3.org. We try to maintain this on the Implementations page.

2.2 How fast are RIF processors compared to RDFS inference and OWL inference?

Since RIF can often be implemented by translation to other rule languages, we can speculate that the performance will differ only by the time need for translation. Many RDFS and OWL systems use underlying rule engines to do their inference, so their performance is likely to be the same or better on RIF. On the other hand, there are some OWL inference tasks which can be much more efficiently handled by DL algorithms.

2.3 Are there any SPARQL stores that support RIF?

Implementation plans continue to evolve. Please report any to public-rif-comments@w3.org. We try to maintain this on the Implementations page.

We expect that SPARQL systems which currently include rule engines, such as Jena, will implement support for RIF.

2.4 Is there a Web Service for doing RIF?

Implementation plans continue to evolve. Please report any to public-rif-comments@w3.org. We try to maintain this on the Implementations page.

2.5 Does any major technology software vendor (or project) include RIF-related libraries in their stack? IBM, Google, Microsoft, Oracle, KDE, GNOME, Apache, ...

Implementation plans continue to evolve. Please report any to public-rif-comments@w3.org. We try to maintain this on the Implementations page.

IBM & iLog, HP, Oracle, and TIBCO are active in the Working Group.

3 Relation to Other Technologies

3.1 I'd like to know if it's possible to translate RIF into SPARQL Construct clause (and back)

Some people have used SPARQL Construct clauses as a rule language, although no formal semantics have been specified for this. Because SPARQL including non-monotonic features, the full language possible here would be very expressive and very hard to specify or implement correctly. (What happens if you use !bound with some data that is provided by related rules?)

There is a subset of SPARQL Construct clauses which corresponds to a subset of RIF Core. For this common subset, SPARQL can be seen as just another presentation syntax for RIF Core. It would probably be best to try to stay within this subset when using SPARQL Construct clauses as a rule language.

3.2 How do I serialize RIF rules in RDF?

See RIF in RDF.

3.3 How do I put RIF rules in RDF, so I can reason about them with more rules?

At present you cannot do this in a standardized fashion.

If you map the RIF XML structure to an isomorphic RDF representation (for example, through use of GRDDL) then that RDF structure can be reasoned about with more rules. However, a normative such RDF representation has not be defined by the working group.

3.4 What are the relationships between the OWL 2 profiles and the RIF dialects?

There are several relationships between OWL 2 and RIF dialects.

Firstly, RIF defines the notion of RIF/OWL combinations, providing a semantics for them and a syntactic mechanism for defining such combinations by importing OWL documents into RIF documents. This is specified in RIF RDF and OWL Compatibility. This mechanism defines import profiles for both OWL 2 DL and OWL 2 Full semantics. Thus each OWL 2 Profile can be used in combination with any RIF dialect using this mechanism. There are no separate import profiles corresponding to the separate OWL 2 profiles.

Secondly, OWL 2 defines a profile, OWL 2 RL, designed to be implementable by means of rule based systems. A partial axiomatization of the OWL 2 RL semantics is given in the OWL Profiles document as a set of first order rules. These rules can be translated into RIF Core rules either as a static rule set or on a per-ontology basis as discussed in OWLRL. This enables implementation of an OWL 2 RL entailment checker or query answering tool by using the RIF Core rule set in combination with the RDF document encoding an OWL 2 RL premise ontology to derive a set of entailed RDF assertions as RIF Frame formulae.

Thirdly, RIF provides and Informative description of an embedding of OWL 2 RL within RIF BLD. This enables the translation of an OWL 2 RL document directly into a RIF BLD document.

3.5 What is the relationship between RuleML and RIF?

RuleML has provided input for RIF on several levels, including the use of 'striped' XML as well as the structuring of rule classes into a family of sublanguages with, e.g., Datalog RuleML partially mappable to the RIF Core Dialect, Derivation RuleML to the RIF Basic Logic Dialect, and the production-rule sublanguage of Reaction RuleML to the RIF Production Rule Dialect. Conversely, RuleML adopted some features that were developed as part of the RIF Working Group such as role tags <if> ... <then> instead of <body> ... <head>. Shared RIF RuleML implementations and use cases are projected to lead to further convergence.

3.6 How does RIF differ from SWRL?

RIF was designed as an interchange format for exchanging rules between rule systems, such as those that implement SWRL. SWRL is a rule language which was designed as an extension to OWL. It is one of the simpler rule languages and most SWRL features are covered by RIF-BLD with the exception of "different-from", thus it should be possible to exchange most SWRL rules via RIF.

When viewed as a rule language and compared to SWRL, RIF-BLD supports multiple-arity predicates, and SWRL is limited to unary and binary predicates. RIF-BLD has functions, SWRL is function-free. RIF-BLD has an extensive set of datatypes and builtins, SWRL supports most of the same datatypes but has no builtins. [??? Yes, it does! Under discussion.] RIF-BLD has a limited form of negation in datatype guard predicates (e.g. is-literal-not-integer), SWRL has a different limited form of negation in the "different-from" operator. RIF-BLD interoperates with OWL through a special combination semantics, SWRL is designed to be a syntactic extension to OWL. RIF-BLD allows disjunction in rules, SWRL does not.

3.7 How can I encode RIF in HTML?

RIF does not define a normative encoding in HTML. It was designed primarily for interchange of rules between rule engines, and the XML syntax is the only one defined as a standard for interchange.

However, various text-based presentation syntaxes are used in the specification: although they are not recommended for interchange between different rule systems, they can be used for rendering by HTML processors.

In general, any rule syntax that can be serialized in RIF XML in a semantics-preserving way can be used for that purpose. To avoid ambiguity, it is good practice to use only syntaxes for which a mapping to RIF XML is publicly available.

3.8 What's the difference between RIF and having an RDF 2.0 that moves beyond binary relations?

Such an RDF specification would probably look very much like RIF with RDF compatibility (see [1]). Of course, RIF also provides for if/then rules, not just ground facts like RDF.

3.9 Is RIF useful for reasoning about the provenance of claims expressed in RDF, eg. multiple named graphs in SPARQL that offer competing accounts of some situation?

If the differing named graphs are located in different web documents, then RIF with RDF compatibility (see [2]) has an import mechanism that can be directed to the specific web documents and reason about them. More refined notions of import that allow to explicitly refer to facts from different imported documents per rule could be covered in extended RIF dialects.

3.10 How do I embed RIF in an RDFS/OWL schema or ontology?

RIF RDF and OWL Compatibility specifies, formally, what it means to use RIF with RDFS and/or OWL, and provides a way, in RIF, to import RDFS and OWL.

If you need to work in RDF triples, see RIF In RDF. This lets you physically embed RIF in an RDFS/OWL document, but notes that the embedded RIF is merely described, not asserted. There is not currently a standard vocabulary saying, in RDFS/OWL, that you also want some RIF rules as part of your ontology. Instead, for now, you must have RIF import RDFS/OWL.

3.11 What's the relation between RIF and Functional-Logic Programming?

Both are founded on Horn logic with equality. Functional-Logic Programming is built on Horn logic with oriented equations in rule conclusions, used to define functions. In that sense it specializes RIF-BLD, built on Horn logic with symmetric equations. However, Functional-Logic Programming permits higher-order functions, while RIF-BLD only permits first-order functions. For an introduction to functional-logic technology, with many examples, see Visualizing Executable Functional-Logic Specifications.

4 Documentation

4.1 Where are examples to the W3C semweb technology stack, using RIF properly along with RDF, RDFS, OWL[2], etc.?

The RIF RDF and OWL Compatibility document specifies how RIF works in combination with RDF, RDFS, OWL 1, and OWL 2, and there are small examples throughout the document of RIF-RDF and RIF-OWL combinations, explaining what is entailed (or not) from them.

Two of the use cases presented in RIF Use Cases and Requirements provide motivating scenarios for RIF in combination with RDF and OWL: Interchanging Rule Extensions to OWL and Publishing Rules for Interlinked Metadata.

Also, see the RIF-RDF combination test cases and the RIF-OWL combination test cases. Among these, Young Parent Discount and UCR_4.7a are in the style of small usage examples.

4.2 Where are examples to existing RIF rules written using the simplest, bare-minimum markup and easiest logic/math?

The set of RIF documents --- including the documents on BLD, PRD and FLD --- and the set of test cases both contain a variety of examples that involve almost no logic (sometimes not even modus ponens) and no math at all.

For instance, Example 1 in BLD involves just a single application of modus ponens and no math; Example 4 shows several different ways of writing business rules that do not involve math, and require only a basic knowledge of quantifiers.

Most of the examples in test cases are quite simple, and involve nothing more than arithmetic. An example of a test case that involves simple inheritance is Classification-inheritance.

4.3 Where can I find info on RIF for the "business rules" community, esp. to help convince management to start to consider RIF as the source format?

Half of the RIF use cases describe how RIF can serve the business rules community. RIF can help to avoid vendor lock-in, foster collaboration, support eBusiness and eCommerce, optimize the supply chain, and allow business rules to be bought, sold, and shared. The production rule dialect includes typical business rules features such as rule priority, negation, decimal numbers, and dates.

4.4 What interesting things have been built using RIF?

Support for RIF is just starting to become available (see Implementations), so there has not yet been much opportunity to develop applications that use RIF.

This IBM developerWorks article discusses storing and querying rules in an XML database, and includes a live demo with RIF rules.

Some envisioned representative usage scenarios for RIF are outlined in the RIF use cases.

Please report any applications or uses of RIF to public-rif-comments@w3.org.

5 Acknowledements

Thanks to questions, comments, suggestions from:

  • Lee Feigenbaum
  • David Booth
  • Richard Cyganiak
  • Frank Manola
  • "Collette Hagert geb. Nauluta"
  • Dan Brickley