• Aucun résultat trouvé

SPARQLBot - The Semantic Web Command Line

N/A
N/A
Protected

Academic year: 2022

Partager "SPARQLBot - The Semantic Web Command Line"

Copied!
2
0
0

Texte intégral

(1)

SPARQLBot: The Semantic Web Command Line (Scripting Challenge Submission)

Benjamin Nowack

semsol, Bielefelder Str. 5, 40468 Düsseldorf, Germany bnowack@semsol.com

Abstract. SPARQLBot is an RDF-driven agent that loads structured information from the Web and reacts to user-defined questions and commands via an IRC interface. The bot is implemented using a small number of PHP scripts and ARC, an open-source PHP/MySQL-based RDF system for storage and query functionality.

1 Motivation

SPARQLBot1 was developed during a single-day coding session to demonstrate a) the potential of tools that support structured and linked Web data, b) the developer- friendliness of SPARQL, and c) how very little custom code can be used to build useful applications. It consists of three core user interface components: An HTML- based command editor that simplifies the definition of custom bot operations, a long- running process that listens to command calls on an IRC channel2, and a standard SPARQL endpoint3 for simplified debugging of SPARQL Queries and HTTP-based data access.

2 Implementation

SPARQLBot is built on top of two open-source toolkits. For core RDF functionality (RDF storage, parsing, microformats extraction, querying, etc.), it uses ARC4, a light- weight RDF toolkit written in PHP, and the user-facing applications are implemented as Trice5 modules. Trice is a Web development framework that extends ARC with session management, HTML forms processing, IRC access, themes, and similar standard Web CMS functionality.

1 http://semsol.org/semcamp/sparqlbot, to be moved to http://sparqlbot.semsol.org/ soon

2 #sparqlbot on http://irc.freenode.net/

3 http://semsol.org/semcamp/sparqlbot/sparql, to be moved to http://sparqlbot.semsol.org/bot/sparql soon

4 http://arc.semsol.org/

5 http://trice.semsol.org/

(2)

2 Benjamin Nowack

The SPARQLBot-specific code consists of only four custom PHP Classes (~25KB / 800 LOC altogether). A generic RequestHandler dispatches HTTP requests to the three user-facing Sub-Handlers (the IRC ProcessHandler that implements the bot, a Command Editor, and the SPARQL endpoint). Only very few commands had to be built directly into the bot (e.g. "quit", or "smush"). As ARC supports LOAD, INSERT, and DELETE via SPARQL, both read and write operations can be defined using the command editor.

3 Examples: XFN Lookups

XFN6, the "Xhtml Friends Network" is a widely deployed microformat7 to specify a person's social network in XHTML pages. SPARQLBot's RDF toolkit can convert XFN markup to RDF triples and then make them accessible to SPARQL queries. The code below shows the command's essential parts which can be defined using an online form.

Command Pattern (a regular expression):

(.*)'s? (contact|friend|me)s

Triggered SPARQL Query ($i can be used for command matches):

SELECT DISTINCT ?name WHERE {

{?res foaf:nick "$1"} UNION {?res foaf:name "$1"}

?res xfn:$2 [ foaf:name ?name ] . }

Result Template ($var can be used for result bindings):

$nick, I found {$name, }

Example Conversation:

<bengee> sparqlbot, load http://twitter.com/bengee

<sparqlbot> 290 triples loaded in 4.9s seconds

<bengee> sparqlbot, smush

<sparqlbot> OK

<bengee> sparqlbot, Benjamin Nowack's contacts

<sparqlbot> bengee, I found Danny Ayers, Tom, Gregory Williams, Arto Bendiken, Paul Miller, John Breslin,Uldis Bojars, Alexandre Passant, ...

6 http://gmpg.org/xfn/

7 http://microformats.org/

Références

Documents relatifs

This command will copy directories (and all subdirectories) and/or files to new_location Note that this command can use standard wildcards Section 20.4.1 to copy multiple files..

The CCITT V.22 standard defines synchronous opera- tion at 600 and 1200 bit/so The Bell 212A standard defines synchronous operation only at 1200 bit/so Operation

strings filename | less Extract printable text strings from a binary file touch filename Create file if it does not exist, or update its timestam p rm filename Delete

So when one creates a JFrame it is automatically associated to a BorderLayout manager object, and when one creates a JPanel it is automatically

In addition, if you’ve run an interpreted program (such as a shell script), you may not be able to kill all dependent processes by killing the interpreter process that got it

(These operators work independently of SUBMIT.) For fast execution of a one line, one parameter command file or a command file without parameters, the period (.)

Notwith- standing impressive research and engineering efforts to scale up Big Data solutions the way they do, harvesting an enormous amount of homogeneous data in a single place

Given a listing of nodes cur- rently in the query (top), the user can select any node for display of its properties (bottom, left), edit any of the properties, then choose a link