OpenLink Billion Triple Demo queries


Text Search

Show triples containing a text pattern. The bif:search_excerpt is used to format a short excerpt of the matching literal in search-engine style

select ?s ?p ( bif:search_excerpt
              ( bif:vector ( 'WEB', 'SEMANTIC' ) , ?o ) )
where
  {
   ?s ?p ?o .
   filter ( bif:contains ( ?o, '"semantic web"' ) )
  }
limit 10

http://b3s.openlinksw.com/b3s/search.vsp?q=1

Text Search: Query Result

Text Search

Graphs With Text

What sources talk the most about a given subject? Show the top N graphs containing triples with the given text pattern. Sort by descending triple count.

select ?g count ( * )
where
  {
   graph ?g
   {
    ?s ?p ?o .
    filter ( bif:contains ( ?o, 'DAKAR AND PARIS' ) )
   }
  }
group by ?g
order by desc 2
limit 50

http://b3s.openlinksw.com/b3s/search.vsp?q=2

Graphs With Text: Query Result

Graphs With Text

Types of Things With Text

What types of objects contain a text pattern. Find matches, get the type. Group by type, order by count.

select ?tp count ( * )
where
  {
   graph ?g
   {
    ?s ?p ?o .
    ?s a ?tp filter ( bif:contains ( ?o, '"Paris Hilton"' ) )
   }
  }
group by ?tp
order by desc 2

http://b3s.openlinksw.com/b3s/search.vsp?q=3

Types of Things With Text: Query Result

Graphs With Text

People With Shared Interests

Given a person, find people with the most interests in common with this person. Show the person, number of shared interests and the total number of interests.

select ?p ?n ( ( select count ( * )
                 where
                  { ?p foaf:interest ?i .
                   ?ps foaf:interest ?i
                  }
             ) )
             ( ( select count ( * )
                 where
                  {
                   ?p foaf:interest ?i
                  }
             ) )
where
  {
   ?ps foaf:nick "aeon_phoenix"@en .
  {
   select distinct ?p ?psi
   where
   {
   ?p foaf:interest ?i .
    ?psi foaf:interest ?i
   }
  }
  .
  filter ( ?ps = ?psi ) ?p foaf:nick ?n
 }
order by desc 3
limit 50

http://b3s.openlinksw.com/b3s/search.vsp?q=8

People With Shared Interests: Query Result

People With Shared Interests

Interests Around

What else are people interested in X interested in? What else do Harry Potter fans like?

select ?i2 count ( * )
where
 {
  ?p foaf:interest <http://www.livejournal.com/interests.bml?int=harry+potter> .
  ?p foaf:interest ?i2
  }
group by ?i2
order by desc 2
limit 20

http://b3s.openlinksw.com/b3s/search.vsp?q=4

Interests Around: Query Result

Interests Around

Top 100 Authors by Text

Who writes the most about a topic. Show for each author the number of works mentioning the topic and total number of works. For all documents and posts we have extracted named entities the entity could shows the entities which occur in the works of each author.There are statistics about named entities occurring together, these are used for display a list of related entities.

select ?auth ?cnt ( ( select count ( distinct ?xx )
                      where
                      {
                       ?xx dc:creator ?auth                       }
                  ) )
where
 {
  {
   select ?auth count ( distinct ?d ) as ?cnt
   where
    {
     ?d dc:creator ?auth .
     ?d ?p ?o filter ( bif:contains ( ?o, 'WEB AND SEMANTIC' ) &&
     isIRI ( ?auth ) )
    }
   group by ?auth
   order by desc 2
   limit 100
  }
 }

http://b3s.openlinksw.com/b3s/search.vsp?q=5

Top 100 Authors by Text: Query Result

Top 100 Authors by Text

Social Connections a la LinkedIn

Show the people a person directly or indirectly knows. Sort by distance and count of connections of the known person

select ?o ?dist ( ( select count ( * )
                    where
                    {
                     ?o foaf:knows ?xx
                    }
                ) )
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://myopenlink.net/dataspace/person/kidehen#this> )
 }
order by ?dist desc 3
limit 50

http://b3s.openlinksw.com/b3s/search.vsp?q=6

Social Connections a la LinkedIn: Query Result

Social Connections a la LinkedIn

Connection Between

Given two people, find what chain of acquaintances links them together. For each step in the chain show the person linked to, the graph linking this person to the previous person, the number of the step and the number of the path. Note that there may be many paths through which the people are linked.

select ?link ?g ?step ?path
where
 {
  {
   select ?s ?o ?g
   where
    {
     graph ?g
      {
       ?s foaf:knows ?o
      }
     }
    }
  option ( transitive,
           t_distinct,
           t_in ( ?s ) ,
           t_out ( ?o ) ,
           t_no_cycles,
           T_shortest_only,
           t_step ( ?s ) as ?link,
           t_step ( 'path_id' ) as ?path,
           t_step ( 'step_no' ) as ?step,
           t_direction 3 ) .
  filter ( ?s= <http://myopenlink.net/dataspace/person/kidehen#this> &&
      ?o = <http://www.advogato.org/person/mparaz/foaf.rdf#me> )
 }
limit 20

http://b3s.openlinksw.com/b3s/search.vsp?q=7

Connection Between: Query Result

Connection Between

Cloud Around Person

Show names of things surrounding a person. These may be interests, classes of things, other people and so forth. For each label show the count of occurrences, largest count first. This uses the b3s:label superproperty which includes rdfs:label, dc:title, and other qualities which have a general meaning of label.

define input:inference 'b3s'
select ?s ?lbl count ( * )
where
 {
  ?s ?p2 ?o2 .
  ?o2 <http://b3s-demo.openlinksw.com/label> ?lbl .
  ?s foaf:nick ?o .
  filter ( bif:contains ( ?o, '"aeon_phoenix"' ) )
 }
group by ?s ?lbl
order by desc 3

http://b3s.openlinksw.com/b3s/search.vsp?q=9

Cloud Around Person: Query Result

Cloud Around Person
OpenLink
SIOC
RDF
Data Spaces
SPARQL
Query
Services
Graph
URI
Class
Container
SubClass
Entities
Web Services
Atom
SOAP
Moveable
Type
XML
RPC
FOAF
SKOS
ontology
Post
topic
tags
People
Network
Construction
Comment
CONSTRUCT
Endpoint
Data Set
Protocol
Data Web
Web Clients
URL
Social
Connections
LinkedIn
knows
Sort
distance
count
person
paths
linked
OWL
Annotea