Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ubermanu/rdf.zig
RDF Graph parser
https://github.com/ubermanu/rdf.zig
rdf zig
Last synced: about 1 month ago
JSON representation
RDF Graph parser
- Host: GitHub
- URL: https://github.com/ubermanu/rdf.zig
- Owner: ubermanu
- License: mit
- Created: 2024-06-20T11:22:22.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-12-13T18:25:02.000Z (about 1 month ago)
- Last Synced: 2024-12-13T19:22:02.563Z (about 1 month ago)
- Topics: rdf, zig
- Language: Zig
- Homepage:
- Size: 9.77 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# rdf.zig
A RDF Graph parser, supports the following formats:
- N-Triples
- Turtle## Install
```sh
zig fetch --save git+https://github.com/ubermanu/rdf.zig
``````zig
const rdf_mod = b.dependency("rdf", .{});
exe.root_module.addImport("rdf", rdf_mod.module("rdf"));
```## Usage
```zig
const Graph = @import("rdf").Graph;test {
const graph = Graph.init(std.testing.allocator);
defer graph.deinit();const ttl =
\\@prefix foaf: .
\\
\\
\\ a foaf:Person ;
\\ foaf:name "Alice" ;
\\ foaf:age "30"^^xsd:integer .
;graph.loadFromString(ttl);
try std.testing.expectEqualStrings(
"http://example.org/person#Alice",
graph.nodes.items[0].name,
);
}
```