=Paper= {{Paper |id=Vol-368/paper-15 |storemode=property |title=Ruby Semantic Web Pipes |pdfUrl=https://ceur-ws.org/Vol-368/paper14.pdf |volume=Vol-368 }} ==Ruby Semantic Web Pipes== https://ceur-ws.org/Vol-368/paper14.pdf
                        Ruby Semantic Web Pipes
                    Semantic Web Pipes just got easier

                            Daniel Hahn2 and Michele Barbera2

                             NET7 Internet Open Solutions - Pisa
                               (hahn|barbera)@netseven.it

    Ruby SemPipes are based on the Semantic Web Pipes proposed by Giovanni
Tummarello, Christian Morbidoni et. al. [1]. Semantic web pipes provide a mech-
anism similar to Yahoo! Pipes1 , but work on semantic web data. They allow users
to filter and recombine semantic web data on the fly (more information can be
found in the cited work). The original Semantic Pipes also have some advanced
features that are not touched here, such as the revocation of triples.
    Ruby SemPipes 2 . are an intentionally simple reimplementation of the Se-
mantic Web Pipes. They provide an easy “pipe description language” . Pipes
can easily be created and modified from a script or application, the definitions
are painless to read and they don’t require the pipe developer to manually edit
XML files or SPARQL queries.
    To make things simple, Ruby SemPipes treat all RDF graphs as enumera-
tions of triples. A pipe itself is also an enumeration over it’s result set and any
enumeration of triples (including other pipes) can be used as an input for a pipe.
    Using Eyal Oren’s ActiveRDF [2] library, it will be quite easy to provide
input adapters that connect to “real” RDF endpoints and perform SPARQL
queries. These adapters could then be used as input to a pipe. Conversely, output
adapters could re-write the result of a pipe to a common storage format, such
as RDF/XML.
    The first implementation of Ruby SemPipes contains a merge, filter and
rewrite operator; a smushing operator is in the pipeline. The filter and rewrite
operators allow a simple but powerful filtering (or rewriting) of triples using
regular expression. In addition to the operators, pipes may also contain actions
which allow the developer to manipulate triples programmatically. All built-in
operators are themselves pipes written in the same way as user-created pipes.
    Each pipe takes on ore more sets of RDF triples as an input; the pipe itself
will operate on the union (including duplicates) of the input sets – the merge
operator will actually just remove duplicates from the input.

                               Listing 1.1. Sample Pipe setup
module SemPipe
 # The f i r s t p i p e
  d e f i n e _ p i p e : new_pipe do
      m e r g e d _ t r i p l e s = merge ( i n p u t )
1
    http://pipes.yahoo.com/
2
    The first experimental version is available via public svn from http://svn.talia.
    discovery-project.eu/talia-intern/playground/ruby_pipes/trunk
     # R e w r i t e Tim Berners−Lee e n t r i e s
     r e w r i t t e n _ t r i p l e s = r e w r i t e ( m e r g e d _ t r i p l e s ) do
         rewrite : all ,
         "" ,
         ""
     end

    # Remove a l l t r i p l e s d e a l i n g w i t h A l i c e
    s e l f . output = f i l t e r ( r e w r i t t e n _ t r i p l e s ) do
        r e j e c t : a l l "