O'Reilly logo

Semantic Web Programming by Mike Dean, Andrew Perez-Lopez, Ryan Blace, Matthew Fisher, John Hebeler

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Appendix C. SWRL

SWRL is an acronym for the Semantic Web Rule Language. This appendix presents several examples of SWRL and covers the namespaces, built-ins, and keywords in alphabetical order, which are part of the SWRL submission. In the case of keywords, a short description is given. A page number is listed if a keyword or example is described in finer detail in the book, and a reference URL is provided to obtain additional information from the W3C Submission.

SWRL Examples

Figure C-1 shows an example of deconstructed SWRL code in RDF concrete syntax. It is followed by another example in RDF concrete syntax as well as in Turtle.

A deconstructed SWRL sample in RDF concrete syntax

Figure C.1. A deconstructed SWRL sample in RDF concrete syntax

RDF concrete syntax:

<swrl:Imp rdf:about="http://www.semwebprogramming.com/dislikeRoseGrowingNeighborsRule">
  <swrl:body>
     <swrl:AtomList>
       <rdf:first>
          <rdf:Description>
           <rdf:type rdf:resource="&swrl;ClassAtom"/>
           <swrl:argument1>
             <rdf:Description rdf:about="#n"/>
           </swrl:argument1>
           <swrl:classPredicate
               rdf:resource="#Neighbor"/>
          </rdf:Description>
       </rdf:first>
       <rdf:rest>
         <swrl:AtomList>
           <rdf:first>
<rdf:Description> <rdf:type rdf:resource="&swrl;ClassAtom"/> <swrl:argument1> <rdf:Description rdf:about="#r"/> </swrl:argument1> <swrl:classPredicate rdf:resource="#Rose"/> </rdf:Description> </rdf:first> <rdf:rest> <swrl:AtomList> <rdf:first> <rdf:Description> <rdf:type rdf:resource= "&swrl;IndividualPropertyAtom"/> ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required