Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/stain/commonsrdf-parser-jena
Parsers for Apache Commons RDF, backed by Apache Jena
https://github.com/stain/commonsrdf-parser-jena
Last synced: about 1 month ago
JSON representation
Parsers for Apache Commons RDF, backed by Apache Jena
- Host: GitHub
- URL: https://github.com/stain/commonsrdf-parser-jena
- Owner: stain
- License: apache-2.0
- Created: 2015-09-03T00:01:23.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-09-03T01:00:09.000Z (over 9 years ago)
- Last Synced: 2024-11-05T13:13:08.052Z (3 months ago)
- Language: Java
- Homepage:
- Size: 168 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# commonsrdf-parser-jena
Parsers for Apache Commons RDF, backed by Apache Jena* Author: [Stian Soiland-Reyes](http://orcid.org/0000-0001-9842-9718)
* License: [Apache License, version 2.0](http://www.apache.org/licenses/LICENSE-2.0)This is a small experiment to create an RDF `Parser` interface for
[Apache Commons RDF](http://commonsrdf.incubator.apache.org/), implemented
by using [Apache Jena](https://jena.apache.org/documentation/io/)'s
[RiotReader](https://jena.apache.org/documentation/javadoc/arq/org/apache/jena/riot/RiotReader.html)
parsers as discovered through
[RDFDataMgr](https://jena.apache.org/documentation/javadoc/arq/org/apache/jena/riot/RDFDataMgr.html).This can be useful for Commons RDF implementations which don't have native
parsers, e.g. the built-in _simple_ implementation.See also [JENA-1015](https://issues.apache.org/jira/browse/JENA-1015) which is somewhat orthogonal, as that
aims to provide bindings for the Commons RDF API using Jena's data structures.## Building
mvn clean install
## UsageThe [Parser](src/main/java/no/s11/rdf/commonsrdfjena/Parser.java) interface works by the factory
pattern to set various parser options. Note that each option returns a new, modified
instance of the Parser, which is therefore effectively immutable and reusable
for multiple parser sessions.You must minimally call one of the methods `path`, `url` or `inputStream` to provide the source
of the RDF resource to be parsed. After setting all options, call `parse`.Example:
```java
Parser parser = new JenaParser();
Path filePath = Paths.get("/tmp/file.rdf");
Graph g = parser.contentType(Parser.RDFXML).path(examplePath).parse();
```## Contributions
Feel free to contribute by adding a [pull request](https://github.com/stain/commonsrdf-parser-jena/pulls) or
[raise an issue](https://github.com/stain/commonsrdf-parser-jena/issues).For any discussion or comments, use the [dev@commonsrdf](http://commonsrdf.incubator.apache.org/mail-lists.html)
mailing list.