{"id":15994066,"url":"https://github.com/knutwalker/ntparser","last_synced_at":"2025-08-01T20:40:40.807Z","repository":{"id":21250075,"uuid":"24565574","full_name":"knutwalker/NtParser","owner":"knutwalker","description":"A simple and performant N-Triples parser for the JVM","archived":false,"fork":false,"pushed_at":"2015-04-21T20:51:36.000Z","size":748,"stargazers_count":2,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-02T13:25:59.126Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/knutwalker.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-09-28T17:30:33.000Z","updated_at":"2015-02-01T03:28:49.000Z","dependencies_parsed_at":"2022-09-11T18:50:40.920Z","dependency_job_id":null,"html_url":"https://github.com/knutwalker/NtParser","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knutwalker%2FNtParser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knutwalker%2FNtParser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knutwalker%2FNtParser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knutwalker%2FNtParser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/knutwalker","download_url":"https://codeload.github.com/knutwalker/NtParser/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247266570,"owners_count":20910837,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-08T07:05:35.584Z","updated_at":"2025-04-05T00:15:36.208Z","avatar_url":"https://github.com/knutwalker.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NtParser\n\nA simple and well-performing [N-Triples](http://www.w3.org/TR/2014/REC-n-triples-20140225/ \"RDF 1.1 N-Triples\") parser for the JVM.\n\n\n## Installing\n\nNtParser is published to [Maven Central](http://search.maven.org/#search|ga|1|g%3A%22de.knutwalker%22%20AND%20%28a%3A%22ntparser_2.11%22%20OR%20a%3A%22ntparser_2.10%22%29):\n\n- group = de.knutwalker\n- artifact = ntparser_2.10 or ntparser_2.11\n- version: 0.3.0\n\n\n```xml\n\u003c!-- for Scala 2.10 --\u003e\n\u003cdependency\u003e\n    \u003cgroupId\u003ede.knutwalker\u003c/groupId\u003e\n    \u003cartifactId\u003entparser_2.10\u003c/artifactId\u003e\n    \u003cversion\u003e0.3.0\u003c/version\u003e\n\u003c/dependency\u003e\n\u003c!-- for Scala 2.11 --\u003e\n\u003cdependency\u003e\n    \u003cgroupId\u003ede.knutwalker\u003c/groupId\u003e\n    \u003cartifactId\u003entparser_2.11\u003c/artifactId\u003e\n    \u003cversion\u003e0.3.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n\n```scala\nlibraryDependencies += \"de.knutwalker\" %% \"ntparser\" % \"0.3.0\"\n```\n\n\nYou need at least one modelfactory instance as well. Available are:\n- `de.knutwalker:ntparser-model_2.1x:0.3.0`\n- `de.knutwalker:ntparser-jena_2.1x:0.3.0`\n\n\n## Using\n\n\n```scala\nimport de.knutwalker.ntparser.StrictNtParser\nimport de.knutwalker.ntparser.model.ntModel\n\nStrictNtParser(\"/path/to/my/graph.nt\") foreach { stmt ⇒\n  println(stmt.n3)\n}\n```\n\n\n```java\nimport de.knutwalker.ntparser.model.NtModelFactory;\nimport de.knutwalker.ntparser.model.Statement;\nimport de.knutwalker.ntparser.StrictNtParser;\nimport java.util.Iterator;\n\nIterator\u003cStatement\u003e statementIterator = StrictNtParser.parse(\"/path/to/my/graph.nt\", NtModelFactory.INSTANCE());\nwhile (statementIterator.hasNext()) {\n  Statement stmt = statementIterator.next();\n  System.out.println(stmt.n3());\n}\nStrictNtParser.close();\n```\n\n\n### in-depth usage\n\nThere are two parsers, `de.knutwalker.ntparser.StrictNtParser`\nand `de.knutwalker.ntparser.NonStrictNtParser`.\n\nBoth provide a number of possibilities to parse a graph and will always\nreturn an `Iterator` of a statement. The `apply` methods are Scala API,\nthe `parse` methods are Java API (and are thus consuming and producing\nJava `Iterator`s).\n\nThe `StrictNtParser` will halt with an Exception at the first parse error.\nThe `NonStrictNtParser` will just log exceptions and continue parsing.\n\nIn addition to that, you need to provide an instance of a typeclass or factory,\nthat will be used to create the resulting node graph.\nThere are two implementations available in the artifacts `ntparser-model` and\n`ntparser-jena`. The first will use a very simple Scala ADT, the second\nproduces a Jena model. You can also implement the interface\n`de.knutwalker.ntparser.ModelFactory` to include different backends.\n\nIf you provide a String, it is treated as the filename. NtParser transparently\nhandles gzipped and bzipped files as well, if you use this overloading.\nOther options include providing a `scala.io.Source`, for the Scala API\n(`apply`), `File`, `Path` for the Java API (`parse`), as well as `InputStream`\nand the respective `Iterable` and `Iterator` for both Scala and Java.\nThe `Iterable` and `Iterator` should represent single lines, that is,\none N-Triple per element.\n\nAs an alternative, you can instantiate an `de.knutwalker.ntparser.NtParser` directly.\nThe `NtParser` has several `parse*` methods, that each take a String and assume,\nthat this is _one_ line of some bigger document and that is correctly delimited.\nOne invocation of any `parse*` method will parse at-most _one_ statement.\nThere are two flavours, `NtParser.strict` and `NtParser.lenient`. The lenient one\nsupports grammar features, that are not officially specified, such as long quotes\nfrom Turtle.\n\n\n## Specification conformity\n\nNtParser passes [all tests provided by the W3C](http://www.w3.org/TR/2014/NOTE-rdf11-testcases-20140225/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fknutwalker%2Fntparser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fknutwalker%2Fntparser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fknutwalker%2Fntparser/lists"}