# univars/exivars

From: naudts guido <naudts_vannoten@yahoo.com>
Date: Wed, 19 Oct 2005 08:17:17 -0700 (PDT)
Message-ID: <20051019151717.40827.qmail@web40524.mail.yahoo.com>
To: cwm <public-cwm-talk@w3.org>
```
Hallo,
variables in N3 inferencing which I give hereafter.
Critic is welcome.

Treatment of variables by a N3 reasoning program
-----------------------------------------------------

Goal
-------

The goal of this document is to present a certain way
of handling variables by a N3
reasoning program and to show that this way of
handling the variables is in accordance
with the document of Berners-Lee:
http://www.w3.org/DesignIssues/N3Logic, that exposes
the semantics of reasoning with Notation 3.
I will reference this as <N3Logic>

Introduction
--------------

Variables can be classified following two criteria:

* global and local variables

global variables: their value is global for the full
model
ie if not explicitly changed, the value remains for
the whole
duration of inferencing.
local variables: their value is local to a rule in
the same way as
values are local to a procedure.
An example: given the rule:
{?a rdfs:subClassOf ?b. ?b rdfs:subClassOf ?c} =>
{?a rdfs:subClassOf ?c}.
Each time this rule is called a new set of variables
is created; so this are
local variables.
Global variables are not used in N3 inferencing.

* existential and universal variables

Existential and universal are to be understood in
the same way as
in First Order Logic.
The 'Universe' is the set of RDF graphs that is used
for inferencing.

From <N3Logic> two important points:
1) existential variables are not permitted in the
premisses of rules
2) blank nodes can always be replaced with
existential variables

In N3 universal variables are declared using a
log:@forAll declaration
or a variable name with ? eg ?a.
Existential variables are declared using a
log:@forSome declaration
or a variable name with underscore eg _:a.

Problems
-----------

Problems arise when blank nodes are used.
1) In a rule:

Example:
[:account "myaccount"; :credit "70"; :debet "20"].
[:account "another"; :credt "50"; :debet "120"].
{[:account ?a; :debet ?b]. ?b math:greater "100"} =>
{[:account ?a; :warning "too much debet"]}.

If premisses of a rule may not contain existential
variables then the rule above is
in error. However the intended meaning seems rather
obvious. Remark however that
this intended meaning can be obtained also with
following rule:

{?x :account ?a; :debet ?b. ?b math:greater "100"} }
=> {?x :account ?a; :warning "too much debet"}.

So, my mechanism replaces in rules blank nodes with
universal variables; this is just for user convenience
so
that the user does not have to replace himself the
blank node with a uiversal variable; this does
not create confusion because the interpretation as an
existential variable is not permitted.

2) Blank nodes in query:

Example:
Data:
[:account "myaccount"; :credit "70"; :debet "20"].
[:account "another"; :credit "50"; :debet "120"].

Query: [:account ?a; :debet ?b].

Here the same principle applies: the blank node is
replaced with a
universal variable as a convenience for the user. So
the query becomes eg
?x :account ?a; :debet ?b.

3) Blank nodes in data:

Example:
Data:
[:account "myaccount"; :credit "70"; :debet "20"].
[:account "another"; :credit "50"; :debet "120"].

Query: [:account ?a; :debet ?b].

As the answer to the query we expect:
[:account "myaccount"; :debet "20"].
[:account "another"; :debet "120"].

So, though the blank nodes in data are considered to
be existential variables,
we do not really want to resolve this variables. So
the program gives each blank node
a unique name and then treats them as a resource. In
output however they are again represented
as a blank node.

4) Comparison of blank nodes

Example:
Data:
[:account "myaccount"; :credit "70"; :debet "20"].
[:account "another"; :credit "50"; :debet "120"].
[:account "another"; :credit "50"; :debet "120"].

Query: [:account ?a; :debet ?b].

As the answer to the query we expect:
[:account "myaccount"; :debet "20"].
[:account "another"; :debet "120"].

The two repeated statements:
[:account "another"; :credit "50"; :debet "120"].
[:account "another"; :credit "50"; :debet "120"].
are not the same because each blank node is an entity
in its own right.
However we do wish to see the answer to the query as
given, so
the two statements must be considered equal.
Therefore the programs considers all blank nodes to be
equal in a comparison.

Conclusion
------------

The treatment of the variables is guided by the
to a query. Nevertheless, this is done in accordance
with the semantic description of <N3Logic>.

G.Naudts Bouwel, 14/10/2005 E-mail: naudts_vannoten@yahoo.com

Guido Naudts
Lic. zoologie
Ir.informatica
Secretarisdreef 5
2288 Bouwel
Belgium

__________________________________
Yahoo! Music Unlimited
Access over 1 million songs. Try it free.
http://music.yahoo.com/unlimited/
```
Received on Wednesday, 19 October 2005 15:17:24 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:01:04 UTC