finally a bnode with a uri

Posts tagged with: semantic mashups

SPARQLScript - Semantic Mashups made easy

SPARQLScript gets loops and output templating and can now be used to build simple semantic mashups.
What is a scripting language without loops, or a Web language without a template mechanism? Not really usable. Yesterday, I finally added the two missing core features to my SPARQLScript processor, and I'm excited about eventually being able to test the whole thing. This is just the beginning (there is no string concatenation yet, and no WHILE blocks), but with the basic infrastructure (and documentation) in place, it's time to start gathering feedback. I'm going to upgrade SPARQLBot in the next couple of days which should be a fun way to explore the possibilities (also, it were the bot's users who triggered the creation of SPARQLScript in the first place).

So, what is it actually good for?

Mid-term-ish, I'm dreaming of an alternative to increasingly non-RDFy specs such as RIF and OWL2 (there is definitely some need for them, they just don't seem to really work for me and my Web stuff). Things like crawling, smushing, or custom inference tasks based on wild mixtures of RDFS, OWL, and SKOS should be doable with SPARQLScript.

Simple agents are another use case, as SPARQLScript simplifies task federation across multiple endpoints and RDF sources.

What's working already today is the creation of simple mashups and widgets. Below is a script that integrates status notices from my twitter and feeds, and then creates an HTML "lifestream" snippet. The (live!) result is embedded at the bottom of this post.
# global prefix declarations
PREFIX dc: <>
PREFIX rss: <>

# the target store

# refresh feeds every 30 minutes
$up2date = ASK FROM <script-infos> WHERE {
  <script-infos> dc:date ?date . FILTER (?date > "${NOW-30min}")
IF (!$up2date) {
  # load feeds
  LOAD <>
  LOAD <>
  # remember the update time
  INSERT INTO <script-infos> { <script-infos> dc:date "${NOW}" }

# retrieve items
$items = SELECT * WHERE {
  ?item a rss:item ;
        rss:title ?title ;
        dc:date ?date .

# output template
"""<h4>My online lifestream:</h4>
FOR ($item in $items) {
  """<li><a href="${item.item}">${item.title}</a></li>"""

(S)mashups here we come :)


No Posts found