eyelang 1.7.0 → 1.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/guide.md +1 -1
- package/examples/output/web-names.eye +3 -10
- package/examples/web-names.eye +20 -64
- package/package.json +1 -1
package/docs/guide.md
CHANGED
|
@@ -458,7 +458,7 @@ Use `holds/2` when you want to match the member term directly, for example `name
|
|
|
458
458
|
| [`turing.eye`](../examples/turing.eye) | Simulates a binary-increment Turing machine. | [`output/turing.eye`](../examples/output/turing.eye) |
|
|
459
459
|
| [`vector-similarity.eye`](../examples/vector-similarity.eye) | Computes dot product, norm, and cosine similarity. | [`output/vector-similarity.eye`](../examples/output/vector-similarity.eye) |
|
|
460
460
|
| [`vulnerability-impact.eye`](../examples/vulnerability-impact.eye) | Analyzes vulnerable transitive dependencies and urgent patch impact. | [`output/vulnerability-impact.eye`](../examples/output/vulnerability-impact.eye) |
|
|
461
|
-
| [`web-names.eye`](../examples/web-names.eye) | Uses
|
|
461
|
+
| [`web-names.eye`](../examples/web-names.eye) | Uses angle-bracket IRI atoms as first-class web names and joins them across a tiny graph. | [`output/web-names.eye`](../examples/output/web-names.eye) |
|
|
462
462
|
| [`weighted-interval-scheduling.eye`](../examples/weighted-interval-scheduling.eye) | Selects the best non-overlapping weighted intervals with tabled dynamic programming. | [`output/weighted-interval-scheduling.eye`](../examples/output/weighted-interval-scheduling.eye) |
|
|
463
463
|
| [`witch.eye`](../examples/witch.eye) | Derives the classic “burn the witch” rule chain. | [`output/witch.eye`](../examples/output/witch.eye) |
|
|
464
464
|
| [`wolf-goat-cabbage.eye`](../examples/wolf-goat-cabbage.eye) | Solves the wolf-goat-cabbage river crossing. | [`output/wolf-goat-cabbage.eye`](../examples/output/wolf-goat-cabbage.eye) |
|
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
web_uri(web('be.ugent', ugent), "https://data.ugent.be/id/ugent").
|
|
5
|
-
web_uri(web('eyereasoner.github', eyelang), "https://github.com/eyereasoner/eyelang").
|
|
6
|
-
web_uri(web('org.schema', maintainer), "https://schema.org/maintainer").
|
|
7
|
-
affiliated_with(web('be.ugent', josd), web('be.ugent', idlab)).
|
|
8
|
-
affiliated_with(web('be.ugent', josd), web('be.ugent', ugent)).
|
|
9
|
-
project_contact(web('eyereasoner.github', eyelang), web('be.ugent', josd), "josderoo@gmail.com").
|
|
10
|
-
same_local_name(web('be.ugent', josd), web('com.example', josd), josd).
|
|
1
|
+
affiliated_with(<https://data.ugent.be/id/josd>, <https://data.ugent.be/id/idlab>).
|
|
2
|
+
affiliated_with(<https://data.ugent.be/id/josd>, <https://data.ugent.be/id/ugent>).
|
|
3
|
+
project_contact(<https://github.com/eyereasoner/eyelang>, <https://data.ugent.be/id/josd>, "josderoo@gmail.com").
|
package/examples/web-names.eye
CHANGED
|
@@ -1,83 +1,39 @@
|
|
|
1
|
-
%
|
|
1
|
+
% Web names as first-class Eyelang atoms.
|
|
2
2
|
%
|
|
3
|
-
%
|
|
4
|
-
%
|
|
5
|
-
%
|
|
6
|
-
% ISO-compatible quoted atom naming a vocabulary, organization, or authority;
|
|
7
|
-
% the second argument is the local name inside that space.
|
|
8
|
-
%
|
|
9
|
-
% The important property is that the complete term is self-contained. The local
|
|
10
|
-
% name josd can safely occur in two spaces: web('be.ugent', josd) and
|
|
11
|
-
% web('com.example', josd) are different Herbrand terms, so there is no hidden
|
|
12
|
-
% prefix context and no accidental collision. Tooling can still expand selected
|
|
13
|
-
% web/2 terms to full URI strings when a base is known.
|
|
3
|
+
% Angle-bracket IRI atoms are ordinary atoms with globally meaningful names.
|
|
4
|
+
% They are self-contained, require no prefix declarations, and can be joined
|
|
5
|
+
% directly across rules just like any other atom.
|
|
14
6
|
|
|
15
|
-
materialize(web_uri, 2).
|
|
16
7
|
materialize(affiliated_with, 2).
|
|
17
8
|
materialize(project_contact, 3).
|
|
18
|
-
materialize(same_local_name, 3).
|
|
19
|
-
|
|
20
|
-
% Optional URI bases for spaces that we want to publish or display.
|
|
21
|
-
space_base('be.ugent', "https://data.ugent.be/id/").
|
|
22
|
-
space_base('com.example', "https://example.com/id/").
|
|
23
|
-
space_base('eyereasoner.github', "https://github.com/eyereasoner/").
|
|
24
|
-
space_base('org.schema', "https://schema.org/").
|
|
25
|
-
|
|
26
|
-
% A tiny graph using globally scoped web terms as ordinary eyelang terms.
|
|
27
|
-
triple(web('be.ugent', josd), web('org.schema', name), "Jos De Roo").
|
|
28
|
-
triple(web('be.ugent', josd), web('org.schema', email), "josderoo@gmail.com").
|
|
29
|
-
triple(web('be.ugent', josd), web('org.schema', affiliation), web('be.ugent', idlab)).
|
|
30
|
-
triple(web('be.ugent', idlab), web('org.schema', parentOrganization), web('be.ugent', ugent)).
|
|
31
9
|
|
|
32
|
-
|
|
33
|
-
triple(web('eyereasoner.github', eyelang), web('org.schema', codeRepository), "https://github.com/eyereasoner/eyelang").
|
|
34
|
-
triple(web('eyereasoner.github', eyelang), web('org.schema', maintainer), web('be.ugent', josd)).
|
|
10
|
+
table(parent_organization, 2).
|
|
35
11
|
|
|
36
|
-
%
|
|
37
|
-
triple(
|
|
12
|
+
% A tiny graph using absolute IRI atoms directly.
|
|
13
|
+
triple(<https://data.ugent.be/id/josd>, <https://schema.org/name>, "Jos De Roo").
|
|
14
|
+
triple(<https://data.ugent.be/id/josd>, <https://schema.org/email>, "josderoo@gmail.com").
|
|
15
|
+
triple(<https://data.ugent.be/id/josd>, <https://schema.org/affiliation>, <https://data.ugent.be/id/idlab>).
|
|
16
|
+
triple(<https://data.ugent.be/id/idlab>, <https://schema.org/parentOrganization>, <https://data.ugent.be/id/ugent>).
|
|
38
17
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
published_name(web('com.example', josd)).
|
|
43
|
-
published_name(web('be.ugent', idlab)).
|
|
44
|
-
published_name(web('be.ugent', ugent)).
|
|
45
|
-
published_name(web('eyereasoner.github', eyelang)).
|
|
46
|
-
published_name(web('org.schema', maintainer)).
|
|
47
|
-
|
|
48
|
-
web_uri(web(?space, ?local), ?uri) :-
|
|
49
|
-
published_name(web(?space, ?local)),
|
|
50
|
-
space_base(?space, ?base),
|
|
51
|
-
atom_string(?local, ?localtext),
|
|
52
|
-
str_concat(?base, ?localtext, ?uri).
|
|
18
|
+
triple(<https://github.com/eyereasoner/eyelang>, <https://schema.org/name>, "eyelang").
|
|
19
|
+
triple(<https://github.com/eyereasoner/eyelang>, <https://schema.org/codeRepository>, <https://github.com/eyereasoner/eyelang>).
|
|
20
|
+
triple(<https://github.com/eyereasoner/eyelang>, <https://schema.org/maintainer>, <https://data.ugent.be/id/josd>).
|
|
53
21
|
|
|
54
22
|
% Organization membership follows parentOrganization links transitively.
|
|
55
23
|
parent_organization(?unit, ?org) :-
|
|
56
|
-
triple(?unit,
|
|
24
|
+
triple(?unit, <https://schema.org/parentOrganization>, ?org).
|
|
57
25
|
parent_organization(?unit, ?org) :-
|
|
58
|
-
triple(?unit,
|
|
26
|
+
triple(?unit, <https://schema.org/parentOrganization>, ?mid),
|
|
59
27
|
parent_organization(?mid, ?org).
|
|
60
28
|
|
|
61
29
|
affiliated_with(?person, ?org) :-
|
|
62
|
-
triple(?person,
|
|
30
|
+
triple(?person, <https://schema.org/affiliation>, ?org).
|
|
63
31
|
affiliated_with(?person, ?org) :-
|
|
64
|
-
triple(?person,
|
|
32
|
+
triple(?person, <https://schema.org/affiliation>, ?unit),
|
|
65
33
|
parent_organization(?unit, ?org).
|
|
66
34
|
|
|
67
35
|
% A project contact is derived by joining the project's maintainer with the
|
|
68
|
-
% maintainer's email. The join works because both facts use the same
|
|
69
|
-
% web('be.ugent', josd) term.
|
|
36
|
+
% maintainer's email. The join works because both facts use the same IRI atom.
|
|
70
37
|
project_contact(?project, ?person, ?email) :-
|
|
71
|
-
triple(?project,
|
|
72
|
-
triple(?person,
|
|
73
|
-
|
|
74
|
-
% Demonstrate that local names are not global names. This reports the deliberate
|
|
75
|
-
% local-name collision without treating the two people as equal.
|
|
76
|
-
local_name(?entity, ?local) :-
|
|
77
|
-
triple(?entity, web('org.schema', name), ?_),
|
|
78
|
-
eq(?entity, web(?_, ?local)).
|
|
79
|
-
|
|
80
|
-
same_local_name(?a, ?b, ?local) :-
|
|
81
|
-
local_name(?a, ?local),
|
|
82
|
-
local_name(?b, ?local),
|
|
83
|
-
lt(?a, ?b).
|
|
38
|
+
triple(?project, <https://schema.org/maintainer>, ?person),
|
|
39
|
+
triple(?person, <https://schema.org/email>, ?email).
|