Skip to content

Commit

Permalink
add SolutionsAsString method on results
Browse files Browse the repository at this point in the history
  • Loading branch information
boutros committed Sep 4, 2020
1 parent 5d336ee commit 758cd28
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions sparql/sparql.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,21 @@ func (r *Results) Solutions() []map[string]rdf.Node {
return rs
}

// SolutionsAsString
func (r *Results) SolutionsAsString() []map[string]string {
var rs []map[string]string

for _, s := range r.Results.Bindings {
solution := make(map[string]string)
for k, v := range s {
solution[k] = v.Value
}
rs = append(rs, solution)
}

return rs
}

// termFromJSON converts a SPARQL json result binding into a rdf.Node. Any
// parsing errors on typed-literal will result in a xsd:string-typed RDF term.
func termFromJSON(b binding) rdf.Node {
Expand Down

0 comments on commit 758cd28

Please sign in to comment.