HowTo: SPARQL Query for crawling Tweets

Here is a query that can be used to sponge tweets. For instance, a variation of this query (just change the target named graph in the query body) could be used to sponge tweets following Turtle Doc generation from the social media activity tracking spreadsheet.

This query also demonstrates Virtuoso’s unique ability (at the current time re RDF DBMS engines) to de-reference URI-variables as part of its SPARQL solution construction pipeline.

DEFINE get:soft "soft"
DEFINE input:grab-var "url" 

PREFIX schema: <> 
PREFIX foaf: <>
PREFIX dcterms: <> 

SELECT DISTINCT ?url ?post ?postTitle ?postComment ?date

         GRAPH <> {
                    # ?s foaf:topic ?topic.
                    ?topic schema:url ?url .}

         GRAPH ?g {
                    ?url schema:mainEntity ?post . 
                         ?post rdfs:label ?postTitle ;
                         rdfs:comment ?postComment ;
                         dcterms:created ?date . 


Query Results Screenshot

Live Query Results Example – Runs longer since sponger pragmas are enabled

Live Query Results Example – Runs quicker since pragmas are disabled