Skip to content

Commit d89cd18

Browse files
committed
fix: jsonld test failure
Signed-off-by: Christian Stewart <christian@aperture.us>
1 parent d5b3db7 commit d89cd18

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

quad/jsonld/jsonld.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,8 +265,12 @@ func toValue(t ld.Node) quad.Value {
265265
switch t := t.(type) {
266266
case *ld.IRI:
267267
return quad.IRI(t.Value)
268+
case ld.IRI:
269+
return quad.IRI(t.Value)
268270
case *ld.BlankNode:
269271
return quad.BNode(t.Attribute)
272+
case ld.BlankNode:
273+
return quad.BNode(t.Attribute)
270274
case *ld.Literal:
271275
if t.Language != "" {
272276
return quad.LangString{
@@ -286,6 +290,25 @@ func toValue(t ld.Node) quad.Value {
286290
return ts
287291
}
288292
return quad.String(t.Value)
293+
case ld.Literal:
294+
if t.Language != "" {
295+
return quad.LangString{
296+
Value: quad.String(t.Value),
297+
Lang: t.Language,
298+
}
299+
} else if t.Datatype != "" && t.Datatype != stringDataType {
300+
ts := quad.TypedString{
301+
Value: quad.String(t.Value),
302+
Type: quad.IRI(t.Datatype),
303+
}
304+
if AutoConvertTypedString {
305+
if v, err := ts.ParseValue(); err == nil {
306+
return v
307+
}
308+
}
309+
return ts
310+
}
311+
return quad.String(t.Value)
289312
default:
290313
panic(fmt.Errorf("unexpected term type: %T", t))
291314
}

0 commit comments

Comments
 (0)