PSOA RuleML

From RuleML Wiki
Jump to: navigation, search

Authors: Gen Zou, Harold Boley


This version: PSOA RuleML

Latest version: PSOA RuleML

Previous versions:


Positional-Slotted, Object-Applicative RuleML (PSOA RuleML) permits a relation application to have an Object IDentifier (OID) -- typed by the relation -- and, orthogonally, its arguments to be positional or slotted. The resulting positional-slotted, object-applicative (psoa) terms can be used as (positional, relation-applying) classical facts without an OID and with an -- ordered -- sequence of arguments, as (slotted, object-centered) frame facts with an OID and with an -- unordered -- multi-set of slots (each being a pair of a name and a filler), as well as in various other ways. Such psoa facts and rules over them were given a first-order model-theoretic foundation (paper, slides), blending (OID-over-)slot distribution, as in RIF, with integrated psoa terms, as in RuleML. In order to support reasoning in PSOA RuleML, the PSOA2TPTP translator was implemented, which maps PSOA RuleML knowledge bases and queries to the TPTP format, as widely used for theorem provers. With this translator, reasoning in PSOA RuleML is available using the VampirePrime prover. The composition of PSOA2TPTP and VampirePrime to PSOATransRun has been developed under an online GUI.

1 Introduction

Knowledge representation is at the foundation of Semantic Web applications, using rule and ontology languages as the main formalisms. PSOA RuleML is a RIF-RuleML-bridging rule language that combines the ideas of relational (predicate-based) and object-centered (graph/frame-based) modeling. In PSOA RuleML, the notion of a positional-slotted, object-applicative (psoa) term is introduced as a generalization of: (1) the positional-slotted term in POSL and (2) the frame term and the class membership term in RIF-BLD. A psoa term has the following general presentation-syntax form:

   o#f([t1,1 ... t1,n1] . . . [tm,1 ... tm,nm] p1->v1 . . . pk->vk)

Here, o is the object identifier (OID) which gives a unique identity to the object described by the term by connecting three kinds of information: (1) The class membership o # f makes o an instance of type f; (2) each tupled argument [ti,1 ... ti,ni] represents a sequence of terms associated with o; (3) each slotted argument pi -> vi represents a pair of an attribute pi and its value vi associated with o.

A psoa term can be used as an atomic formula. Such psoa atoms can be asserted as psoa facts. They can also be combined into more complex formulas using constructors from the Horn-like subset of first-order logic: conjunction, disjunction in negative positions, existential and universal quantifiers. Implication ':-' can be used to form rules. Such psoa rules can be used to derive psoa atoms on demand, through psoa querying.

The page for the PSOATransRun Demo gives introductory examples. The papers and slides in the References provide details. These include the two award-winning papers 1. and 3.

Since PSOA RuleML allows for both object-centered and relational knowledge/data modeling, it can support the specification of all kinds of object-relational transformations between the global and local schemas in Ontology/Rule-Based Data Access (OBDA/RBDA).

A visualization for PSOA RuleML has been developed in Grailog, permitting integrated object-relational knowledge (InteropGraphRel).

2 Specification

The specification of the PSOA RuleML presentation syntax and semantics is given in Ref 1.

The PSOA RuleML/XML serialization will extend Hornlog RuleML 1.0. For (multi-)tupled psoa terms, rather than adding a <Tuple> node element, (multiple occurrences of) a RIF-like <args> edge element will be used. Such edges containing more than one child node have already long been employed for the Deliberation RuleML <slot> edge, containing two child nodes, and were recently introduced into Reaction RuleML, hence LegalRuleML.

Terminology: Edges containing exactly one child node will be called scalar edges. Edges containing containing two or more child nodes will be called vector edges.

Note that this new distinction is separate from the widely used distinction between single-valued and multi-valued attributes, slots, roles, or edges. For example, RuleML 1.0's <declare> is a multi-valued scalar edge; e.g., FOL RuleML's <Forall><declare><Var>person</Var></declare><declare><Var>object</Var></declare><formula>...</formula></Forall> employs a 2-valued <declare> edge, each containing one <Var> node.

A psoa term used as an atomic formula has the following general XML-serialization form, where the primed meta-variables t'i,j etc. indicate recursive XML serializations of their above presentation-syntax versions:

   <Atom>
     <oid><Ind>o</Ind></oid><op><Rel>f</Rel></op>
     <args>t'1,1 ... t'1,n1</args> . . . <args>t'm,1 ... t'm,nm</args>
     <slot>p'1 v'1</slot> . . . <slot>p'k v'k</slot>
   </Atom>

3 Implementation

3.1 PSOATransRun

In order to support reasoning in PSOA RuleML, we have implemented PSOATransRun, which under an online GUI composes two services. The first, PSOA2t, for translation from PSOA to some target language t. The second, r, for some runtime environment executing the language t. The service has multiple instantiations using different target languages, where different combinations of a translator PSOA2t and a runtime environment r are employed. Currently, the instantiations for (PSOA2t,r) = (PSOA2TPTP,VampirePrime) and (PSOA2t,r) = (PSOA2Prolog,XSBProlog) are available online.

Semantic Web Techniques Course Project (Fall 2011) Version: http://reubenpeterpaul.github.com/PSOA-to-TPTP/build/html/index.html

Project Repository: http://psoa2tptp.googlecode.com

Online System: http://psoa.ruleml.cloudbees.net

Invited Demo Examples on RuleML 2012: PSOATransRunInvitedDemoRuleML2012


  • Workflow of using PSOATransRun (sample KBs & queries can be obtained from the Test Case section):

1) load the PSOATransRun page;

2) enter a KB into the rulebase textbox (ignore this step if you use the sample KB provided by the system);

3) click "Translate Rulebase" (takes you to the "TPTP Rulebase" pane and the translated KB in the TPTP format is shown);

4) enter a query into the query textbox (for example, _k1#_kid(_Sue _Pete));

5) click "Translate Query" (leaves you on the "TPTP Rulebase" pane, and the translated query in the TPTP format is appended to the end of the translated KB);

6) click "Execute" (takes you to the "VampirePrime Reasoner" pane and the result is shown. If the query is successful, the proof procedure for each answer will be shown in the TPTP format).

3.1.1 TPTP Instantiation

The TPTP instantiation employs the popular TPTP format, supported by many first-order logic reasoners, as an target language. This PSOATransRun[PSOA2TPTP,VampirePrime] composes PSOA2TPTP and VampirePrime into a RESTful API.

3.1.1.1 PSOA2TPTP

PSOA2TPTP is our reference translator mapping knowledge bases and queries in the PSOA RuleML presentation syntax to TPTP. The translator, currently composed of a lexer, a parser, and tree walkers, is generated by the ANTLR v3 parser generator tool from the grammars we developed. Details can be found in the paper [3].

3.1.1.2 VampirePrime

VampirePrime is Alexandre Riazanov's first-order logic reasoner. Since VampirePrime is written in C++, linking some libraries that are not on current Linux distributions, a compiled version, called vkernel, had to be used. For maintenance and portability, once compatible versions of the C++ libraries are identified, the VampirePrime C++ sources from the Software by Alexandre Riazanov, "VampirePrime reasoner", need to be recompiled.

3.1.1.3 Implemented feature list and restrictions
  • Terms
    • Constants
      • Local constants: constant names that has only digits with a prefix '_', such as _1, _21, are disallowed since they are reserved for objectification
      • Integers
    • Variables: variable name ?obj is disallowed since it is reserved for objectification
    • Psoa terms: any form of psoa terms acting as atomic formulas are supported while psoa terms acting as function applications are not
      • Syntactic sugar supported: (1) omission of '[' and ']' for single tuple psoa terms; (2) omission of '(' and ')' for psoa term with only type information
      • Objectification for OID-less psoa terms are supported
  • Formulas
    • Conjunction
    • Existential quantification
    • Universal quantification

3.1.2 Prolog Instantiation

The Prolog instantiation employs the widely used logic programming language Prolog as the target language, supported by many engines. This PSOATransRun[PSOA2Prolog,XSBProlog] composes PSOA2Prolog and XSB Prolog.

Release: http://psoa.ruleml.org/transrun/0.7/local/

3.1.2.1 PSOA2Prolog

PSOA2Prolog is a translator mapping knowledge bases and queries in the PSOA RuleML presentation syntax to Prolog. The translator, currently composed of a lexer, a parser, and tree walkers, is generated by the ANTLR v3 parser generator tool from the grammars we developed. The tree walkers first normalize the input knowledge base or query within PSOA RuleML and then do a syntactic transformation from PSOA RuleML to Prolog.

3.1.2.2 XSB Prolog

XSB Prolog is a Prolog engine that allows tabling of facts to improve reasoning efficiency and avoid infinite loops of the traditional top-down Prolog execution model.

4 Test Cases

The following examples serve to test the PSOA2TPTP implementation, which is currently being finalized.

4.1 Single-tuple psoa term

  • Knowledge Base
Document(
  Group(
    _o1#_p(_a1 _a2)
  )
)
  • Queries
_o1#_p(?1 _a2)

4.2 Multi-slot psoa term

  • Knowledge Base
Document(
  Group(
    _o1#_p(_a->1 _b->2)
  )
)
  • Queries
_o1#_p(_a->1)
_o1#_p(?1->1)
_o1#_p(?2->?3)

4.3 Multi-valued Slot

  • Knowledge Base
Document(
  Group(
    _Adam#_Person(_father->_John)
    _Jack#_Person(_father->_John)
    _Tom#_Person(_father->_John)

    Forall ?Ch ?M
    (
       ?M#_Male(_child->?Ch) :- ?Ch#_Person(_father->?M)
    )
  )
)
  • Queries
_John#_Male(_child->?c1)
_John#_Male(_child->?c1 _child->?c2)
_John#_Male(_child->?c1 _child->?c2 _child->?c3)

4.4 Psoa terms with slots and tuples

  • Knowledge Base
Document(
  Group(
    _f1#_family(_John _Mary _child->_Tom)
    _f2#_family([_Tom _Jane] _income->100000)
    _f3#_family([_Mike _Jessie] [1951] _child->_Fred _child->_Jane)
    _Jane#_Person([_female] [_bcs _mcs _phd] _job->_engineer)
  )
)
  • Queries
_f1#Top(_John _Mary)
_f2#_family(?1->?2)
_f3#_family(_Mike _Jessie _child->?c)
_Jane#_Person([_bcs _mcs _phd] _job->_engineer)

4.5 Class Membership (TBD)

From http://www.w3.org/2005/rules/wiki/Class_Membership

  • Knowledge Base
Document(
  Prefix(fam <http://example.org/family#>)

  Group ( 
    Forall ?X ?Y ( 
      fam:isFatherOf(?Y ?X) :- And (fam:isChildOf(?X ?Y) ?Y#fam:Male  )
    )

    fam:isChildOf(fam:Adrian fam:Uwe)
    fam:Adrian#fam:Male
    fam:Uwe#fam:Male 
  )
)
  • Queries
fam:isFatherOf(fam:Uwe fam:Adrian)

4.6 Family (TBD)

  • Knowledge Base (Non-objectified version)
Document(
  Group(
    Forall ?Hu ?Wi ?Ch (
      _family(_husb->?Hu _wife->?Wi _child->?Ch) :-
        And(_married(?Hu ?Wi) _kid(?Hu ?Ch))
    )
    Forall ?Hu ?Wi ?Ch (
      _family(_husb->?Hu _wife->?Wi _child->?Ch) :-
        And(_married(?Hu ?Wi) _kid(?Wi ?Ch))
    )
    _married(_Joe _Sue)
    _kid(_Sue _Pete)
  )
)
  • Knowledge Base (Objectified version)
Document(
  Group(
    Forall ?Hu ?Wi ?Ch (
      Exists ?obj1 (?obj1#_family(_husb->?Hu _wife->?Wi _child->?Ch)) :-
        And(Exists ?obj2 (?obj2#_married(?Hu ?Wi))
            Exists ?obj2 (?obj2#_kid(?Hu ?Ch)) )
    )
    Forall ?Hu ?Wi ?Ch (
      Exists ?obj3 (?obj3#_family(_husb->?Hu _wife->?Wi _child->?Ch)) :-
        And(Exists ?obj4 (?obj4#_married(?Hu ?Wi))
            Exists ?obj5 (?obj5#_kid(?Wi ?Ch)) )
    )
    _1#_married(_Joe _Sue)
    _2#_kid(_Sue _Pete)
  )
)
  • Queries
_married(_Joe _Sue)
_family(_husb->_Joe _wife->_Sue _child->?Ch)

4.7 Family (Variation)

  • Knowledge Base (Non-objectified version)
Document(
  Group (
    Forall ?Hu ?Wi (
      _family(_husb->?Hu _wife->?Wi) :-
              _married(?Hu ?Wi)
    )
    Forall ?Hu ?Ch ?o (
      ?o#_family(_child->?Ch) :-
        And(?o#_family(_husb->?Hu)
            _kid(?Hu ?Ch))
    )
    Forall ?Wi ?Ch ?o (
      ?o#_family(_child->?Ch) :-
        And(?o#_family(_wife->?Wi)
            _kid(?Wi ?Ch))
    )
    _married(_Joe _Sue)
    _kid(_Sue _Pete)
    _kid(_Joe _Tom)
  )
)
  • Knowledge Base (Objectified version)
Document(
  Group(
    Forall ?Hu ?Wi (
      Exists ?obj1 (?obj1#_family(_husb->?Hu _wife->?Wi)) :-
             Exists ?obj2 (?obj2#_married(?Hu ?Wi))
    )
    Forall ?Hu ?Wi ?Ch ?o (
      ?o#_family(_child->?Ch) :-
        And(?o#_family(_husb->?Hu _wife->?Wi)
            Exists ?obj3 (?obj3#_kid(?Hu ?Ch)) )
    )
    Forall ?Hu ?Wi ?Ch ?o (
      ?o#_family(_child->?Ch) :-
        And(?o#_family(_husb->?Hu _wife->?Wi)
            Exists ?obj4 (?obj4#_kid(?Wi ?Ch)) )
    )
    _m1#_married(_Joe _Sue)
    _k1#_kid(_Sue _Pete)
    _k2#_kid(_Joe _Tom)
  )
)
  • Queries
?1#_family(?p->?v)
?1#_family(_husb->_Joe _child->?Ch)
?1#_family(_husb->?Hu _wife->?Wi _child->?Ch)
And(?1#_family(_husb->_Joe _wife->_Sue _child->?Who) _kid(_Sue ?Who))

4.8 Rule Test - Psoa Terms

  • Knowledge Base
Document(
  Group(
    Forall ?X ?Y ?1 (
      ?1#_R4(?X ?Y) :- ?1#_R3(?X ?Y _p2->_v2)
    )
    Forall ?X ?Y ?1 (
      ?1#_R3(?X ?Y) :- And (?X#_C2(_p3->_v3) ?1#_R2(?X ?Y))
    )
    Forall ?1 ?X ?Y (
      ?1#_R2(?X ?Y _p1->_v1 _p2->_v2) :- ?1#_R1(?X ?Y)
    )
    Forall ?1 (
      ?1#_C2() :- ?1#_C1()
    )

    _a1#_C1()
    _o1#_R1(_a1 _b1)
    _a2#_C1(_p3->_v3 _p4->_v4)
    _o2#_R1(_a2 _b2)
    _a3#_C1()
    _o3#_R1(_a3 _b3 _c3)
  )
)
  • Queries
_a1#_C2()
_o1#_R1(_p1->_v1)
_o2#_R3(_a2 _b2)
_o2#_R4(_a2 _b2 _p1->_v1 _p2->_v2)
?1#_R3(_a2 ?Y)
?2#_R4(?X ?Y)
_o2#_R1(_a2 _b2 ?p->?v)
?3#_R4(?X ?Y ?p->?v)
_o2#?r(_a2 _b2)
  • Negative Queries
_o3#_R1(_p1->_v1)

4.9 Rule Test - Psoa Facts

  • Knowledge Base
Document(
  Group(
    _a#_C(_o _b _p3->_v3) :- _o#_R4(_a _b)
    _o#_R4(_a _b) :- _o#_R3(_a _b _p1->_v1)
    Forall ?X ?1 (
      ?1#Top(_p1->_v1) :- And(?1#_R3(?X _b) ?1#_R2())
    )
    _o#_R3() :- And(_o#_R2() _o#_R1(_p2->_v2))

    _o#_R2(_a _b _p2->_v2)
    _o#_R1()
  )
)
  • Queries
_a#_C(_o _b)
_o#?r(_a _b)
_o#Top(?p->?v)

4.10 Entail Everything (TBD)

From http://www.w3.org/2005/rules/wiki/EntailEverything

  • Knowledge Base
Document(
  Prefix(ex <http://example.org/example#>)  
  Group(
    Forall ?x ( ex:A(?x) )
  ) 
)
  • Queries
And(
  ex:A(2)
  ex:A("any string")
  ex:A(<http://some.example.org>)
)

4.11 Multiple Entailment

  • Knowledge Base
Document(
  Group(
    Forall ?x (_o1#_p(_a ?x))
    Forall ?x (_o1#_p(?x _b))
  )
)
  • Queries
_o1#_p(_a _b)
_o1#_p(?1 ?2)

4.12 Arbitrary Entailment (TBD)

From http://www.w3.org/2005/rules/wiki/Arbitrary_Entailment

  • Knowledge Base
Document(
  Group(
    "a" = "b"
  )
)
  • Queries
<http://example.org/#p>(<http://example.org/#e>)

4.13 Objectification

  • Knowledge Base
Document(
  Group(
    Forall ?x ?y (
      _g(?y ?x) :- _f(?x ?y)
    )
    _f(_a _b)
  )
)
  • Queries
_g(_b _a)
And (_f(_a _b) _g(_b _a))
  • Translated TPTP document for the second query
fof(ax01,axiom,(
   ! [Qy,Qx] : 
     ( ? [Qobj] : 
         ( member(Qobj,lf)
         & tupterm(Qobj,Qx,Qy) )
    => ? [Qobj] : 
         ( member(Qobj,lg)
         & tupterm(Qobj,Qy,Qx) ) ) )).
fof(ax02,axiom,
   ( member(l1,lf)
   & tupterm(l1,la,lb) )).
fof(query,theorem,
   ( ( ? [Qobj] : 
         ( member(Qobj,lf)
         & tupterm(Qobj,la,lb) )
     & ? [Qobj] : 
         ( member(Qobj,lg)
         & tupterm(Qobj,lb,la) ) )
   => ans )).
  • Post-edited TPTP for VP
fof(ax01,axiom,(
   ! [Qy,Qx] : 
     ( ? [Qobj] : 
         ( member(Qobj,lf)
         & tupterm(Qobj,Qx,Qy) )
    => ? [Qobj] : 
         ( member(Qobj,lg)
         & tupterm(Qobj,Qy,Qx) ) ) )).
fof(ax02,axiom,
   ( member(l1,lf)
   & tupterm(l1,la,lb) )).
fof(query,theorem,
   ( ( ? [Qobj1] : 
         ( member(Qobj1,lf)
         & tupterm(Qobj1,la,lb) )
     & ? [Qobj2] : 
         ( member(Qobj2,lg)
         & tupterm(Qobj2,lb,la) ) )
   => ans )).

4.14 Recursion

  • Knowledge Base
Document(
  Group(
    Forall ?anc ?par ?des (
      _isDescendentOf(?des ?anc) :- And (_isChildOf(?des ?par) _isDescendentOf(?par ?anc))
    )
    Forall ?par ?ch (
      _isDescendentOf(?ch ?par) :- _isChildOf(?ch ?par)
    )
    _isChildOf(_Pete _Sue)
    _isChildOf(_Sue _John)
    _isChildOf(_John _Tom)
    _Pete#_Person(_sex->_Male _age->24)
    _Sue#_Person(_sex->_Female _age->47)
    _John#_Person(_sex->_Male _age->77)
  )
)
  • Queries
_isDescendentOf(_Sue _Tom)
And(_isDescendentOf(?Who _Tom) ?Who#_Person(_sex->_Male _age->?Age))

4.15 Inheritance

  • Knowledge Base
Document(
  Group(
    _o1#_c1(_a1 _a2)
    _o2#_c1(_p->_v)
    _c1##_c2
  )
)
  • Queries
_o1#_c2(_a1 _a2)
_o2#_c2(_p->_v)
?1#_c2(_a1 ?3)
?1#_c2(_p->?2)

4.16 Subclass

  • Knowledge Base
Document(
  Group(
    _o1#_c1(_p->_v1)
    _o2#_c3(_p->_v2)
    _o3#_c5(_p->_v3 _q->_w0)
    _c1##_c2
    _c1##_c3
    _c2##_c4
    _c3##_c4
    _c4##_c6
    _c5##_c6
  )
)
  • Queries
_o1#?c
?o#_c4
?o#_c6(_p->?v)
?o#_c6(_p->?v _q->?w)

4.17 Constant and String Equality (TBD)

  • Knowledge Base
Document(
  Group(
    _a = _b
    _b = "c"
  )
)
  • Queries
_a = "c"

4.18 Factorial 1

  • Knowledge Base
Document(
  Group(
    Forall ?x ?y ?fx ?fy (
      _factorial(?y ?fy) :- 
         And(_factorial(?x ?fx) _multiply(?fx ?y ?fy) _sum(?x 1 ?y))
    )
    _factorial(0 1)
    _sum(0 1 1)
    _multiply(1 1 1)
    _sum(1 1 2)
    _multiply(1 2 2)
    _sum(2 1 3)
    _multiply(2 3 6)
    _sum(3 1 4)
    _multiply(6 4 24)
  )
)
  • Queries
_factorial(4 24)
_factorial(?x ?fx)

4.19 Factorial 2

  • Knowledge Base
Document(
  Group(
    Forall ?x ?y ?fx ?fy (
      _eq(?fy _factorial(?y)) :- 
         And(_eq(?fx _factorial(?x)) _eq(?fy _multiply(?fx ?y)) _eq(?y _sum(?x 1)))
    )
    _eq(1 _factorial(0))
    _eq(1 _sum(0 1))
    _eq(1 _multiply(1 1))
    _eq(2 _sum(1 1))
    _eq(2 _multiply(1 2))
    _eq(3 _sum(2 1))
    _eq(6 _multiply(2 3))
    _eq(4 _sum(3 1))
    _eq(24 _multiply(6 4))
  )
)
  • Queries
_eq(24 _factorial(4))
_eq(?fx _factorial(?x))

4.20 Factorial 3

  • Knowledge Base
Document(
  Group(
    _factorial(0 1)
    Forall ?N ?F ?N1 ?F1 (
      _factorial(?N ?F) :-  
         And(External(pred:numeric-greater-than(?N 0)) 
             ?N1 = External(func:numeric-subtract(?N 1)) 
             _factorial(?N1 ?F1) 
             ?F = External(func:numeric-multiply(?N ?F1)) )
    )
  )
)
  • Queries
_factorial(5 120)
_factorial(5 ?X)

4.21 Function 1

  • Knowledge Base
Document(
  Group(
    Forall ?x ( _eq(_f(?x) ?x))
  )
)
  • Queries
_eq(_f(2) 2)
_eq(_f(_a) _a)
_eq(_f(_g(_b)) _g(_b))

4.22 Concatenation

  • Knowledge Base
Document(
  Group(
    Forall ?first ?rest ?x ?y (
      _concat(_cns(?first ?rest) ?x _cns(?first ?y)) :- _concat(?rest ?x ?y)
    )
    Forall ?x ( _concat(_nil ?x ?x) )
  )
)
  • Queries
_concat(_cns(1 _cns(3 _nil)) _cns(1 _nil) ?x)
_concat(_cns(1 _cns(3 _nil)) ?x _cns(1 _cns(3 _cns(2 _nil))))

4.23 Addition and Multiplication (TBD)

  • Knowledge Base
Document(
  Group(
    Forall ?x ?y ( 
      _sum(_suc(?x) ?y) = _suc(_sum(?x ?y))
    )
    Forall ?x ( ?x = _sum(0 ?x) )
    Forall ?x ?y (
      _multiply(_suc(?x) ?y) = _sum(?x _multiply(?x ?y))
    )
    Forall ?x ( 0 = _multiply(0 ?x) )
  )
)
  • Queries

4.24 Music Album

  • Knowledge Base

A fragment of http://www.cs.unb.ca/~boley/papers/MusicAlbumKB.txt (Executable http://www.cs.unb.ca/~boley/papers/MusicAlbumKB.psoa)

Document(
  Group(
    :o1#:albsplitObj( :artist->"Van Morrison"   :title->"Astral Weeks"              :favorite->"Madame George"     )
    :o2#:albsplitObj( :artist->"Beatles"        :title->"Sgt. Pepper's"             :favorite->"A Day in the Life" )
    :o3#:albsplitObj( :artist->"Beatles"        :title->"Abbey Road"                :favorite->"Something"         )
    :o4#:albsplitObj( :artist->"Rolling Stones" :title->"Sticky Fingers"            :favorite->"Brown Sugar"       )
    :o5#:albmergeObj( :artist->"Eagles"                :tivorite->"Hotel California"                               )
    :o6#:albmergeObj( :artist->"Elton John"            :tivorite->"Goodbye Yellow Brick Road"                      )
    :albmergeObj##:albsplitObj
    Forall ?OID ?Tivorite
    (
      ?OID#:albsplitObj(:title->?Tivorite :favorite->?Tivorite)  :-  ?OID#:albmergeObj(:tivorite->?Tivorite)
    )
  )
)
  • Queries
?OID#:albsplitObj(:artist->?Artist :title->?Title)
?OID#:albsplitObj(:title->?Title :artist->?Artist)
?OID#:albsplitObj(:favorite->?Favorite )
?OID#:albsplitObj(:artist->?Artist :title->?Title :favorite->?Favorite )
?OID#:albmergeObj(:artist->"Elton John" :favorite->?Favorite )
:o6#:albsplitObj(:artist->"Elton John" :favorite->?Favorite)

4.25 Slotribution

  • Knowledge Base
Document(
  Group(
    Forall ?X ( ?X#_block(_color->_blue _size->_big) )
    _b1#_book
    _b2#_book(_title->"Java Programming")
    _o#_albmergeObj( _artist->"Elton John" _tivorite->"Goodbye Yellow Brick Road" )
    Forall ?OID ?Tivorite
    (
      ?OID#_albsplitObj(_title->?Tivorite _favorite->?Tivorite) :- ?OID#_albmergeObj(_tivorite->?Tivorite)
    )
  )
)
  • Queries
_a#_block(_color->_blue)
_b1#_block(_color->_blue)
?B#_book(_title->?T)

4.26 Slotribution 2

  • Knowledge Base
Document(
  Group(
    Forall ?C ?X (
      ?C#:Country(_capital->?X) :-
                  :geo-in(:government(?C) ?X)
    )

    Forall ?S ?X ?F ?V (
      ?S#:Startup(_capital->?X) :-
                  And(:founder-capital(?S ?F)
                      :venture-capital(?S ?V)
                      ?X = External(func:numeric-add(?F ?V)))
    )
    
    :geo-in(:government(:Canada) :Ottawa)
    :founder-capital("XYZ Inc." 100000)
    :venture-capital("XYZ Inc." 200000)
  )
)
  • Queries
?C#:Country(_capital->?X)
?S#:Startup(_capital->?X)

4.27 Mixed Use of Psoa terms with and without OID

  • Knowledge Base
Document(
  Group (
    Forall ?X ?Y ( 
      :isFatherOf(?Y ?X) :- And ( :isChildOf(?X ?Y) ?Y#:Male )
    )

    :c1#:isChildOf(:Adrian :Uwe)
    :Adrian#:Male
    :Uwe#:Male

    Forall ?X ?Y ?C ( 
      :isMotherOf(?Y ?X) :- And ( ?C#:isChildOf(?X ?Y) ?Y#:Female )
    )
    :isChildOf(:Adrian :Emily)
    :Jane#:Female
  )
)


  • Queries
:isFatherOf(?Y ?X)
:isMotherOf(?Y ?X)

4.28 Subclass Axiomization

  • Knowledge Base
Document (
  Group (
    Forall ?X
    (
      ?X#:c1 :- ?X#:c2
    )
    Forall ?X
    (
      ?X#:c1(:p1->:v1) :- ?X#:c2(:p2->:v1)
    )
    :o1#:c2
    :o2#:c2(:p2->:v1)

    Forall ?X
    (
      ?X#:c1 :- ?X#:c3
    )
    Forall ?X
    (
      ?X#Top(:p1->:v1) :- ?X#:c3(:p2->:v1)
    )
    :o3#:c3(:p2->:v1)
  )
)
  • Queries
:o1#:c1
:o2#:c1
:o1#:c1(:p1->:v1)
:o2#:c1(:p1->:v1)
:o3#:c1(:p1->:v1)

5 Use Case

We are developing a use case, Geospatial Rules, with rules for enhancing geospatial data in a geographic information system (GIS) or a GIS combination.

6 Changes

  • PSOA2TPTP
    • Change translation of o#f() from member(o,f) to memterm(o,f), employed by both PSOA2Prolog and PSOA2TPTP, because member is a built-in predicate in some Prolog engines, e.g. SWI Prolog

7 PSOA RuleML vs. RIF RuleML

Comparison of Syntax and Semantics between PSOA RuleML and RIF RuleML
PSOA KB RIF KB Notes
Document(
  Group(
    _Tim#Top(_job->_engineer)
  )
)
Document(
  Group(
    _Tim[_job->_engineer]
  )
)
Document(
  Group(
    _1#_married(_Joe _Sue)
  )
)
Document(
  Group(
    _married(_Joe _Sue)
  )
)
Document(
  Group(
    _Joe#_male()
  )
)
Document(
  Group(
    _Joe#_male
  )
)
Document(
  Group(
    _Tim#_person(_job->engineer _child->_jack)
  )
)

Document(
  Group(
    _Tim[_job->engineer _child->_jack]
    _Tim#_person
  )
)
Document(
  Group(
    _1#_larger(_first->2 _last->1)
  )
)
Document(
  Group(
    _larger(_first->2 _last->1)
  )
)

8 References

1. Harold Boley, A RIF-Style Semantics for RuleML-Integrated Positional-Slotted, Object-Applicative Rules. In Nick Bassiliades, Guido Governatori, and Adrian Paschke, editors, RuleML Europe, volume 6826 of LNCS, pages 194–211. Springer, 2011. Preprint: http://www.cs.unb.ca/~boley/papers/SemanticsPsoaRules.pdf. Slides for IJCAI 2011 Best Papers from Sister Conferences Track: http://www.cs.unb.ca/~boley/talks/SemanticsPsoaRules-talk-IJCAI2011.pdf. Slides with maximum details from paper: http://www.cs.unb.ca/~boley/talks/SemanticsPsoaRules-talk-UNB2011.pdf

2. Zou, G., Peter-Paul, R., Boley, H., Riazanov, A.: PSOA2TPTP: A Reference Translator for Interoperating PSOA RuleML with TPTP Reasoners. In: Bikakis, A., Giurca, A. (eds.) RuleML 2012. LNCS, vol. 7438, pp. 264–279. Springer, Heidelberg (2012). Preprint: http://www.cs.unb.ca/~boley/papers/DirectPSOA2TPTP.pdf. Slides: http://www.cs.unb.ca/~boley/talks/DirectPSOA2TPTP-talk.pdf

3. Zou, G., Peter-Paul, R., Boley, H., Riazanov, A.: PSOATransRun: Translating and Running PSOA RuleML via the TPTP Interchange Language for Theorem Provers. 6th International Rule Challenge, RuleML 2012. Preprint: http://www.cs.unb.ca/~boley/papers/PSOATransRun.pdf. Slides for Invited Demo: http://www.cs.unb.ca/~boley/talks/PSOATransRun-talk.pdf

4. Al Manir, M.S., Riazanov, A., Boley, H., Baker, C.J.O.: PSOA RuleML API: A Tool for Processing Abstract and Concrete Syntaxes. In: Bikakis, A., Giurca, A. (eds.) RuleML 2012. LNCS, vol. 7438, pp. 280–288. Springer, Heidelberg (2012). Preprint: http://www.cs.unb.ca/~boley/papers/PSOA_RuleML_API.pdf. Slides: http://www.cs.unb.ca/~boley/talks/PSOA_RuleML_API-talk.pdf

5. Zou, G., Boley, H.: A Translator Framework for the Interoperation of Graph plus Relational Data and Rules on the Web. 5th Atlantic Workshop on Semantics and Services, February 2014, Slides: http://www.cs.unb.ca/~boley/talks/InteropGraphRel-AWoSS2014-talk.pdf

6. Boley, H.: A Music Album Knowledge Base in the Relational and Object-Centered Paradigms of the PSOA RuleML Language. RuleML Report, 19 September 2014, http://www.cs.unb.ca/~boley/papers/MusicAlbumKB.txt