Skip to content

Commit

Permalink
Reset schema.go
Browse files Browse the repository at this point in the history
  • Loading branch information
iddan committed Jan 30, 2020
1 parent 6500284 commit 24194e5
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions internal/linkedql/schema/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ package schema

import (
"encoding/json"
"fmt"
"reflect"
"strconv"

"github.com/cayleygraph/cayley/query/linkedql"
_ "github.com/cayleygraph/cayley/query/linkedql/steps"
"github.com/cayleygraph/quad"
"github.com/cayleygraph/quad/voc/owl"
"github.com/cayleygraph/quad/voc/rdf"
"github.com/cayleygraph/quad/voc/rdfs"
"github.com/cayleygraph/quad/voc/xsd"
)
Expand All @@ -26,6 +26,7 @@ var (
iteratorStep = reflect.TypeOf((*linkedql.IteratorStep)(nil)).Elem()
entityIdentifier = reflect.TypeOf((*linkedql.EntityIdentifier)(nil)).Elem()
value = reflect.TypeOf((*quad.Value)(nil)).Elem()
operator = reflect.TypeOf((*linkedql.Operator)(nil)).Elem()
propertyPath = reflect.TypeOf((*linkedql.PropertyPath)(nil)).Elem()
stringMap = reflect.TypeOf(map[string]string{})
graphPattern = reflect.TypeOf(linkedql.GraphPattern(nil))
Expand Down Expand Up @@ -53,6 +54,9 @@ func typeToRange(t reflect.Type) string {
if t.Implements(pathStep) {
return linkedql.Prefix + "PathStep"
}
if t.Implements(operator) {
return linkedql.Prefix + "Operator"
}
if t.Implements(value) {
return rdfs.Resource
}
Expand Down Expand Up @@ -346,11 +350,11 @@ func (g *generator) Generate() []byte {
graph = append(graph, g.out...)
data, err := json.Marshal(map[string]interface{}{
"@context": map[string]interface{}{
"rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
"rdfs": "http://www.w3.org/2000/01/rdf-schema#",
"owl": "http://www.w3.org/2002/07/owl#",
"xsd": "http://www.w3.org/2001/XMLSchema#",
"linkedql": "http://cayley.io/linkedql#",
"rdf": rdf.NS,
"rdfs": rdfs.NS,
"owl": owl.NS,
"xsd": xsd.NS,
"linkedql": linkedql.Namespace,
"rdfg": rdfgNamespace,
},
"@graph": graph,
Expand Down

0 comments on commit 24194e5

Please sign in to comment.