Skip to content

Commit

Permalink
Adding readme and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
phochste committed Jun 16, 2023
1 parent d383021 commit 5d62d44
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 1 deletion.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
data/**.n3s
yarn-error.log
yarn.lock
node_modules/**
Expand Down
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# n32s

The n32s code is a precompiler from Notation3 to a N3S format that is used by Prolog reasoners such as [eye](https://github.com/eyereasoner/eye), [retina](https://github.com/eyereasoner/retina) and [Latar](https://github.com/MellonScholarlyCommunication/Latar)

## Installation

```
yarn install
```

## Usage

```
node js/index.js <n3-file>
```

## Example

```
$ cat demo.n3
@prefix : <urn:example.org:> .
@prefix log: <http://www.w3.org/2000/10/swap/log#> .
:Alice a :Person .
(_:X) log:onNegativeSurface {
_:X a :Person .
() log:onNegativeSurface {
_:X a :Human .
} .
} .
$ node js/index.js demo.n3
'<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>'('<urn:example.org:Alice>','<urn:example.org:Person>').
'<http://www.w3.org/2000/10/swap/log#onNegativeSurface>'(['_:X'],('<http://www.w3.org/2000/10/swap/log#onNegativeSurface>'([],('<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>'('_:X','<urn:example.org:Human>'))),'<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>'('_:X','<urn:example.org:Person>'))).
```
1 change: 1 addition & 0 deletions data/00-simple.n3-result
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
'<http://www.w3.org/2000/10/swap/log#onNegativeSurface>'(['_:x'],('<http://www.w3.org/2000/10/swap/log#onNegativeSurface>'([],('<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>'('<urn:example.org:c>','_:x'))),'<urn:example.org:b>'('<urn:example.org:a>','_:x'))).
11 changes: 11 additions & 0 deletions data/01-alice.n3
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@prefix : <urn:example.org:> .
@prefix log: <http://www.w3.org/2000/10/swap/log#> .

:Alice a :Person .

(_:X) log:onNegativeSurface {
_:X a :Person .
() log:onNegativeSurface {
_:X a :Human .
} .
} .
2 changes: 2 additions & 0 deletions data/01-alice.n3-result
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
'<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>'('<urn:example.org:Alice>','<urn:example.org:Person>').
'<http://www.w3.org/2000/10/swap/log#onNegativeSurface>'(['_:X'],('<http://www.w3.org/2000/10/swap/log#onNegativeSurface>'([],('<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>'('_:X','<urn:example.org:Human>'))),'<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>'('_:X','<urn:example.org:Person>'))).
5 changes: 5 additions & 0 deletions test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

for f in data/*.n3; do
node js/index.js $f | tee -a ${f}-result
done

0 comments on commit 5d62d44

Please sign in to comment.