This is an archive of an inactive wiki and cannot be modified.

When speaking about RDF compatibility in RIF, we speak about RIF-RDF combinations, which are combinations of RIF rule sets and sets of RDF graphs. This section specifies how, in such a combination, the rule set and the graphs interact. In other words, how rules can "access" data in the RDF graphs and how additional conclusions which may be drawn from the RIF rules are reflected in the RDF graphs.

There is a correspondence between constant symbols in RIF rule sets and names in RDF graphs. The following table explains the correspondences of symbols.

RDF Symbol Example RIF Symbol Example
Absolute IRI <http://www.w3.org/2007/rif> Absolute IRI "http://www.w3.org/2007/rif"^^rif:iri
Plain literal without a language tag "literal string" String in the symbol space xsd:string "literal string"^^xsd:string
Plain literal with a language tag "literal string"@en String plus language tag in the symbol space rif:text "literal string@en"^^rif:text
Literal with a datatype "1"^^xsd:integer Symbol in a symbol space "1"^^xsd:integer

There is, furthermore, a correspondence between statements in RDF graphs and certain kinds of formulas in RIF. Namely, there is a correspondence between RDF triples of the form s p o . and RIF frame formulas of the form s'[p' -> o'], where s', p', and o' are RIF symbols corresponding to the RDF symbols s, p, and o, respectively. This means that whenever a triple s p o . is satisfied, the corresponding RIF frame formula s'[p' -> o'] is satisfied, and vice versa.

Consider, for example, a combination of an RDF graph which contains the triples

```john brotherOf jack .
jack parentOf mary .
```

saying that john is a brother of jack and jack is a parent of mary, and an RIF rule set which contains the rule

```Forall ?x, ?y, ?z (?x["uncleOf"^^rif:iri -> ?z] :-
And( ?x["brotherOf"^^rif:iri -> ?y] ?y["parentOf"^^rif:iri -> ?z]))
```

which says that whenever some x is a brother of some y and y is a parent of some z, then x is an uncle of z. From this combination we can derive the RIF frame formula "john"^^rif:iri["uncleOf"^^rif:iri -> "mary"^^rif:iri], as well as the RDF triple john uncleOf marry.

Note that blank nodes cannot be referenced directly from RIF rules, since blank nodes are local to a specific RDF graph. Variables in RIF rules do, however, range over objects denoted by blank nodes. So, it is possible to "access" an object denoted by a blank node from an RIF rule using a variable in a rule.

Typed literals in RDF may be ill-typed, which means that the literal string is not part of the lexical space of the datatype under consideration. Examples of such ill-typed literals are "abc"^^xsd:integer, "2"^^xsd:boolean, and "<non-valid-XML"^^rdf:XMLLiteral. Rules which include ill-typed symbols are not well-formed RIF rules, so there are no RIF symbols which correspond to ill-typed literals. However, variables may quantify over such literals. The following example illustrates both ill-typed literals and blank nodes in combinations.

Consider a combination of an RDF graph which contains the triple

```_:x hasName "a"^^xsd:integer .
```

saying that there is some blank node which has a name, which is an ill-typed literal, and an RIF rule set which contains the rules

```Forall ?x, ?y ( ?x[rdf:type -> "nameBearer"^^rif:iri] :- ?x["hasName"^^rif:iri -> ?y] )
Forall ?x, ?y ( "http://a"^^rif:iri["http://p"^^rif:iri -> ?y] :- ?x["hasName"^^rif:iri -> ?y] )
```

which say that whenever there is a some x which has some name y, then x is of type nameBearer and http://a has a property http://p with value y.

From this combination we can derive the RIF condition formulas

```Exists ?z ( ?z[rdf:type -> "nameBearer"^^rif:iri] )
Exists ?z ( "http://a"^^rif:iri["http://p"^^rif:iri -> ?z] )
```

as well as the RDF triples

```_:y rdf:type nameBearer .
<http://a> <http://p> "a"^^xsd:integer .
```

However, "http://a"^^rif:iri["http://p"^^rif:iri -> "a"^^xsd:integer] cannot be derived, because it is not a well-formed RIF formula.

This remainder of this section formally defines combinations of RIF rules with RDF graphs, as well as the semantics of these combinations. Combinations are pairs of RIF rule sets and sets of RDF graphs. The semantics of combinations is defined in terms of combined models, which are pairs of RIF and RDF interpretations. The interaction between the two interpretations is defined through a number of conditions. Entailment is defined as model inclusion, as usual.