[GitHub] jena pull request #299: Turtle Star

2018-06-11 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/jena/pull/299


---


[GitHub] jena pull request #299: Turtle Star

2017-10-28 Thread mschroeder-github
GitHub user mschroeder-github opened a pull request:

https://github.com/apache/jena/pull/299

Turtle Star

Turtle parser extention for Turtle* as suggested in [Foundations of an 
Alternative Approach to Reification in 
RDF](https://arxiv.org/pdf/1406.3399.pdf) (Section 3.3).
I copied the javacc grammar definition from `turtle.jj` and add the changes 
to `turtle-star.jj`.
Javacc generates all the classes in package 
`org.apache.jena.n3.turtlestar.parser`.
The `RDFReaderFImpl` is extended with the `TurtleStarReader` reader, so one 
can read Turtle* with the following code:
```java
public static void parse() throws MalformedURLException {
Model m = ModelFactory.createDefaultModel();

m.read(new File("test.ttl").toURI().toURL().toString(), "TTL*");

StringWriter sw = new StringWriter();
m.write(sw, "TTL");
System.out.println(sw.toString());
}
```
In short, the Turtle* syntax 
```
@prefix foaf:  .
@prefix dct:  .
@prefix :  .

<< :bob foaf:age 23 >> dct:creator  ;
   dct:source  
 .
```
results in the following RDF model:
```
:bob  foaf:age 23 .

[]a    ;
  
  23 ;
  
  foaf:age ;
  
  :bob ;
  dct:creator  ;
  dct:source  .
```
A more complex example is:
```
:sven :claims << :markus :says << :sven a :Person >> >> .
```


You can merge this pull request into a Git repository by running:

$ git pull https://github.com/mschroeder-github/jena turtle_star

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/jena/pull/299.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #299


commit e63811a74da613f5d66232c8ad8a78caa2db6d7e
Author: Markus Schroeder 
Date:   2017-10-27T07:32:40Z

turtle parser generation by javacc fixed

commit 01520ea3d63744ed962402629bc2dea98807b1aa
Author: Markus Schroeder 
Date:   2017-10-27T08:24:32Z

turtle star parser copied from turtle parser

commit 6a72f45be68adf522e39c10bfd6373a3800656ca
Author: Markus Schroeder 
Date:   2017-10-27T14:49:29Z

turtle star syntax

commit 8e63b4784181eea93383cece7be0f6919e760eea
Author: Markus Schroeder 
Date:   2017-10-28T05:20:16Z

undo changes on the pom.xml




---