Skip to content

Commit 36b746a

Browse files
committed
linkedql: Correct type handling in client
1 parent 4bced0c commit 36b746a

File tree

5 files changed

+457
-330
lines changed

5 files changed

+457
-330
lines changed

cmd/generate_linkedql_client/generate_linkedql_client.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ import (
2323
const schemaFile = "linkedql.json"
2424
const outputFilePath = "query/linkedql/client/client.go"
2525

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

2830
func main() {
2931
ctx := context.TODO()
@@ -33,7 +35,7 @@ func main() {
3335
panic(err)
3436
}
3537

36-
stepClass, err := owl.GetClass(ctx, qs, pathStepIRI)
38+
stepClass, err := owl.GetClass(ctx, qs, stepIRI)
3739

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

4547
for _, stepSubClass := range stepSubClasses {
48+
if stepSubClass.Identifier == pathStepIRI || stepSubClass.Identifier == iteratorStepIRI {
49+
continue
50+
}
4651
stepSubClassDecls, err := stepSubClassToDecls(stepSubClass)
4752
if err != nil {
4853
panic(err)

internal/linkedql/schema/schema.go

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,23 @@ func (g *generator) Generate() []byte {
250250
Range: rng,
251251
})
252252
}
253+
graph := []interface{}{
254+
map[string]string{
255+
"@id": "linkedql:Step",
256+
"@type": "owl:Class",
257+
},
258+
map[string]interface{}{
259+
"@id": "linkedql:PathStep",
260+
"@type": "owl:Class",
261+
"rdfs:subClassOf": map[string]string{"@id": "linkedql:Step"},
262+
},
263+
map[string]interface{}{
264+
"@id": "linkedql:IteratorStep",
265+
"@type": "owl:Class",
266+
"rdfs:subClassOf": map[string]string{"@id": "linkedql:Step"},
267+
},
268+
}
269+
graph = append(graph, g.out...)
253270
data, err := json.Marshal(map[string]interface{}{
254271
"@context": map[string]interface{}{
255272
"rdf": map[string]string{"@id": "http://www.w3.org/1999/02/22-rdf-syntax-ns#"},
@@ -258,7 +275,7 @@ func (g *generator) Generate() []byte {
258275
"xsd": map[string]string{"@id": "http://www.w3.org/2001/XMLSchema#"},
259276
"linkedql": map[string]string{"@id": "http://cayley.io/linkedql#"},
260277
},
261-
"@graph": g.out,
278+
"@graph": graph,
262279
})
263280
if err != nil {
264281
panic(err)

0 commit comments

Comments
 (0)