Example #1
0
func (service SparqlService) Graph(query string) (graph *argo.Graph, err error) {
	resp, err := service.do(url.Values{"query": {query}}, "application/rdf+xml")
	if err != nil {
		return nil, err
	}
	defer resp.Body.Close()

	graph = argo.NewGraph(argo.NewListStore())
	err = graph.Parse(argo.ParseRDFXML, resp.Body)
	if err != nil {
		return nil, err
	}

	return graph, nil
}
Example #2
0
func main() {
	input, err := ioutil.ReadFile(os.Args[1])
	if err != nil {
		fmt.Fprintln(os.Stderr, err.Error())
		os.Exit(1)
	}

	go yyParse(&yyLex{newLexer("LoopC", string(input))})

	graph := argo.NewGraph(argo.NewListStore())

	for f := range parserOutput {
		f.ToRDF(graph)
	}

	graph.Serialize(argo.SerializeNTriples, os.Stdout)
}
Example #3
0
func NewInterpreter() (graph *Interpreter) {
	return &Interpreter{argo.NewGraph(argo.NewListStore())}
}