Skip to content

Commit

Permalink
linkedql: Correct type handling in client
Browse files Browse the repository at this point in the history
  • Loading branch information
iddan authored and dennwc committed Dec 15, 2019
1 parent 13579de commit abd548c
Show file tree
Hide file tree
Showing 5 changed files with 457 additions and 330 deletions.
7 changes: 6 additions & 1 deletion cmd/generate_linkedql_client/generate_linkedql_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ import (
const schemaFile = "linkedql.json"
const outputFilePath = "query/linkedql/client/client.go"

var stepIRI = quad.IRI("http://cayley.io/linkedql#Step")
var pathStepIRI = quad.IRI("http://cayley.io/linkedql#PathStep")
var iteratorStepIRI = quad.IRI("http://cayley.io/linkedql#IteratorStep")

func main() {
ctx := context.TODO()
Expand All @@ -33,7 +35,7 @@ func main() {
panic(err)
}

stepClass, err := owl.GetClass(ctx, qs, pathStepIRI)
stepClass, err := owl.GetClass(ctx, qs, stepIRI)

if err != nil {
panic(err)
Expand All @@ -43,6 +45,9 @@ func main() {
var decls []ast.Decl

for _, stepSubClass := range stepSubClasses {
if stepSubClass.Identifier == pathStepIRI || stepSubClass.Identifier == iteratorStepIRI {
continue
}
stepSubClassDecls, err := stepSubClassToDecls(stepSubClass)
if err != nil {
panic(err)
Expand Down
19 changes: 18 additions & 1 deletion internal/linkedql/schema/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,23 @@ func (g *generator) Generate() []byte {
Range: rng,
})
}
graph := []interface{}{
map[string]string{
"@id": "linkedql:Step",
"@type": "owl:Class",
},
map[string]interface{}{
"@id": "linkedql:PathStep",
"@type": "owl:Class",
"rdfs:subClassOf": map[string]string{"@id": "linkedql:Step"},
},
map[string]interface{}{
"@id": "linkedql:IteratorStep",
"@type": "owl:Class",
"rdfs:subClassOf": map[string]string{"@id": "linkedql:Step"},
},
}
graph = append(graph, g.out...)
data, err := json.Marshal(map[string]interface{}{
"@context": map[string]interface{}{
"rdf": map[string]string{"@id": "http://www.w3.org/1999/02/22-rdf-syntax-ns#"},
Expand All @@ -258,7 +275,7 @@ func (g *generator) Generate() []byte {
"xsd": map[string]string{"@id": "http://www.w3.org/2001/XMLSchema#"},
"linkedql": map[string]string{"@id": "http://cayley.io/linkedql#"},
},
"@graph": g.out,
"@graph": graph,
})
if err != nil {
panic(err)
Expand Down
Loading

0 comments on commit abd548c

Please sign in to comment.