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"/> ...

Get Semantic Web Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.