Git Product home page Git Product logo

sparql_http's Introduction

SPARQL_HTTP

SPARQL_HTTP is a SPARQL HTTP Client for Ruby. It is developed together with the Goo library but it hash been designed as an standalone component that can be used separately.

HOW-TO

Instatiate endpoint

config = { :name => :local_repo , :host => "localhost", :port => 8080 , :options => { } }
SparqlRd::Repository.configuration(store)
epr = SparqlRd::Repository.endpoint(store[:local_repo])

Assert Triples in a Graph

rdf_document = <<eos
 <a> <b> <c> .
 <c> <x> <d> .
eos
test_graph = "https://github.com/ncbo/sparqlrd/"
epr.append_in_graph(rdf_document, test_graph, SparqlRd::Utils::MimeType.turtle)

Query Data

rs = epr.query("SELECT * WHERE { GRAPH <#{test_graph}> { ?s ?p ?o .} }")
rs.each_solution do |sol|
    s,p,o = sol.get(:s), sol.get(:p), sol.get(:o)
    puts "#{s.value} #{p.value} #{o.value}"
    if o.literal?
        #access to string value
        puts o.value
        #access to parsed value based on XSD types
        puts o.parsed_value
    end
end

Update Data

update = <<eos
INSERT DATA { 
    GRAPH <https://github.com/ncbo/sparqlrd/> {
     <https://github.com/ncbo/sparqlrd/subject> <https://github.com/ncbo/sparqlrd/name> "msalvadores"; 
                  <https://github.com/ncbo/sparqlrd/worksAt> "Stanford" .
}
}
eos
epr.update(update)

sparql_http's People

Contributors

msalvadores avatar palexander avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.