• Topic
  • Discussion
  • OATWikiWeb.InteractiveSparqlQueryBuilderRESTMode(Last) -- Owiki? , 2016-08-19 14:58:49 Edit owiki 2016-08-19 14:58:49

    iSPARQL REST Mode Support

    Virtuoso iSPARQL endpoint can be accessed via REST using http://host:port/isparql/view/ (e.g., OpenLink's Virtuoso Demo site iSPARQL endpoint, http://demo.openlinksw.com/isparql), with the following parameters:

    • format : specifies the request format (set by default to "application/rdf+xml").
    • defaultGraph : used as FROM, if not specified in query
    • query : the SPARQL query
    • named-graph-uri : used for named graphs, can be specified multiple times
    • maxrows : specifies limit on the results
    • sponge : specifies sponger cache behavior
    • endpoint : specifies sparql endpoint
    • file : .isparql, .ldr, and .rq resources

    Example 1

    Get 10 triples from demo Dataspace:

    SELECT * 
    FROM <http://demo.openlinksw.com/dataspace>
    WHERE {?s ?p ?o}
    LIMIT 10
    
    1. Load this URL in your browser:

      http://demo.openlinksw.com/isparql/view/?query=SELECT%20*%20%0AFROM%20%3Chttp%3A%2F%2Fdemo.openlinksw.com%2Fdataspace%3E%0AWHERE%20%7B%3Fs%20%3Fp%20%3Fo%7D%0ALIMIT%2010&endpoint=/sparql&maxrows=50&default-graph-uri=

    2. As a result, the triples found will be shown:



    Example 2

    Get 10 Weblog posts:

    prefix sioc: <http://rdfs.org/sioc/ns#> 
    prefix sioct: <http://rdfs.org/sioc/types#>
    prefix dct: <http://purl.org/dc/elements/1.1/>
    prefix dcc: <http://purl.org/dc/terms/> 
    SELECT DISTINCT ?forum_name, ?post, ?title ?cr ?url 
    FROM <http://demo.openlinksw.com/dataspace>
    WHERE    
      { 
        ?forum a sioct:Weblog .
        ?forum sioc:id ?forum_name .
        ?forum sioc:container_of ?post .
        OPTIONAL { ?post dct:title ?title } .
        OPTIONAL { ?post dcc:created ?cr } .
        OPTIONAL { ?post sioc:link ?url } .
      }
    ORDER BY DESC (?cr)
    LIMIT 10
    
    1. Load this URL in your browser:

      http://demo.openlinksw.com/isparql/view/?query=prefix%20sioc%3A%20%3Chttp%3A%2F%2Frdfs.org%2Fsioc%2Fns%23%3E%20%0Aprefix%20sioct%3A%20%3Chttp%3A%2F%2Frdfs.org%2Fsioc%2Ftypes%23%3E%0Aprefix%20dct%3A%20%3Chttp%3A%2F%2Fpurl.org%2Fdc%2Felements%2F1.1%2F%3E%0Aprefix%20dcc%3A%20%3Chttp%3A%2F%2Fpurl.org%2Fdc%2Fterms%2F%3E%20%0ASELECT%20DISTINCT%20%3Fforum_name%20%3Fpost%20%3Ftitle%20%3Fcr%20%3Furl%20%0AFROM%20%3Chttp%3A%2F%2Fdemo.openlinksw.com%2Fdataspace%3E%0AWHERE%20%20%20%20%0A%20%20%7B%20%0A%20%20%20%20%3Fforum%20a%20sioct%3AWeblog%20.%0A%20%20%20%20%3Fforum%20sioc%3Aid%20%3Fforum_name%20.%0A%20%20%20%20%3Fforum%20sioc%3Acontainer_of%20%3Fpost%20.%0A%20%20%20%20OPTIONAL%20%7B%20%3Fpost%20dct%3Atitle%20%3Ftitle%20%7D%20.%0A%20%20%20%20OPTIONAL%20%7B%20%3Fpost%20dcc%3Acreated%20%3Fcr%20%7D%20.%0A%20%20%20%20OPTIONAL%20%7B%20%3Fpost%20sioc%3Alink%20%3Furl%20%7D%20.%0A%20%20%7D%0AORDER%20BY%20DESC%20(%3Fcr)%0ALIMIT%2010&endpoint=/sparql&maxrows=50&default-graph-uri=

    2. As a result, the triples found will be shown:

    See Also