Tutorial VII:
Linked Data
(SPARQL FROM CLAUSE and
Sponger Middleware Pragmas)

OpenLink Software





SPARQL FROM CLAUSE Examples

DISTINCT

## Example of FROM Clause
## with distinct values:

SELECT DISTINCT ?Concept
FROM <http://dbpedia.org>
WHERE
  {
    ?s a ?Concept
  }
LIMIT 10

## See URIBurner live results.

Local Name Graph IRI

## Example "Make a Local Name Graph IRI
## from URL of external Resource.
## The Actual Document URL is
## <http://dig.csail.mit.edu/2005/ajar/ajaw/data>:

DEFINE get:soft "replacing"
DEFINE input:grab-var "?dev"
DEFINE input:grab-var "?describedby"
DEFINE input:grab-var "?topic"
DEFINE input:grab-iri <http://dig.csail.mit.edu/2005/ajar/ajaw/data#Tabulator>
DEFINE input:grab-follow-predicate <http://usefulinc.com/ns/doap#developer>
DEFINE input:grab-depth 10
DEFINE input:grab-limit 50
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX doap: <http://usefulinc.com/ns/doap#>

SELECT DISTINCT ?name ?mbox ?dev ?describedby ?topic
WHERE
  {
    GRAPH <http://dig.csail.mit.edu/2005/ajar/ajaw/data>
      {
        <http://dig.csail.mit.edu/2005/ajar/ajaw/data#Tabulator>
            doap:developer ?dev .
        OPTIONAL { ?dev foaf:name ?name }
        OPTIONAL { ?dev foaf:mbox ?mbox }
        OPTIONAL {
                   ?dev <http://www.w3.org/2007/05/powder-s#describedby> ?describedby .
                   ?describedby <http://xmlns.com/foaf/0.1/topic> ?topic
                 }
      }
  }
LIMIT 10

## See URIBurner live results.






SPARQL FROM NAMED Clauses Examples

OPTION

## Example with FROM NAMED Clause:

SELECT ?id
FROM NAMED
  <http://www.openlinksw.com/dataspace/person/kidehen@openlinksw.com>
OPTION (get:soft "soft", get:method "GET")
WHERE
  {
    GRAPH ?g { ?id a ?o }
  }
LIMIT 10

## See URIBurner live results.

Multiple Graphs and UNION

## Example with multiple graphs
## and UNION

DEFINE get:soft "replace"
PREFIX gr: <http://purl.org/goodrelations/v1#>

SELECT ?object
FROM NAMED
<http://www.ebusiness-unibw.org/tools/goodrelations-validator/examples/test8.rdf>
    OPTION (get:soft "soft", get:method "GET")
FROM NAMED <http://purl.org/goodrelations/v1>
    OPTION (get:soft "soft", get:method "GET")
WHERE
  {
    {
      GRAPH
        <http://www.ebusiness-unibw.org/tools/goodrelations-validator/examples/test8.rdf>
          {
            ?object gr:hasGlobalLocationNumber ?gln
          }
    }
    UNION
    {
      GRAPH
        <http://purl.org/goodrelations/v1>
          {
            ?object gr:hasGlobalLocationNumber ?gln
          }
    }
  }
LIMIT 10

## See URIBurner live results.

Graph and Optional

## Example with OPTIONAL values:

DEFINE input:grab-var "foaf"
DEFINE input:grab-var "friend"
DEFINE input:grab-var "friendsURI"
DEFINE input:grab-follow-predicate <http://usefulinc.com/ns/doap#developer>
DEFINE input:grab-depth 10
DEFINE input:grab-limit 50
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX doap: <http://usefulinc.com/ns/doap#>

SELECT DISTINCT ?friendsname ?friendshomepage ?foafsname ?foafshomepage
FROM NAMED <http://richard.cyganiak.de/foaf.rdf>
WHERE
  {
    GRAPH
      <http://richard.cyganiak.de/foaf.rdf>
      {
        {
          <http://www.w3.org/People/Berners-Lee/card> foaf:knows ?friend .
          ?friend foaf:mbox_sha1sum ?mbox .
          ?friendsURI foaf:mbox_sha1sum ?mbox .
          ?friendsURI foaf:name ?friendsname .
          ?friendsURI foaf:homepage ?friendshomepage .
        }
    OPTIONAL {
               ?friendsURI foaf:knows ?foaf .
               ?foaf foaf:name ?foafsname .
               ?foaf foaf:homepage ?foafshomepage .
             }
      }
  }
LIMIT 10

## See URIBurner live results.

Graph and DISTINCT

## Example with DISTINCT values:

DEFINE input:grab-var "?dev"
DEFINE input:grab-var "?describedby"
DEFINE input:grab-var "?topic"
DEFINE input:grab-iri <http://dig.csail.mit.edu/2005/ajar/ajaw/data#Tabulator>
DEFINE input:grab-follow-predicate <http://usefulinc.com/ns/doap#developer>
DEFINE input:grab-depth 10
DEFINE input:grab-limit 50
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX doap: <http://usefulinc.com/ns/doap#>

SELECT DISTINCT ?name ?mbox ?dev ?describedby ?topic
WHERE
  {
    GRAPH <http://dig.csail.mit.edu/2005/ajar/ajaw/data>
      {
        <http://dig.csail.mit.edu/2005/ajar/ajaw/data#Tabulator>
            doap:developer ?dev .
        OPTIONAL { ?dev foaf:name ?name }
        OPTIONAL { ?dev foaf:mbox ?mbox }
        OPTIONAL {
                   ?dev <http://www.w3.org/2007/05/powder-s#describedby> ?describedby .
                   ?describedby <http://xmlns.com/foaf/0.1/topic> ?topic
                 }
      }
  }
LIMIT 10

## See URIBurner live results.

DISTINCT, Graph and Optional

DEFINE input:grab-var "foaf"
DEFINE input:grab-var "friend"
DEFINE input:grab-var "friendsURI"
DEFINE input:grab-follow-predicate <http://xmlns.com/foaf/0.1/knows>
DEFINE input:grab-depth 10
DEFINE input:grab-limit 50
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX doap: <http://usefulinc.com/ns/doap#>

SELECT DISTINCT *
FROM NAMED
    <http://mypenlink.net/dataspace/person/kidehen>
WHERE
  {
    GRAPH
      <http://mypenlink.net/dataspace/person/kidehen>
      {
        {
          <http://mypenlink.net/dataspace/person/kidehen#this>
            foaf:knows ?friend .
          OPTIONAL { ?friend foaf:mbox_sha1sum ?mbox } .
          OPTIONAL { ?friendsURI foaf:mbox_sha1sum ?mbox } .
          OPTIONAL { ?friendsURI foaf:name ?friendsname } .
          OPTIONAL { ?friendsURI foaf:homepage ?friendshomepage } .
        }
        OPTIONAL {
                   ?friendsURI foaf:knows ?foaf .
                   ?foaf foaf:name ?foafsname .
                   ?foaf foaf:homepage ?foafshomepage .
                 }
    }
  }
LIMIT 10

## See URIBurner live results.

Transitivitiy

DEFINE input:grab-var "foaf"
DEFINE input:grab-var "friend"
DEFINE input:grab-var "friendsURI"
DEFINE input:grab-follow-predicate <http://xmlns.com/foaf/0.1/knows>
DEFINE input:grab-depth 10
DEFINE input:grab-limit 50
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX doap: <http://usefulinc.com/ns/doap#>

SELECT DISTINCT *
FROM NAMED
    <http://mypenlink.net/dataspace/person/kidehen>
WHERE
  {
    {
      {
        {
          SELECT ?start ?friend
          WHERE
            {
              ?start foaf:knows ?friend .
            }
        }
        OPTION ( transitive, t_in (?start), t_out (?friend) )
        FILTER ( ?start =
                <http://mypenlink.net/dataspace/person/kidehen#this>
               )
      }
      OPTIONAL { ?friend foaf:mbox_sha1sum ?mbox } .
      OPTIONAL { ?friendsURI foaf:mbox_sha1sum ?mbox } .
      OPTIONAL { ?friendsURI foaf:name ?friendsname } .
      OPTIONAL { ?friendsURI foaf:homepage ?friendshomepage } .
    }
    OPTIONAL {
                ?friendsURI foaf:knows ?foaf .
                ?foaf foaf:name ?foafsname .
                ?foaf foaf:homepage ?foafshomepage .
             }
  }
LIMIT 10

## See URIBurner live results.






Sponger Pragmas

Pragma: "grab-base"

## Example of pragma "grab-base" usage:

DEFINE input:grab-var "more"
DEFINE input:grab-depth 10
DEFINE input:grab-limit 100
DEFINE input:grab-base
    "http://www.openlinksw.com/dataspace/kidehen@openlinksw.com/weblog/kidehen@openlinksw.com%27s%20BLOG%20%5B127%5D/1300"
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

SELECT ?id ?firstname ?nick
WHERE
  {
    GRAPH ?g
      {
        ?id rdf:type foaf:Person .
        ?id foaf:firstName ?firstname .
        ?id foaf:knows ?fn .
        ?fn foaf:nick ?nick .
        OPTIONAL { ?id rdfs:SeeAlso ?more }
      }
  }
LIMIT 10

## See URIBurner live results.

Pragma: "sql:signal-void-variables"

## Example of pragma "sql:signal-void-variables" usage:

DEFINE sql:signal-void-variables 1
DEFINE input:grab-var "db"

SELECT *
FROM <http://dbpedia.org/resource/Les_Patterson_Saves_the_World>
WHERE
  {
    <http://mpii.de/yago/resource/Les_Patterson_Saves_the_World> <http://www.w3.org/2002/07/owl#sameAs> ?db.
    GRAPH ?g
      {
        ?db ?p ?o
      }
  }
LIMIT 10

## See URIBurner live results.

Pragma: "get:soft "replace"

## Example of pragma "get:soft "replace" usage:
## New York Times DBpedia Join
## Using Sponger to remote HTTP GET and then
## make a local Named Graph from the Resource at
## URL: <http://data.nytimes.com/N66220017142656459133.rdf>

DEFINE input:same-as "yes"
DEFINE get:soft "replace"
SELECT ?nyt_entity ?attribute ?attribute_value
FROM <http://data.nytimes.com/N66220017142656459133.rdf>
WHERE
  {
    ?nyt_entity owl:sameAs ?dbpedia_entity.
      GRAPH ?g
        {
          ?dbpedia_entity ?attribute ?attribute_value
        }
  }
LIMIT 10

## See URIBurner live results.

Pragma: "input:same-as"

## Example of pragma "input:same-as "yes"" usage:
## Uberlic & DBpedia Join
## Using Sponger to remote HTTP GET and then
## make a local Named Graph from the Resource at
## URL: <http://uberblic.org/resource/a8c82706-e855-490c-96eb-6061b6d0c3c8.rdf>

DEFINE input:same-as "yes"
DEFINE get:soft "replace"
SELECT DISTINCT ?ub_entity ?attribute ?attribute_value
FROM <http://uberblic.org/resource/a8c82706-e855-490c-96eb-6061b6d0c3c8.rdf>
WHERE
  {
    ?ub_entity owl:sameAs ?dbpedia_entity.
      GRAPH ?g
        {
          ?dbpedia_entity ?attribute ?attribute_value
        }
  }
LIMIT 10

## See URIBurner live results.

Pragma: "grab-var"

## Example of pragma "grab-var" usage:
## New York Times DBpedia Join
## Using Local Dataset Imported into
## Named Graph: <http://data.nytimes.com/N66220017142656459133.rdf>

DEFINE input:grab-var "db"

SELECT *
FROM <http://data.nytimes.com#people>
WHERE
  {
    <http://data.nytimes.com/N66220017142656459133.rdf#DataCreation> <http://purl.org/net/provenance/ns#usedData> ?db.
    GRAPH ?g
      {
        ?db ?p ?o
      }
  }
LIMIT 50

## See URIBurner live results.

Pragma: "grab-var" Variant II

## Example of pragma "grab-var" usage:
DEFINE input:grab-var "?dev"
DEFINE input:grab-var "?describedby"
DEFINE input:grab-var "?topic"
DEFINE input:grab-iri <http://dig.csail.mit.edu/2005/ajar/ajaw/data#Tabulator>
DEFINE input:grab-follow-predicate <http://usefulinc.com/ns/doap#developer>
DEFINE input:grab-depth 10
DEFINE input:grab-limit 50
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX doap: <http://usefulinc.com/ns/doap#>

SELECT DISTINCT ?name ?mbox ?dev ?describedby ?topic
WHERE
  {
    GRAPH <http://dig.csail.mit.edu/2005/ajar/ajaw/data>
      {
        <http://dig.csail.mit.edu/2005/ajar/ajaw/data#Tabulator>
          doap:developer ?dev .
        OPTIONAL { ?dev foaf:name ?name } .
        OPTIONAL { ?dev foaf:mbox ?mbox } .
        OPTIONAL { ?dev <http://www.w3.org/2007/05/powder-s#describedby> ?describedby } .
      }
  }
LIMIT 10

## See URIBurner live results.

Pragma: "grab-var" Variant III

## Example of pragma "grab-var" usage:
DEFINE input:grab-var "?dev"
DEFINE input:grab-iri <http://dig.csail.mit.edu/2005/ajar/ajaw/data#Tabulator>
DEFINE input:grab-follow-predicate <http://usefulinc.com/ns/doap#developer>
DEFINE input:grab-depth 10
DEFINE input:grab-limit 50
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX doap: <http://usefulinc.com/ns/doap#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>

SELECT DISTINCT *
WHERE
  {
    GRAPH <http://dig.csail.mit.edu/2005/ajar/ajaw/data>
      {
        <http://dig.csail.mit.edu/2005/ajar/ajaw/data#Tabulator>
          doap:developer ?dev .
        OPTIONAL { ?dev foaf:name ?name } .
        OPTIONAL { ?dev foaf:mbox ?mbox } .
        OPTIONAL { ?dev owl:sameAs ?sameAs } .
      }
  }
LIMIT 10

## See URIBurner live results.

Pragma: "grab-iri"

## Example of pragma "grab-iri" usage:
DEFINE input:storage ""
DEFINE input:grab-iri
    <http://www.openlinksw.com/dataspace/kidehen@openlinksw.com/weblog/kidehen@openlinksw.com%27s%20BLOG%20%5B127%5D/sioc.ttl>
DEFINE input:grab-var "id"
DEFINE input:grab-depth 10
DEFINE input:grab-limit 100
DEFINE input:grab-base
    "http://www.openlinksw.com/dataspace/kidehen@openlinksw.com/weblog/kidehen@openlinksw.com%27s%20BLOG%20%5B127%5D/1300"

SELECT ?id
WHERE
  {
    GRAPH ?g
      {
        ?id a ?o
      }
  }
LIMIT 10

## See URIBurner live results.

Pragma: "grab-all"

## Example of pragma "grab-all" usage:

DEFINE input:grab-all "yes"
DEFINE input:grab-depth 10
DEFINE input:grab-limit 100
DEFINE input:grab-base
  "http://www.openlinksw.com/dataspace/kidehen@openlinksw.com/weblog/kidehen@openlinksw.com%27s%20BLOG%20%5B127%5D/1300"
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>

SELECT ?id ?firstname ?nick
WHERE
  {
    GRAPH ?g
      {
        ?id rdf:type foaf:Person .
        ?id foaf:firstName ?firstname .
        ?id foaf:knows ?fn .
        ?fn foaf:nick ?nick .
      }
  }
LIMIT 10

## See URIBurner live results.

Pragma: "grab-seealso"

## Example of pragma "grab-seealso" usage:

DEFINE input:grab-iri
<http://www.openlinksw.com/dataspace/kidehen@openlinksw.com/weblog/kidehen@openlinksw.com%27s%20BLOG%20%5B127%5D/sioc.ttl>
DEFINE input:grab-var "id"
DEFINE input:grab-depth 10
DEFINE input:grab-limit 100
DEFINE input:grab-base
"http://www.openlinksw.com/dataspace/kidehen@openlinksw.com/weblog/kidehen@openlinksw.com%27s%20BLOG%20%5B127%5D/1300"
DEFINE input:grab-seealso <foaf:maker>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>

SELECT ?id
WHERE
  {
    GRAPH ?g
      {
        ?id a foaf:Person .
      }
  }
LIMIT 10

## See URIBurner live results.

Pragma: "input:grab-limit"

## Example of pragma "grab-limit" usage:

DEFINE input:grab-depth 10
DEFINE input:grab-limit 100
DEFINE input:grab-var "more"
DEFINE input:grab-base
    "http://www.openlinksw.com/dataspace/kidehen@openlinksw.com/weblog/kidehen@openlinksw.com%27s%20BLOG%20%5B127%5D/1300"
PREFIX foaf: <http://xmlns.com/foaf/0.1/>

SELECT ?id
WHERE
  {
    GRAPH ?g
      {
        ?id a foaf:Person .
        OPTIONAL { ?id foaf:maker ?more }
      }
  }
LIMIT 10

## See URIBurner live results.

Pragma: "default-graph-uri"

## Example of pragma "default-graph-uri" usage:

DEFINE input:default-graph-uri <http://mygraph.com>

INSERT INTO <http://mygraph.com>
  {
    <http://myopenlink.net/dataspace/Kingsley#this>
    <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
    <http://rdfs.org/sioc/ns#User>
  }

Pragma: "grab-follow-predicate"

## Example of pragma "grab-follow-predicate" usage:

DEFINE input:grab-var "o"
DEFINE input:grab-follow-predicate foaf:knows
DEFINE input:grab-depth 10
DEFINE input:grab-limit 50

SELECT ?o ?dist
       (
        (
          SELECT COUNT ( * )
          WHERE
            {
              ?o foaf:knows ?xx
            }
        )
       ) AS ?count
WHERE
  {
    {
      SELECT ?s ?o
      WHERE
        {
          ?s foaf:knows ?o .
        }
    }
    OPTION ( transitive,
             t_distinct,
             t_in ( ?s ),
             t_out ( ?o ),
             t_min ( 1 ),
             t_max ( 4 ),
             t_step ( 'step_no' ) AS ?dist
           ) .
    FILTER ( ?s = <http://www.w3.org/People/Berners-Lee/card#i> )
  }
ORDER BY ?dist DESC 3
LIMIT 100

## See URIBurner live results.

Pragma: "grab-depth"

## Example of pragma "grab-depth" usage:

DEFINE input:grab-var "dev"
DEFINE input:grab-var "proj"
DEFINE input:grab-var "projectName"
DEFINE input:grab-follow-predicate
    <http://usefulinc.com/ns/doap#developer>
DEFINE input:grab-depth 10
DEFINE input:grab-limit 50
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX doap: <http://usefulinc.com/ns/doap#>

SELECT DISTINCT ?name ?mbox ?projectName
WHERE
  {
    {
      {
        {
          SELECT ?start ?dev
          WHERE
            {
              ?start doap:developer ?dev .
            }
        }
      OPTION ( transitive, t_in (?start), t_out (?dev) )
      FILTER ( ?start =
  <http://dig.csail.mit.edu/2005/ajar/ajaw/data#Tabulator> )
      }
      ?dev foaf:name ?name .
    }
    OPTIONAL { ?dev foaf:mbox ?mbox } .
    OPTIONAL {
               ?dev doap:project ?proj .
               ?proj foaf:name ?projectName
             }
  }
LIMIT 10

## See URIBurner live results.

Pragma: "grab-accept"

## Example of pragma "grab-accept" usage:

DEFINE get:accept "text/turtle"
SELECT *
FROM <http://www.openlinksw.com/DAV/data/turtle/products.ttl>
WHERE
  {
    ?s ?p ?o
  }
LIMIT 10



## See URIBurner live results.

Social Network Exploration

## No Named Graph specificity
## Name Graphs will be created internally based
## on the URLs of dereferenced Document URLs

DEFINE input:grab-var "friend"
DEFINE input:grab-var "Others"
DEFINE input:grab-follow-predicate foaf:knows
DEFINE input:grab-depth 2
DEFINE input:grab-limit 50
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX doap: <http://usefulinc.com/ns/doap#>

SELECT DISTINCT *
WHERE
  {
    <http://demo.openlinksw.com/dataspace/person/demo#this>
      foaf:knows ?friend .
    ?friend foaf:knows ?Others.
  }
LIMIT 10

## See URIBurner live results.

Transitive Option variation

DEFINE input:grab-var "friend"
DEFINE input:grab-var "Others"
DEFINE input:grab-follow-predicate
    <http://xmlns.com/foaf/0.1/#knows>
DEFINE input:grab-depth 2
DEFINE input:grab-limit 50
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX doap: <http://usefulinc.com/ns/doap#>

SELECT DISTINCT *
WHERE
  {
    {
      {
        {
          SELECT ?start ?friend
          WHERE
            {
              ?start foaf:knows ?friend .
            }
        }
        OPTION ( transitive, t_in (?start), t_out (?friend) )
        FILTER ( ?start =
          <http://www.w3.org/People/Berners-Lee/card#i> )
      }
      ?friend foaf:knows ?Others .
    }
  }
LIMIT 10

## See URIBurner live results.

#Conditional use of owl:sameAs inference rule

#Conditional use of owl:sameAs inference rule

DEFINE input:same-as "yes"
PREFIX geonames: <http://www.geonames.org/ontology#>

SELECT *
WHERE
  {
    ?s geonames:parentFeature ?z
  }
LIMIT 10

## See URIBurner live results.

Crawling a specific Property path

DEFINE input:grab-follow-predicate
<http://dbpedia.org/property/hasPhotoCollection>
DEFINE input:grab-depth 10
PREFIX foaf: <http://xmlns.com/foaf/0.1/>

SELECT DISTINCT *
WHERE
  {
    <http://dbpedia.org/resource/Munich> foaf:depiction ?z
  }
LIMIT 10

## See URIBurner live results.

Using a Weblog Post as starting point for Crawl

DEFINE input:grab-follow-predicate <foaf:knows>
DEFINE input:grab-depth 10
DEFINE input:grab-limit 100
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

SELECT DISTINCT ?my_id ?Knows ?their_id ?fname
WHERE
  {
    <http://www.openlinksw.com/dataspace/kidehen@openlinksw.com/weblog/kidehen@openlinksw.com%27s%20BLOG%20%5B127%5D/1300>
      foaf:maker ?my_id .
    ?my_id a foaf:Person .
    OPTIONAL { ?my_id foaf:nick ?fname } .
    OPTIONAL { ?my_id foaf:knows ?their_id } .
    OPTIONAL { ?their_id foaf:nick ?Knows } .
}
LIMIT 10

## See URIBurner live results.

Distinct DBpedia URIs from the Sponged Resource

## Distinct DBpedia URIs from the sponged resource

DEFINE get:soft "replace"

SELECT DISTINCT ?o ?dbp
FROM <http://webr3.org/__play/optimal/webr3.html>
WHERE
  {
    ?s rdfs:seeAlso ?o .
    ?o ?p ?dbp
    FILTER ( REGEX( str( ?dbp ), ".*dbpedia.org" ) )
  }
LIMIT 10

## See URIBurner live results.

Get Alchemy URIs from a Sponged Resource

SELECT ?o2 ?o3
FROM <http://webr3.org/__play/optimal/webr3.html>
WHERE
  {
    ?s rdfs:seeAlso ?o .
    ?o <http://rdf.alchemyapi.com/rdf/v1/s/aapi-schema#Disambiguation> ?o2 .
    ?o2 ?p ?o3
  }
LIMIT 50

## See URIBurner live results.

Transitivity

## Example by given URI
## http://mypenlink.net/dataspace/person/kidehen#this
## and with transitivity option:

DEFINE input:grab-var "friend"
DEFINE input:grab-var "Others"
DEFINE input:grab-follow-predicate <http://xmlns.com/foaf/0.1/#knows>
DEFINE input:grab-depth 2
DEFINE input:grab-limit 50
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX doap: <http://usefulinc.com/ns/doap#>

SELECT DISTINCT *
WHERE
  {
    {
      {
        {
          SELECT ?start ?friend
          WHERE
            {
              ?start foaf:knows ?friend .
            }
        }
        OPTION ( transitive, t_in (?start), t_out (?friend) )
        FILTER ( ?start =
          <http://mypenlink.net/dataspace/person/kidehen#this> )
      }
    ?friend foaf:knows ?Others .
    }
  }
LIMIT 10

## See URIBurner live results.

All friends' friends

DEFINE input:grab-all "yes"
DEFINE input:grab-depth 1
PREFIX foaf: <http://xmlns.com/foaf/0.1/>

SELECT DISTINCT ?friendsname ?friendshomepage
       ?foafsname ?foafshomepage
WHERE
  {
    {
      {
        {
          SELECT ?start ?friend
          WHERE
            {
              ?start foaf:knows ?friend .
            }
        }
        OPTION ( transitive, t_in (?start), t_out (?friend) )
        FILTER ( ?start = <http://www.w3.org/People/Berners-Lee/card> )
      }
      ?friend foaf:mbox_sha1sum ?mbox .
      ?friendsURI foaf:mbox_sha1sum ?mbox .
      ?friendsURI foaf:name ?friendsname .
      ?friendsURI foaf:homepage ?friendshomepage .
    }
    OPTIONAL {
               ?friendsURI foaf:knows ?foaf .
               ?foaf foaf:name ?foafsname .
               ?foaf foaf:homepage ?foafshomepage .
             }
  }
LIMIT 10

## See URIBurner live results.

Pragma with CONSTRUCT

DEFINE input:grab-follow-predicate <foaf:knows>
DEFINE input:grab-depth 10
PREFIX sioc: <http://rdfs.org/sioc/ns#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>

CONSTRUCT
  {
    ?s ?p ?o
  }
FROM <http://blogs.zdnet.com/semantic-web/?p=105>
WHERE
  {
    ?s ?p ?o
    FILTER REGEX( ?o, ".*Twine*" )
  }

Pragmas with FROM NAMED

DEFINE input:grab-follow-predicate <foaf:knows>
DEFINE input:grab-var "their_id"
DEFINE input:grab-depth 2
DEFINE input:grab-limit 350
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

SELECT DISTINCT ?my_id ?firstname ?Knows ?their_id
FROM NAMED <http://myopenlink.net/dataspace/person/kidehen>
WHERE
  {
    GRAPH ?g
      {
        ?my_id a foaf:Person           ;
            foaf:firstName ?firstname  ;
            foaf:knows ?their_id       .
        ?their_id foaf:nick ?Knows     .
      }
  }
LIMIT 100

## See URIBurner live results.

Pragmas: "grab-follow-predicate", "grab-var", "grab-depth" and "grab-limit"

DEFINE input:grab-var "o"
DEFINE input:grab-follow-predicate rdfs:seeAlso
DEFINE input:grab-depth 3
DEFINE input:grab-limit 50
SELECT DISTINCT *
WHERE
  {
    <http://linkeddata.uriburner.com/about/id/entity/http/www.amazon.com/o/ASIN/1591842778> rdfs:seeAlso ?o .
    ?o a <http://purl.org/goodrelations/v1#Offering> .
    ?o ?p2 ?o2
  }
LIMIT 10

## See URIBurner live results.

RDF
SPARQL
SQL
OpenLink
SIOC
WG
SPARUL
ARQ
XQuery
XPath
URI
Vocabulary
IFP
RIF
RDFS
OWL
RDBMS
ODBC
JDBC
GET
POST
QL