eyeling 1.8.9 → 1.8.11
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/examples/bind.n3 +7 -0
- package/examples/family.n3 +10 -0
- package/examples/filter.n3 +8 -0
- package/examples/input/bind.srl +12 -0
- package/examples/input/family.srl +12 -0
- package/examples/input/filter.srl +9 -0
- package/examples/input/snaf.srl +6 -0
- package/examples/output/bind.n3 +3 -0
- package/examples/output/family.n3 +13 -0
- package/examples/output/filter.n3 +3 -0
- package/package.json +4 -5
- package/test/{n3.test.js → maken3.test.js} +6 -6
- package/n3.js +0 -2083
package/examples/bind.n3
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
@prefix : <http://example/#> .
|
|
2
|
+
@prefix log: <http://www.w3.org/2000/10/swap/log#> .
|
|
3
|
+
@prefix string: <http://www.w3.org/2000/10/swap/string#> .
|
|
4
|
+
|
|
5
|
+
:phayes a :Person ; :givenName "Pat"; :familyName "Hayes" .
|
|
6
|
+
|
|
7
|
+
{ ?x a :Person . ?SCOPE log:notIncludes { ?x :name ?someName . } . ?x :givenName ?name1 . ?x :familyName ?name2 . (?name1 " " ?name2) string:concatenation ?FN . } => { ?x :name ?FN } .
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
@prefix : <http://example.org/#> .
|
|
2
|
+
|
|
3
|
+
:A :fatherOf :X . :B :motherOf :X . :C :motherOf :A .
|
|
4
|
+
|
|
5
|
+
{ ?y :fatherOf ?x . } => { ?x :childOf ?y } .
|
|
6
|
+
{ ?y :motherOf ?x . } => { ?x :childOf ?y } .
|
|
7
|
+
{ ?x :childOf ?y . } => { ?x :descendedFrom ?y } .
|
|
8
|
+
{ ?x :childOf ?z . ?z :childOf ?y . } => { ?x :descendedFrom ?y } .
|
|
9
|
+
{ ?y :descendedFrom ?x . } => { ?x :ancestorOf ?y } .
|
|
10
|
+
{ ?a :ancestorOf ?c . ?c :ancestorOf ?b . } => { ?a :ancestorOf ?b } .
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
@prefix : <http://example/#> .
|
|
2
|
+
@prefix math: <http://www.w3.org/2000/10/swap/math#> .
|
|
3
|
+
|
|
4
|
+
:x :p 1 ; :q 2 .
|
|
5
|
+
|
|
6
|
+
{ ?x :p ?v1 . ?x :q ?v2 . ?v1 math:greaterThan 0 . ?v2 math:greaterThan 0 . } => { ?x :bothPositive true . } .
|
|
7
|
+
{ ?x :p ?v1 . ?x :q ?v2 . ?v1 math:equalTo 0 . } => { ?x :oneIsZero true . } .
|
|
8
|
+
{ ?x :p ?v1 . ?x :q ?v2 . ?v2 math:equalTo 0 . } => { ?x :oneIsZero true . } .
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
PREFIX : <http://example/#>
|
|
2
|
+
|
|
3
|
+
DATA { :phayes a :Person ; :givenName "Pat"; :familyName "Hayes" . }
|
|
4
|
+
|
|
5
|
+
# Default value - calculate a name
|
|
6
|
+
RULE { ?x :name ?FN } WHERE {
|
|
7
|
+
?x a :Person
|
|
8
|
+
NOT { ?x :name ?someName }
|
|
9
|
+
?x :givenName ?name1 ;
|
|
10
|
+
:familyName ?name2 .
|
|
11
|
+
BIND(concat(?name1, " ", ?name2) AS ?FN)
|
|
12
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
PREFIX : <http://example.org/#>
|
|
2
|
+
|
|
3
|
+
DATA { :A :fatherOf :X . :B :motherOf :X . :C :motherOf :A . }
|
|
4
|
+
|
|
5
|
+
RULE { ?x :childOf ?y } WHERE { ?y :fatherOf ?x }
|
|
6
|
+
RULE { ?x :childOf ?y } WHERE { ?y :motherOf ?x }
|
|
7
|
+
|
|
8
|
+
RULE { ?x :descendedFrom ?y } WHERE { ?x :childOf ?y }
|
|
9
|
+
RULE { ?x :descendedFrom ?y } WHERE { ?x :childOf ?z . ?z :childOf ?y }
|
|
10
|
+
|
|
11
|
+
RULE { ?x :ancestorOf ?y } WHERE { ?y :descendedFrom ?x }
|
|
12
|
+
RULE { ?a :ancestorOf ?b } WHERE { ?a :ancestorOf ?c . ?c :ancestorOf ?b }
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
PREFIX : <http://example/#>
|
|
2
|
+
|
|
3
|
+
DATA { :x :p 1 ; :q 2 . }
|
|
4
|
+
|
|
5
|
+
RULE { ?x :bothPositive true . }
|
|
6
|
+
WHERE { ?x :p ?v1 FILTER ( ?v1 > 0 ) ?x :q ?v2 FILTER ( ?v2 > 0 ) }
|
|
7
|
+
|
|
8
|
+
RULE { ?x :oneIsZero true . }
|
|
9
|
+
WHERE { ?x :p ?v1 ; :q ?v2 FILTER ( ( ?v1 = 0 ) || ( ?v2 = 0 ) ) }
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
@prefix : <http://example.org/#> .
|
|
2
|
+
|
|
3
|
+
:X :childOf :A .
|
|
4
|
+
:X :childOf :B .
|
|
5
|
+
:A :childOf :C .
|
|
6
|
+
:X :descendedFrom :A .
|
|
7
|
+
:X :descendedFrom :B .
|
|
8
|
+
:A :descendedFrom :C .
|
|
9
|
+
:X :descendedFrom :C .
|
|
10
|
+
:A :ancestorOf :X .
|
|
11
|
+
:B :ancestorOf :X .
|
|
12
|
+
:C :ancestorOf :A .
|
|
13
|
+
:C :ancestorOf :X .
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eyeling",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.11",
|
|
4
4
|
"description": "A minimal Notation3 (N3) reasoner in JavaScript.",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"keywords": [
|
|
@@ -22,10 +22,9 @@
|
|
|
22
22
|
"index.js",
|
|
23
23
|
"index.d.ts",
|
|
24
24
|
"eyeling.js",
|
|
25
|
-
"
|
|
25
|
+
"eyeling-builtins.ttl",
|
|
26
26
|
"test",
|
|
27
27
|
"examples",
|
|
28
|
-
"eyeling-builtins.ttl",
|
|
29
28
|
"README.md",
|
|
30
29
|
"LICENSE.md"
|
|
31
30
|
],
|
|
@@ -35,10 +34,10 @@
|
|
|
35
34
|
"scripts": {
|
|
36
35
|
"test:packlist": "node test/packlist.test.js",
|
|
37
36
|
"test:api": "node test/api.test.js",
|
|
38
|
-
"test:
|
|
37
|
+
"test:maken3": "node test/maken3.test.js",
|
|
39
38
|
"test:examples": "node test/examples.test.js",
|
|
40
39
|
"test:package": "node test/package.test.js",
|
|
41
|
-
"test": "npm run test:packlist && npm run test:api && npm run test:
|
|
40
|
+
"test": "npm run test:packlist && npm run test:api && npm run test:maken3 && npm run test:examples",
|
|
42
41
|
"preversion": "npm test",
|
|
43
42
|
"postversion": "git push origin HEAD --follow-tags"
|
|
44
43
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
// Convert examples/input/*.{ttl,trig,srl} -> examples/*.n3 using
|
|
4
|
+
// Convert examples/input/*.{ttl,trig,srl} -> examples/*.n3 using maken3.js
|
|
5
5
|
// Designed to work both in a git checkout (maintainer mode) and in an npm-installed package.
|
|
6
6
|
//
|
|
7
7
|
// In git mode:
|
|
@@ -86,11 +86,11 @@ function showDiff({ IN_GIT, examplesDir, expectedPath, generatedPath, relExpecte
|
|
|
86
86
|
function main() {
|
|
87
87
|
const suiteStart = Date.now();
|
|
88
88
|
|
|
89
|
-
// test/
|
|
89
|
+
// test/maken3.test.js -> repo root is one level up
|
|
90
90
|
const root = path.resolve(__dirname, '..');
|
|
91
91
|
const examplesDir = path.join(root, 'examples');
|
|
92
92
|
const inputDir = path.join(examplesDir, 'input');
|
|
93
|
-
const
|
|
93
|
+
const makeN3JsPath = path.join(root, 'maken3.js');
|
|
94
94
|
const nodePath = process.execPath;
|
|
95
95
|
|
|
96
96
|
if (!fs.existsSync(examplesDir)) {
|
|
@@ -101,8 +101,8 @@ function main() {
|
|
|
101
101
|
fail(`Cannot find examples/input directory: ${inputDir}`);
|
|
102
102
|
process.exit(1);
|
|
103
103
|
}
|
|
104
|
-
if (!fs.existsSync(
|
|
105
|
-
fail(`Cannot find
|
|
104
|
+
if (!fs.existsSync(makeN3JsPath)) {
|
|
105
|
+
fail(`Cannot find maken3.js: ${makeN3JsPath}`);
|
|
106
106
|
process.exit(1);
|
|
107
107
|
}
|
|
108
108
|
|
|
@@ -152,7 +152,7 @@ function main() {
|
|
|
152
152
|
|
|
153
153
|
// Run converter (stdout -> file; stderr captured)
|
|
154
154
|
const outFd = fs.openSync(generatedPath, 'w');
|
|
155
|
-
const r = cp.spawnSync(nodePath, [
|
|
155
|
+
const r = cp.spawnSync(nodePath, [makeN3JsPath, inPath], {
|
|
156
156
|
cwd: root,
|
|
157
157
|
stdio: ['ignore', outFd, 'pipe'],
|
|
158
158
|
encoding: 'utf8',
|