Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/edmondchuc/gordf
The gordf module is an RDF library for Go.
https://github.com/edmondchuc/gordf
go golang memory-graph parsing rdf rdf-formats rdf-library rdf-store rdflib semantic-web triplestore turtle
Last synced: about 1 month ago
JSON representation
The gordf module is an RDF library for Go.
- Host: GitHub
- URL: https://github.com/edmondchuc/gordf
- Owner: edmondchuc
- Created: 2020-08-16T12:49:35.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-10-04T05:33:22.000Z (over 4 years ago)
- Last Synced: 2024-11-07T11:56:28.391Z (3 months ago)
- Topics: go, golang, memory-graph, parsing, rdf, rdf-formats, rdf-library, rdf-store, rdflib, semantic-web, triplestore, turtle
- Language: Go
- Homepage:
- Size: 17.6 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# gordf
The gordf module is an RDF library for Go.
## Current features
- Parse N-Triples from file
- Naive memory graph data structure
- Idiomatic querying of the memory graph
- Structs to represent URI and literals (both typed and lang tags)## Planned features
- Blank Nodes
- Parsing other RDF formats such as Turtle
- Serialise to disk in RDF formats (N-Triple, Turtle, etc)
- Idiomatic representation of CURIES E.g. `rdf:type` -> `RDF{l: "type"}`## Example usage
```go
package mainimport (
"fmt"
"github.com/edmondchuc/gordf/parser"
"github.com/edmondchuc/gordf/rdf"
)func main() {
// Create new graph.
g := rdf.Graph{}// Parse triples from file.
parser.ParseFile(&g, "data.nt", "nt")rdfType := rdf.NewURI("http://www.w3.org/1999/02/22-rdf-syntax-ns#type")
schemaName := rdf.NewURI("http://schema.org/name")// Query the graph by looping.
for triple := range g.Triples(rdf.None{}, rdfType, rdf.NewURI("http://schema.org/Organization")) {
for triple := range g.Triples(triple.S, schemaName, rdf.None{}) {
fmt.Println(triple)
}
}// Add new triples.
g.Add(rdf.NewURI("https://edmondchuc.com/me"), schemaName, rdf.NewLiteral("Edmond Chuc"))
}
```