Skip to content

Commit

Permalink
simplifying lingua by reusing log:implies
Browse files Browse the repository at this point in the history
  • Loading branch information
josd committed Apr 8, 2024
1 parent 3e50aa4 commit 6c7e948
Show file tree
Hide file tree
Showing 15 changed files with 44 additions and 31 deletions.
1 change: 1 addition & 0 deletions RELEASE
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
EYE release

v10.2.2 (2024-04-08) simplifying lingua by reusing log:implies
v10.2.1 (2024-04-08) simplifying lingua by reusing log:isImpliedBy and log:query
v10.2.0 (2024-04-08) simply adding the 3 former lingua: predicates to the log: namespace
v10.1.4 (2024-04-08) fixing log:shell with explicit catch(use_module(library(process)), _, true)
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
10.2.1
10.2.2
1 change: 0 additions & 1 deletion eye-builtins.n3
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ log:equalTo a e:Builtin.
log:forAllIn a e:Builtin.
log:hasPrefix a e:Builtin.
log:ifThenElseIn a e:Builtin.
log:implication a e:Builtin.
log:implies a e:Builtin.
log:imports a e:Builtin.
log:includes a e:Builtin.
Expand Down
14 changes: 10 additions & 4 deletions eye.pl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
:- catch(use_module(library(process)), _, true).
:- catch(use_module(library(http/http_open)), _, true).

version_info('EYE v10.2.1 (2024-04-08)').
version_info('EYE v10.2.2 (2024-04-08)').

license_info('MIT License

Expand Down Expand Up @@ -189,7 +189,6 @@
:- dynamic('<http://www.w3.org/2000/01/rdf-schema#subClassOf>'/2).
:- dynamic('<http://www.w3.org/2000/10/swap/log#callWithCleanup>'/2).
:- dynamic('<http://www.w3.org/2000/10/swap/log#collectAllIn>'/2).
:- dynamic('<http://www.w3.org/2000/10/swap/log#implication>'/2).
:- dynamic('<http://www.w3.org/2000/10/swap/log#implies>'/2).
:- dynamic('<http://www.w3.org/2000/10/swap/log#isImpliedBy>'/2).
:- dynamic('<http://www.w3.org/2000/10/swap/log#nand>'/2).
Expand Down Expand Up @@ -426,7 +425,7 @@
args(Args),

% lingua
( ( '<http://www.w3.org/2000/10/swap/log#implication>'(Subj, Obj)
( ( '<http://www.w3.org/2000/10/swap/log#implies>'(Subj, Obj)
; '<http://www.w3.org/2000/10/swap/log#isImpliedBy>'(Subj, Obj)
; '<http://www.w3.org/2000/10/swap/log#query>'(Subj, Obj)
),
Expand Down Expand Up @@ -469,6 +468,7 @@
P \= '<http://www.w3.org/1999/02/22-rdf-syntax-ns#value>',
X =.. [P, _, _],
call(X),
ground(X),
getterm(X, Y),
( Y = X
-> true
Expand All @@ -491,7 +491,8 @@

% create forward rules
assertz(implies((
'<http://www.w3.org/2000/10/swap/log#implication>'(A, B),
'<http://www.w3.org/2000/10/swap/log#implies>'(A, B),
ground([A, B]),
findvars([A, B], V, alpha),
list_to_set(V, U),
makevars([A, B, U], [Q, I, X], beta(U))
Expand Down Expand Up @@ -4459,6 +4460,7 @@
wt(X),
write('}').
wt2('<http://www.w3.org/2000/10/swap/log#implies>'(X, Y)) :-
\+flag(lingua),
( flag(nope)
-> U = X
; ( X = when(A, B)
Expand Down Expand Up @@ -4742,6 +4744,7 @@
write('a').
wp('<http://www.w3.org/2000/10/swap/log#implies>') :-
\+flag('no-qnames'),
\+flag(lingua),
!,
write('=>').
wp(':-') :-
Expand Down Expand Up @@ -5429,6 +5432,9 @@
!.
djiti_fact('<http://www.w3.org/2000/10/swap/log#implies>'(A, B), C) :-
nonvar(B),
( \+atomic(A)
; \+atomic(B)
),
( conj_list(B, D)
-> true
; D = B
Expand Down
Binary file modified eye.zip
Binary file not shown.
4 changes: 2 additions & 2 deletions reasoning/lingua/README
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Lingua

Lingua supports reasoning with forward rules described in RDF as

_:ng1 log:implication _:ng2.
_:ng1 log:implies _:ng2.

_:ng1 {
RDF triples
Expand All @@ -15,7 +15,7 @@ Lingua supports reasoning with forward rules described in RDF as
}


A forward rule with log:implication false is an inference fuse.
A forward rule with log:implies false is an inference fuse.

Lingua also supports reasoning with backward rules described in RDF as

Expand Down
10 changes: 5 additions & 5 deletions reasoning/lingua/complement.trig
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# _:s2 :p2 _:o2.
# _:s3 :p3 _:o3.
# }
_:bng_1 log:implication _:bng_2.
_:bng_1 log:implies _:bng_2.

_:bng_1 {
_:s1 :p1 _:o1.
Expand All @@ -30,7 +30,7 @@ _:bng_2 {
_:s3 :c3 _:o3.
}

_:bng_3 log:implication _:bng_4.
_:bng_3 log:implies _:bng_4.

_:bng_3 {
_:s2 :p2 _:o2.
Expand All @@ -42,7 +42,7 @@ _:bng_4 {
_:s1 :c1 _:o1.
}

_:bng_5 log:implication _:bng_6.
_:bng_5 log:implies _:bng_6.

_:bng_5 {
_:s3 :p3 _:o3.
Expand All @@ -60,7 +60,7 @@ _:bng_6 {
# _:s3 :p3 _:o3.

# fuse
_:bng_7 log:implication false.
_:bng_7 log:implies false.

_:bng_7 {
var:P log:complement var:C.
Expand All @@ -72,5 +72,5 @@ _:bng_7 {
_:bng_8 log:query _:bng_8.

_:bng_8 {
_:bng_7 log:implication false.
_:bng_7 log:implies false.
}
4 changes: 2 additions & 2 deletions reasoning/lingua/derived.trig
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
:Minka a :Cat.
:Charly a :Dog.

_:bng_1 log:implication _:bng_2.
_:bng_1 log:implies _:bng_2.

_:bng_1 {
var:cat a :Cat.
}

_:bng_2 {
_:bng_3 log:implication _:bng_4.
_:bng_3 log:implies _:bng_4.
}

_:bng_3 {
Expand Down
2 changes: 1 addition & 1 deletion reasoning/lingua/edt.trig
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
@prefix edt: <http://eulersharp.sourceforge.net/2009/12dtb/test#>.

# importing
_:bng_1 log:implication true.
_:bng_1 log:implies true.

_:bng_1 {
<> log:imports <https://eyereasoner.github.io/eye/reasoning/edt/test-facts.ttl>.
Expand Down
4 changes: 2 additions & 2 deletions reasoning/lingua/graph.trig
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
:angers :oneway :nantes.

# oneway subproperty of path
_:bng_1 log:implication _:bng_2.
_:bng_1 log:implies _:bng_2.

_:bng_1 {
var:A :oneway var:B.
Expand All @@ -32,7 +32,7 @@ _:bng_2 {
}

# path transitive property
_:bng_3 log:implication _:bng_4.
_:bng_3 log:implies _:bng_4.

_:bng_3 {
var:A :path var:B.
Expand Down
2 changes: 1 addition & 1 deletion reasoning/lingua/monadic.trig
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
@prefix : <#>.

# importing
_:bng_1 log:implication true.
_:bng_1 log:implies true.

_:bng_1 {
<> log:imports <https://eyereasoner.github.io/eye/reasoning/bmt/1tt1.ttl>.
Expand Down
9 changes: 8 additions & 1 deletion reasoning/lingua/output/complement.trig
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
@prefix log: <http://www.w3.org/2000/10/swap/log#>.
@prefix var: <http://www.w3.org/2000/10/swap/var#>.

_:bng_1 log:implication false.
_:bng_1 log:implies false.
_:bng_2 log:implies false.

_:bng_1 {
log:complement log:complement log:complement.
log:complement log:complement log:complement.
log:complement log:complement log:complement.
}

_:bng_2 {
var:P log:complement var:C.
var:S var:P var:O.
var:S var:C var:O.
Expand Down
2 changes: 1 addition & 1 deletion reasoning/lingua/patch.trig
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
:pers002 :givenName "Claudia".

# patch rule
_:bng_1 log:implication true.
_:bng_1 log:implies true.

_:bng_1 {
var:person :familyName "Garcia".
Expand Down
18 changes: 9 additions & 9 deletions reasoning/lingua/restdesc.trig
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
:x :rel1 :y.

# RESTdesc
_:bng_1 log:implication _:bng_2.
_:bng_1 log:implies _:bng_2.

_:bng_1 {
var:a1 :rel1 var:b1.
Expand All @@ -29,7 +29,7 @@ _:bng_2{
var:a3 :rel2 var:b3.
}

_:bng_3 log:implication _:bng_4.
_:bng_3 log:implies _:bng_4.

_:bng_3 {
var:a1 :rel2 var:b1.
Expand All @@ -47,7 +47,7 @@ _:bng_4 {
var:a3 :rel3 var:b3.
}

_:bng_5 log:implication _:bng_6.
_:bng_5 log:implies _:bng_6.

_:bng_5 {
var:a1 :rel3 var:b1.
Expand All @@ -65,7 +65,7 @@ _:bng_6 {
var:a3 :rel4 var:b3.
}

_:bng_7 log:implication _:bng_8.
_:bng_7 log:implies _:bng_8.

_:bng_7 {
var:a1 :rel4 var:b1.
Expand All @@ -83,7 +83,7 @@ _:bng_8 {
var:a3 :rel5 var:b3.
}

_:bng_9 log:implication _:bng_10.
_:bng_9 log:implies _:bng_10.

_:bng_9 {
var:a1 :rel5 var:b1.
Expand All @@ -101,7 +101,7 @@ _:bng_10 {
var:a3 :rel6 var:b3.
}

_:bng_11 log:implication _:bng_12.
_:bng_11 log:implies _:bng_12.

_:bng_11 {
var:a1 :rel6 var:b1.
Expand All @@ -119,7 +119,7 @@ _:bng_12 {
var:a3 :rel7 var:b3.
}

_:bng_13 log:implication _:bng_14.
_:bng_13 log:implies _:bng_14.

_:bng_13 {
var:a1 :rel7 var:b1.
Expand All @@ -137,7 +137,7 @@ _:bng_14 {
var:a3 :rel8 var:b3.
}

_:bng_15 log:implication _:bng_16.
_:bng_15 log:implies _:bng_16.

_:bng_15 {
var:a1 :rel8 var:b1.
Expand All @@ -155,7 +155,7 @@ _:bng_16 {
var:a3 :rel9 var:b3.
}

_:bng_17 log:implication _:bng_18.
_:bng_17 log:implies _:bng_18.

_:bng_17 {
var:a1 :rel9 var:b1.
Expand Down
2 changes: 1 addition & 1 deletion reasoning/lingua/socrates.trig
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
:Human rdfs:subClassOf :Mortal.

# rdfs subclass
_:bng_1 log:implication _:bng_2.
_:bng_1 log:implies _:bng_2.

_:bng_1 {
var:A rdfs:subClassOf var:B.
Expand Down

0 comments on commit 6c7e948

Please sign in to comment.