<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-31416365</id><updated>2011-10-10T03:20:44.228-07:00</updated><title type='text'>Composing the Semantic Web</title><subtitle type='html'>A tool developer's blog on ontology development for the Semantic Web and beyond.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://composing-the-semantic-web.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://composing-the-semantic-web.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Holger Knublauch</name><uri>http://www.blogger.com/profile/13180242480924209321</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://www.knublauch.com/images/platypus.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>97</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-31416365.post-9038419869631938879</id><published>2011-07-05T10:57:00.000-07:00</published><updated>2011-07-05T16:48:56.442-07:00</updated><title type='text'>Validating schema.org Microdata with SPIN</title><content type='html'>&lt;div&gt;The new 3.5.1 version of &lt;a href="http://www.topquadrant.com/products/TB_Composer.html"&gt;TopBraid Composer&lt;/a&gt; introduces some initial features to import, browse, edit and analyze Microdata. I wrote about this in a &lt;a href="http://composing-the-semantic-web.blogspot.com/2011/06/microdata-and-rdfa-in-topbraid-composer.html"&gt;previous blog entry&lt;/a&gt; - if you want to try those features just download TBC's evaluation version, keeping in mind that Microdata support is still at an early stage and that, for example, the parser isn't fast yet. Today I will focus on a SPARQL-based approach for validating schema.org Microdata using &lt;a href="http://spinrdf.org/"&gt;SPIN&lt;/a&gt; inside of TopBraid.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I have published a library of SPIN constraints at &lt;a href="http://topbraid.org/spin/schemaspin"&gt;http://topbraid.org/spin/schemaspin&lt;/a&gt;. This library currently includes 11 types of integrity constraints covering various aspects on the schema.org ontology, as shown below.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/-aDh_ztZKPxw/TgwUVNLXU6I/AAAAAAAAAWU/bk1SVLpcgac/s1600/schemaspin.png" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 146px;" src="http://2.bp.blogspot.com/-aDh_ztZKPxw/TgwUVNLXU6I/AAAAAAAAAWU/bk1SVLpcgac/s400/schemaspin.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5623892389226042274" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;The most basic tests are making sure that schema.org properties can only be used at classes with matching domains, and that the values of those properties match their declared ranges. These tests alone may help you identify many potential errors at edit time. Another generic test is associated with owl:IrreflexiveProperty, making sure that a value of children, colleagues, follows, knows etc doesn't point to itself.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Other tests check for various family relationships (e.g. children must be born after their parents, children cannot contain cycles and birthDate must be before deathDate), emails must match certain regular expressions, and the ranges of longitudes and latitudes. The following TBC screenshot shows an example of an invalid longitude:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://1.bp.blogspot.com/-W8_n4UqKk9M/TgwXNMyOxeI/AAAAAAAAAWc/NC-cP_HwHfY/s1600/schemspin-TBC.png" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 278px;" src="http://1.bp.blogspot.com/-W8_n4UqKk9M/TgwXNMyOxeI/AAAAAAAAAWc/NC-cP_HwHfY/s400/schemspin-TBC.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5623895550216553954" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;A really powerful demonstration of ontology reuse and linkage is the constraint that validates currency codes. There is a finite vocabulary of those, including EUR and USD. The schemaspin ontology simply imports the &lt;a href="http://qudt.org/"&gt;QUDT&lt;/a&gt; namespace that already defines all of those abbreviations, and reports an error if an unknown currency is used on a Microdata page. The following screenshot shows the underlying SPIN constraint (note that this spin:constraint is attached to a property metaclass that marks all properties holding currencies as values):&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://3.bp.blogspot.com/-ppS6ZEcIa3E/Tg0wxLV_jkI/AAAAAAAAAWk/YO_6Is4K4-k/s1600/CurrencyConstraint.png" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 272px;" src="http://3.bp.blogspot.com/-ppS6ZEcIa3E/Tg0wxLV_jkI/AAAAAAAAAWk/YO_6Is4K4-k/s400/CurrencyConstraint.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5624205131072376386" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;The constraints above are just a beginning. Much more interesting constraints could be defined if more data is published on the Semantic Web, e.g. by asking the Sindice SPARQL end point with the SPARQL SERVICE keyword to validate that a link to a Person really describes a known http://schema.org/Person, or to compare prices to make sure that my offering of a product is currently the lowest price on the market. The open architecture of SPIN and the richness of SPARQL makes adding these and domain-specific constraints easy and enjoyable.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31416365-9038419869631938879?l=composing-the-semantic-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://composing-the-semantic-web.blogspot.com/feeds/9038419869631938879/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=31416365&amp;postID=9038419869631938879' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/9038419869631938879'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/9038419869631938879'/><link rel='alternate' type='text/html' href='http://composing-the-semantic-web.blogspot.com/2011/07/validating-schemaorg-microdata-with.html' title='Validating schema.org Microdata with SPIN'/><author><name>Holger Knublauch</name><uri>http://www.blogger.com/profile/13180242480924209321</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://www.knublauch.com/images/platypus.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/-aDh_ztZKPxw/TgwUVNLXU6I/AAAAAAAAAWU/bk1SVLpcgac/s72-c/schemaspin.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-31416365.post-3370092896227673355</id><published>2011-07-03T16:25:00.000-07:00</published><updated>2011-07-03T16:25:00.487-07:00</updated><title type='text'>SPARQL Web Pages made easy</title><content type='html'>&lt;div&gt;&lt;a href="http://uispin.org/"&gt;SPARQL Web Pages&lt;/a&gt; (SWP, aka UISPIN) is a templating language for HTML and XML formats that operate on RDF data. In a nutshell, SWP makes it possible to embed SPARQL expressions and queries directly into web page snippets, and to link an RDF or OWL ontology with such SWP snippets. SWP can also be used to generate JSON callback results to support Ajax-style patterns. This basically means that application developers can cover the whole software stack ranging from model to control to view with RDF-based representations only.&lt;/div&gt;&lt;br /&gt;&lt;div&gt;At TopQuadrant, we have meanwhile made substantial use of SPARQL Web Pages in internal and customer-facing projects, and have introduced several SWP enhancements with TopBraid 3.5. One thing that several people asked for was SWP support for stand-alone web pages that are not necessarily linked to specific classes in an ontology. In response to this, we have introduced *.swp files, which can be used like PHP or JSP documents with a TopBraid server.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;In order to create such SWP files, go to File &amp;gt; New &amp;gt; SPARQL Web Pages file. This will create a stub file with some content that will help you get started:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;a href="http://4.bp.blogspot.com/-C0tOaZmElLA/TgwGZhmf9nI/AAAAAAAAAV0/8m3-H6mPLxw/s1600/SWP-Editor.png" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 196px;" src="http://4.bp.blogspot.com/-C0tOaZmElLA/TgwGZhmf9nI/AAAAAAAAAV0/8m3-H6mPLxw/s400/SWP-Editor.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5623877070265251442" /&gt;&lt;/a&gt;Through its base platform Eclipse, TopBraid Composer includes a powerful HTML editor, and TBC 3.5.1 includes syntax highlighting for SWP built-ins (see above, you may need to associate *.swp files with the HTML content type in the Eclipse preferences as described in the TBC Help).&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;As soon as you have created this file, you can immediately execute it via the personal TopBraid Live server that is built into TopBraid Composer. Just visit http://localhost:8083/tbl/test.swp in your browser:&lt;div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;a href="http://4.bp.blogspot.com/-3OkTRIOklz0/TgwG96WqaNI/AAAAAAAAAV8/kcsBU4pD7_I/s1600/SWP-Browser.png" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 229px;" src="http://4.bp.blogspot.com/-3OkTRIOklz0/TgwG96WqaNI/AAAAAAAAAV8/kcsBU4pD7_I/s400/SWP-Browser.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5623877695385004242" /&gt;&lt;/a&gt;The example above takes one argument (test) and inserts this into the greeting. The expression {= ?test } will insert the current value of the SPARQL variable ?test into the output document. In our example, ?test is fetched from the URL arguments via the built-in function ui:param(). The demo page then creates a simple loop over all instances of kennedys:Person in the query graph and inserts them into an unordered HTML list. The actual query graph is specified using the ui:setContext tag - if this isn't present it will use the default graph.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;For a more complete live demo of SWP, visit &lt;a href="http://spinservices.org:8080/spin/doc.swp"&gt;http://spinservices.org:8080/spin/doc.swp&lt;/a&gt; providing documentation of the GoodRelations ontology:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-h3iTkzPXmLU/TgwMoQTUNcI/AAAAAAAAAWM/GaHub0CLKug/s1600/SWP-Documentation.png" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 255px;" src="http://4.bp.blogspot.com/-h3iTkzPXmLU/TgwMoQTUNcI/AAAAAAAAAWM/GaHub0CLKug/s400/SWP-Documentation.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5623883920389191106" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;For anyone with experience in hand-editing HTML and JSP or PHP, SPARQL Web Pages should look quite familiar. In fact, SWP borrows ideas from other well-known languages such as loops, assignments, if-then-else branching and user-defined tags, but is 100% SPARQL. With RDF nodes as first-class citizens, this language is IMHO an attractive alternative to projects that use RDF as their primary data representation or integration format.&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31416365-3370092896227673355?l=composing-the-semantic-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://composing-the-semantic-web.blogspot.com/feeds/3370092896227673355/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=31416365&amp;postID=3370092896227673355' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/3370092896227673355'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/3370092896227673355'/><link rel='alternate' type='text/html' href='http://composing-the-semantic-web.blogspot.com/2011/07/sparql-web-pages-made-easy.html' title='SPARQL Web Pages made easy'/><author><name>Holger Knublauch</name><uri>http://www.blogger.com/profile/13180242480924209321</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://www.knublauch.com/images/platypus.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/-C0tOaZmElLA/TgwGZhmf9nI/AAAAAAAAAV0/8m3-H6mPLxw/s72-c/SWP-Editor.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-31416365.post-4077999698250318730</id><published>2011-06-09T00:24:00.000-07:00</published><updated>2011-06-09T02:40:19.834-07:00</updated><title type='text'>Microdata and RDFa in TopBraid Composer</title><content type='html'>&lt;div&gt;The next release of &lt;a href="http://www.topquadrant.com/products/TB_Composer.html"&gt;TopBraid Composer&lt;/a&gt; will include comprehensive support for editing and processing &lt;a href="http://schema.org/"&gt;schema.org&lt;/a&gt; &lt;a href="http://www.w3.org/TR/microdata/"&gt;Microdata&lt;/a&gt;, and will also have improved support for &lt;a href="http://en.wikipedia.org/wiki/RDFa"&gt;RDFa&lt;/a&gt;. TopBraid is an extension of Eclipse and thus inherits a lot of goodness from the platform, including a very nice HTML editor. It was straight-forward and highly desirable to extend TopBraid with native support for those Web Data formats. Here is a preview of what it will look like.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;Working with Microdata and RDFa&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;When I started exploring Microdata for &lt;a href="http://knublauch.com/"&gt;my own web site&lt;/a&gt;, I created a new Eclipse project within TopBraid Composer containing the HTML, CSS and image files for the site. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;a href="http://3.bp.blogspot.com/-oETySpvzyuc/TfCGeFLc01I/AAAAAAAAAVE/bRWdY5dYUQE/s1600/TBC-Navigator.png" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 210px; height: 243px;" src="http://3.bp.blogspot.com/-oETySpvzyuc/TfCGeFLc01I/AAAAAAAAAVE/bRWdY5dYUQE/s400/TBC-Navigator.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5616136586675409746" /&gt;&lt;/a&gt;&lt;div&gt;While I was adding the Microdata tags to the HTML documents, I quickly discovered that RDF based tooling can be extremely helpful to make sure that the published metadata is consistent and of good quality. For example, data about entities (such as the http://schema.org/Person about myself) is split across multiple HTML pages: the &lt;a href="http://knublauch.com/"&gt;front page&lt;/a&gt; contains my address, but my &lt;a href="http://knublauch.com/personal.html"&gt;personal page&lt;/a&gt; contains information about my children. In such cases it is important that both pages use the same identifiers for the same Linked Data entities. This becomes even more important if we want to link to external standard vocabularies, such as ontologies about units, countries or product categories.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;b&gt;Linked Web Data is much more useful than isolated data snippets on individual pages.&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;As a result of this, I introduced the notion of Web Data Sites into TopBraid Composer - collections of pages in the same folder and its sub-folders. Right click on the project above and select New &amp;gt; Microdata Site File (or RDFa Site File). This opens a wizard with an option for default ontologies to include. For Microdata this is obviously the schema.org namespace, but any other RDF vocabulary can be added later:&lt;/div&gt;&lt;a href="http://1.bp.blogspot.com/-8bP9eaxWZYo/TfCHPngcb9I/AAAAAAAAAVM/YKfvXMf9lHE/s1600/NewMicrodataSite.png" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 284px;" src="http://1.bp.blogspot.com/-8bP9eaxWZYo/TfCHPngcb9I/AAAAAAAAAVM/YKfvXMf9lHE/s400/NewMicrodataSite.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5616137437703860178" /&gt;&lt;/a&gt;This creates a site file (*.mds) that acts as a placeholder for all RDF triples on the HTML pages within the same folder and its subfolders. The site file can be opened like any other RDF data source, it can be imported into other data models, etc. When opened, it will scan the HTML files and always automatically stay up to date when the data on the HTML is changed.&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The screenshot below (click on the image for the full size) shows some of the new TBC capabilities in practice.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;a href="http://3.bp.blogspot.com/-gE-RKRvoyRg/TfB7tcaXmxI/AAAAAAAAAU8/a8Zy-6oX_M0/s1600/TopBraidComposer-Microdata.png" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 225px;" src="http://3.bp.blogspot.com/-gE-RKRvoyRg/TfB7tcaXmxI/AAAAAAAAAU8/a8Zy-6oX_M0/s400/TopBraidComposer-Microdata.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5616124755982129938" /&gt;&lt;/a&gt;You can see that TopBraid has built-in views to browse the class hierarchy, properties and instances. These are powerful mechanisms to navigate through the data space that is encoded in the HTML pages. In the example above, you can see that my current Microdata pages contain information about three Persons, as well as various address and location objects. The class tree shows the number of instances of each class. A double-click on an instance will display it on a form. You can see the form view of the resource http://knublauch.com (representing myself as a schema:Person) on the right. Here is a larger view, with the details of one of the children objects opened up:&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;a href="http://3.bp.blogspot.com/-tDZKa3I2GM4/TfCJV7shOhI/AAAAAAAAAVU/weLyVNnTNIM/s1600/TBC-Form.png" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 382px; height: 344px;" src="http://3.bp.blogspot.com/-tDZKa3I2GM4/TfCJV7shOhI/AAAAAAAAAVU/weLyVNnTNIM/s400/TBC-Form.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5616139745225685522" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div&gt;Alternative views such as graphs and smart browser displays are also built-in. Here is a TBC graph view of some instances:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;a href="http://3.bp.blogspot.com/-QQ9Bd1klO-8/TfCJ8QkbOYI/AAAAAAAAAVc/HSCSFnkuG_o/s1600/TBC-Graph.png" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 144px;" src="http://3.bp.blogspot.com/-QQ9Bd1klO-8/TfCJ8QkbOYI/AAAAAAAAAVc/HSCSFnkuG_o/s400/TBC-Graph.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5616140403663911298" /&gt;&lt;/a&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;div&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;Analyzing Web Data with SPARQL and SPIN&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;You can also run SPARQL queries over this data:&lt;div&gt;&lt;br /&gt;&lt;div&gt;&lt;a href="http://1.bp.blogspot.com/-Oi7mKoDaOeo/TfCKmbZJpNI/AAAAAAAAAVk/KOHWGzI1iJ0/s1600/TBC-SPARQLView.png" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 230px;" src="http://1.bp.blogspot.com/-Oi7mKoDaOeo/TfCKmbZJpNI/AAAAAAAAAVk/KOHWGzI1iJ0/s400/TBC-SPARQLView.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5616141128123917522" /&gt;&lt;/a&gt;&lt;div&gt;We have a lot of &lt;a href="http://spinrdf.org/spinstack.html"&gt;SPARQL-based features&lt;/a&gt; built into the TopBraid platform, including the rule and constraint language &lt;a href="http://spinrdf.org/"&gt;SPIN&lt;/a&gt; (now a W3C Member Submission). SPIN is useful to define model-based integrity constraints, and I have started to create a SPIN constraints library for the schema.org namespace. Currently this checks that the value type of properties on the HTML pages matches the range defined by the ontology, but more checks will be added, for example regular expressions of emails, country abbreviations etc. More on this in a separate entry some day.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;Editing Microdata and RDFa&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Once you have checked constraints and the system reports a violation, you can navigate to the source of the violation on the form of the relevant instance. From those forms, you simply need to double-click on the icon to the left of the value to navigate to the HTML source code:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;a href="http://3.bp.blogspot.com/-uyUGZvTljd8/TfCMl6GpQMI/AAAAAAAAAVs/WSc1LCmvXB0/s1600/Screen%2Bshot%2B2011-06-09%2Bat%2B7.03.42%2BPM.png" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 163px;" src="http://3.bp.blogspot.com/-uyUGZvTljd8/TfCMl6GpQMI/AAAAAAAAAVs/WSc1LCmvXB0/s400/Screen%2Bshot%2B2011-06-09%2Bat%2B7.03.42%2BPM.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5616143318211182786" /&gt;&lt;/a&gt;At this stage, the circle is completed and are in HTML document where you can fix problems (e.g. a misspelled email address). Save the HTML file, and the RDF triple (on the form and elsewhere) will update automatically.&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The HTML editor in TopBraid Composer has been enhanced with syntax highlighting for the Microdata attributes such as itemprop. And more is on its way...&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;Harvesting Microdata and RDFa from the web&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;In addition to editing and processing local Web Data files, TopBraid can also be used to work with external mark-up from existing pages. TBC Version 3.5 had already introduced the &lt;a href="http://composing-the-semantic-web.blogspot.com/2011/04/topbraid-composers-web-data-basket.html"&gt;Web Data Basket&lt;/a&gt;, and we have extended this to also support Microdata. The mechanism is simple yet powerful: you install a small Firefox extension that will send the pages you visit to your locally running TopBraid Composer. This will collect all RDF metadata contained on the visited pages, and make it available to the RDF, OWL and SPARQL machinery of TBC. This means you can simply browse the web and you will automatically get the stream of RDF triples into your working environment.&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31416365-4077999698250318730?l=composing-the-semantic-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://composing-the-semantic-web.blogspot.com/feeds/4077999698250318730/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=31416365&amp;postID=4077999698250318730' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/4077999698250318730'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/4077999698250318730'/><link rel='alternate' type='text/html' href='http://composing-the-semantic-web.blogspot.com/2011/06/microdata-and-rdfa-in-topbraid-composer.html' title='Microdata and RDFa in TopBraid Composer'/><author><name>Holger Knublauch</name><uri>http://www.blogger.com/profile/13180242480924209321</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://www.knublauch.com/images/platypus.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-oETySpvzyuc/TfCGeFLc01I/AAAAAAAAAVE/bRWdY5dYUQE/s72-c/TBC-Navigator.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-31416365.post-7713700203642386436</id><published>2011-04-26T22:41:00.000-07:00</published><updated>2011-06-02T19:57:44.051-07:00</updated><title type='text'>Faceted Search with TopBraid and SWP</title><content type='html'>Many Semantic Technology companies offer some kind of faceted browsing tool. With &lt;a href="http://www.topquadrant.com/products/release_notes/v3_5.html"&gt;TopBraid 3.5&lt;/a&gt; it was time for TopQuadrant to say "me too", and add some unique capabilities into the mix.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The main idea of faceted browsing is to allow users to narrow down a set of objects by selecting properties that the sought-after objects must possess. For example, if you search for people in the infamous &lt;a href="http://topbraid.org/examples/kennedys"&gt;Kennedy ontology&lt;/a&gt;, you may want to find all instances of Person that went to the same university and share the same profession. TopBraid's faceted search component follows a user interface paradigm made popular by &lt;a href="http://www.freebase.com/labs/parallax/"&gt;FreeBase Parallax&lt;/a&gt;: you start with a set of all Persons and the system will compute how many matches are in each category. Clicking on a category will narrow down the set, and you can add the next condition. The following screenshot illustrates this, with the facet "alma mater" narrowed down to "Harvard University".&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;a href="http://2.bp.blogspot.com/-1s4WBqfAtHQ/Tbeuvk_-L6I/AAAAAAAAAUg/JUIBpZb9Ruc/s1600/Facets-1.png" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 275px;" src="http://2.bp.blogspot.com/-1s4WBqfAtHQ/Tbeuvk_-L6I/AAAAAAAAAUg/JUIBpZb9Ruc/s400/Facets-1.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5600136794067578786" /&gt;&lt;/a&gt;TopBraid's faceted search is implemented by a collection of TopBraid Live servlets and a JavaScript UI library. What you see on the screen above is in fact a web browser embedded into TopBraid Composer. The default stylesheet is simple and can be customized, and it's also possible to use the same JavaScript library in completely different web applications.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;One distinguishing capability of TopBraid's Faceted Search support is its customizability. &lt;a href="http://uispin.org/"&gt;SPARQL Web Pages (SWP)&lt;/a&gt; technology can be used to customize the visual appearance of the preview results on the right hand side. A key benefit of SWP is the linkage between ontologies and user interface snippets. Basically, SWP allows you to attach HTML snippets to any RDFS or OWL class in your domain model using the property ui:instanceView, and the system is then able to dynamically select the best suitable visualization for any object that it gets. For example, the visualization for kennedys:Person can be changed as shown below.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;a href="http://3.bp.blogspot.com/-nlUiK1vzIH0/Tbe3UP89wrI/AAAAAAAAAUo/Ti99-I2Q9GA/s1600/Facets-2.png" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 147px;" src="http://3.bp.blogspot.com/-nlUiK1vzIH0/Tbe3UP89wrI/AAAAAAAAAUo/Ti99-I2Q9GA/s400/Facets-2.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5600146220166005426" /&gt;&lt;/a&gt;The faceted search component looks for visualizations marked with ui:id="facetSummary", and will display them as shown below.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;a href="http://1.bp.blogspot.com/-AhVfCFPV0H8/Tbe3tHw_DhI/AAAAAAAAAUw/xaZmImCBctw/s1600/Facets-3.png" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 199px;" src="http://1.bp.blogspot.com/-AhVfCFPV0H8/Tbe3tHw_DhI/AAAAAAAAAUw/xaZmImCBctw/s400/Facets-3.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5600146647465004562" /&gt;&lt;/a&gt;Further customizations are possible without any programming: For example you can specify which properties shall be visible by default, and which properties shall not be selectable as facets.&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;There is more to be said about this new capability. But if you just want to get started, use TBC-ME 3.5, select the class that you want to search instances of, switch to the Browser tab and pick the facet.ui:SearchView view in the drop down list. Note that on Windows this currently does not work because Eclipse includes an outdated internal web browser. Please use the button &lt;b&gt;Open current page in external browser. &lt;/b&gt;Like with any new feature, we appreciate your feedback.&lt;div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31416365-7713700203642386436?l=composing-the-semantic-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://composing-the-semantic-web.blogspot.com/feeds/7713700203642386436/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=31416365&amp;postID=7713700203642386436' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/7713700203642386436'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/7713700203642386436'/><link rel='alternate' type='text/html' href='http://composing-the-semantic-web.blogspot.com/2011/04/faceted-search-with-topbraid-and-swp.html' title='Faceted Search with TopBraid and SWP'/><author><name>Holger Knublauch</name><uri>http://www.blogger.com/profile/13180242480924209321</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://www.knublauch.com/images/platypus.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/-1s4WBqfAtHQ/Tbeuvk_-L6I/AAAAAAAAAUg/JUIBpZb9Ruc/s72-c/Facets-1.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-31416365.post-8020087265216022601</id><published>2011-04-26T22:10:00.000-07:00</published><updated>2011-04-26T22:34:54.433-07:00</updated><title type='text'>TopBraid Composer's Web Data Basket: Collecting Linked Data while you browse</title><content type='html'>One of the little new features in &lt;a href="http://www.topquadrant.com/products/release_notes/v3_5.html"&gt;TopBraid Composer 3.5&lt;/a&gt; is the &lt;b&gt;Web Data Basket&lt;/b&gt; view. This can be used to incrementally download Linked Data (either RDFa or RDF) while browsing the web. The best way to experience this is by getting a small &lt;a href="http://topbraid.org/mozilla"&gt;TBC Firefox extension&lt;/a&gt;. This will add a tiny TopBraid button to the lower right corner of your browser.&lt;div&gt;&lt;div&gt;&lt;a href="http://4.bp.blogspot.com/-blZitwP4Nc4/Tben-luAe8I/AAAAAAAAAUI/n1YqV02qRVI/s1600/WebDataBasket-1.png" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 247px;" src="http://4.bp.blogspot.com/-blZitwP4Nc4/Tben-luAe8I/AAAAAAAAAUI/n1YqV02qRVI/s400/WebDataBasket-1.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5600129355377310658" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;Click on this button while TopBraid Composer is executing, and all RDF data encoded on the currently visited page will be added to TBC's Web Data Basket:&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;a href="http://3.bp.blogspot.com/-jz7M5C9NBrs/TbeoPzfWOOI/AAAAAAAAAUQ/nhTQ2utHGOM/s1600/WebDataBasket-2.png" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 129px;" src="http://3.bp.blogspot.com/-jz7M5C9NBrs/TbeoPzfWOOI/AAAAAAAAAUQ/nhTQ2utHGOM/s400/WebDataBasket-2.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5600129651131693282" /&gt;&lt;/a&gt;While this Basket displays the raw triples, it also has options to add the loaded triples into the current model. For example, you will get a proper foaf:Person for David Bowie if you visit his DBpedia page:&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;a href="http://4.bp.blogspot.com/-1NCTTBduej0/TbepGf4xkXI/AAAAAAAAAUY/9x4f0EXQquI/s1600/WebDataBasket-3.png" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 229px;" src="http://4.bp.blogspot.com/-1NCTTBduej0/TbepGf4xkXI/AAAAAAAAAUY/9x4f0EXQquI/s400/WebDataBasket-3.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5600130590762439026" /&gt;&lt;/a&gt;In order to facilitate the use of this data, TopBraid Composer will automatically add missing imports to namespaces such as foaf and skos. When you follow a hyperlink in your web browser, the basket will get more content. This means that the system will accumulate any Linked Data into TopBraid as you navigate through the web.&lt;div&gt;&lt;div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;This little Web Data Basket makes it easy to collect Linked Data without having to leave your favorite tools. I think it provides a fine example of how Linked Data could be used, e.g. to build up a shopping list of products backed with &lt;a href="http://www.heppnetz.de/projects/goodrelations/"&gt;GoodRelations&lt;/a&gt; data.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31416365-8020087265216022601?l=composing-the-semantic-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://composing-the-semantic-web.blogspot.com/feeds/8020087265216022601/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=31416365&amp;postID=8020087265216022601' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/8020087265216022601'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/8020087265216022601'/><link rel='alternate' type='text/html' href='http://composing-the-semantic-web.blogspot.com/2011/04/topbraid-composers-web-data-basket.html' title='TopBraid Composer&apos;s Web Data Basket: Collecting Linked Data while you browse'/><author><name>Holger Knublauch</name><uri>http://www.blogger.com/profile/13180242480924209321</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://www.knublauch.com/images/platypus.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/-blZitwP4Nc4/Tben-luAe8I/AAAAAAAAAUI/n1YqV02qRVI/s72-c/WebDataBasket-1.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-31416365.post-2278097142381523869</id><published>2011-04-21T16:28:00.000-07:00</published><updated>2011-04-21T17:18:16.728-07:00</updated><title type='text'>SPINMap: SPARQL-based Ontology Mapping with a Graphical Notation</title><content type='html'>One of the new features in the upcoming TopBraid 3.5 release is called SPINMap. &lt;b&gt;SPINMap&lt;/b&gt; is a SPARQL-based language to represent mappings between RDF/OWL ontologies. These mappings can be used to transform instances of source classes into instances of target classes. This is a very common requirement to create Linked Data, for example starting with spreadsheets, XML files or databases, but also from one domain-specific ontology into a more generic one. As a first impression, here is a picture of SPINMap in action:&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;a href="http://3.bp.blogspot.com/-eTaalBUwLCo/TbDCzFzEorI/AAAAAAAAASo/YSEycx_Gi80/s1600/Screen%2Bshot%2B2011-04-21%2Bat%2B4.04.05%2BPM.png" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 260px;" src="http://3.bp.blogspot.com/-eTaalBUwLCo/TbDCzFzEorI/AAAAAAAAASo/YSEycx_Gi80/s400/Screen%2Bshot%2B2011-04-21%2Bat%2B4.04.05%2BPM.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5598188519807034034" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div&gt;&lt;div&gt;If you would like to learn about this with a visual demo, please take a look at the&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;b&gt;&lt;a href="http://vimeo.com/22695742"&gt;SPINMap Tutorial Video&lt;/a&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;In the rest of this blog entry I will cover similar content to the video, but with screenshots and prose.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Introduction to SPINMap&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;SPARQL is a rich language that can be used for many purposes. The SPARQL CONSTRUCT keyword is particularly useful to define rules that map from one graph pattern (in the WHERE clause) to another graph pattern. This makes it possible to define sophisticated rules that map instances from one class to instances of another one.&lt;/div&gt;&lt;br /&gt;&lt;div&gt;The &lt;a href="http://www.w3.org/Submission/spin-overview/"&gt;SPIN framework&lt;/a&gt; provides several mechanisms that make the definition of such SPARQL-based mapping rules easier.  In particular, SPIN makes it easy to associate mapping rules with classes, and SPIN templates and functions can be exploited to define reusable building blocks for typical modeling patterns.&lt;/div&gt;&lt;br /&gt;&lt;div&gt;The SPINMap vocabulary (http://spinrdf.org/spinmap) is a collection of reusable design patterns that reflects typical best practices in ontology mapping. SPINMap models can be executed in conjunction with other SPARQL rules with any SPIN engine.  The main advantage of SPINMap is that it provides a higher-level language that is suitable to be edited graphically.  TopBraid Composer 3.5 provides a visual editor that makes it easy to establish ontology mappings using drag and drop, and filling in forms.&lt;/div&gt;&lt;br /&gt;&lt;div&gt;It is a good practice to store the ontology mapping rules in files separate from the source and target files.  The mapping file only needs to import the SPINMap namespace (which in turn imports SPIN etc).  The easiest way to get started is to use &lt;b&gt;File &amp;gt; New &amp;gt; RDF/OWL/SPIN File...&lt;/b&gt; and then to activate the check box for "SPINMap Ontology Mapping Vocabulary", as shown below.&lt;/div&gt;&lt;a href="http://4.bp.blogspot.com/-32dRmsiJ6-4/TbDDq2ZyFoI/AAAAAAAAAS4/Es2Ld513wxM/s1600/SPINMap-CreateFile.png" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 383px;" src="http://4.bp.blogspot.com/-32dRmsiJ6-4/TbDDq2ZyFoI/AAAAAAAAAS4/Es2Ld513wxM/s400/SPINMap-CreateFile.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5598189477747103362" /&gt;&lt;/a&gt;&lt;div&gt;This will create an empty file importing &lt;code&gt;http://topbraid.org/spin/spinmapl&lt;/code&gt;. As a next step, you should drag the source and target ontologies into the Imports view so that those get imported into the mapping ontology.  Then select the class you want to start mapping, and switch to the Diagram tab.  In the example below, the source ontology A defines a class &lt;code&gt;a:Person&lt;/code&gt;, and we want to map it into the target class &lt;code&gt;b:Customer&lt;/code&gt;.&lt;/div&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/-0QpBzi7RYSA/TbDDVfm7fHI/AAAAAAAAASw/kK0th9gtBSc/s1600/SPINMap-1.png" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 258px;" src="http://3.bp.blogspot.com/-0QpBzi7RYSA/TbDDVfm7fHI/AAAAAAAAASw/kK0th9gtBSc/s400/SPINMap-1.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5598189110850976882" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div&gt;Use drag and drop (e.g. from the Classes view) to add other classes to the Diagram. If the SPINMap namespace is present, the Diagram will provide additional capabilities and use a different layout algorithm than usual. If you move the mouse over a class, a triangular anchor point will appear in the upper right corner of the class box.  It will turn green if you move the mouse over it, and if it can be made the source of a mapping. Click on this and keep the mouse button pressed to establish a link to another class. Move the mouse over the incoming upper anchor of the target class and release the mouse.  A dialog like the one below will appear.&lt;/div&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/-nm0vOiCps-4/TbDD5bocARI/AAAAAAAAATA/KAs_es3pg3c/s1600/SPINMap-2.png" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 298px;" src="http://4.bp.blogspot.com/-nm0vOiCps-4/TbDD5bocARI/AAAAAAAAATA/KAs_es3pg3c/s400/SPINMap-2.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5598189728258851090" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div&gt;This dialog is used to create a "mapping context" that is later used to determine how the target instances shall be selected from the source instances.  In particular this is used to construct URIs from the values of a given resource, e.g. so that &lt;code&gt;a:Instance-0-1&lt;/code&gt; is turned into &lt;code&gt;b:John-Smith&lt;/code&gt;. The dialog provides a collection of target functions that can be used for that purpose.  You simply need to pick an appropriate function and fill in the blanks to establish a mapping context.  In the example screenshot, a new URI is constructed from the values of the source properties &lt;code&gt;a:firstName&lt;/code&gt; and &lt;code&gt;a:lastName&lt;/code&gt; and a provided URI template. This assumes that those properties together serve as unique identifiers, similar to primary keys in a database.  Other algorithms can be created if needed through SPIN functions.&lt;/div&gt;&lt;br /&gt;&lt;div&gt;As soon as you have filled in all required arguments of the mapping context function, the preview panel of the dialog will give you an idea of how the resulting values will look like.  When you are happy with this, press OK.&lt;/div&gt;&lt;br /&gt;&lt;div&gt;The resulting context will be displayed with a yellow graph node as shown below.&lt;/div&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/-UATR_vyL1Hg/TbDEEZEnyoI/AAAAAAAAATI/cepW0nytZ2c/s1600/SPINMap-3.png" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 134px;" src="http://3.bp.blogspot.com/-UATR_vyL1Hg/TbDEEZEnyoI/AAAAAAAAATI/cepW0nytZ2c/s400/SPINMap-3.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5598189916550318722" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div&gt;If you ever need to edit this context node again, e.g. to change the URI template, just double-click on it.  Right-clicking the node opens a context menu with an option to delete it.&lt;/div&gt;&lt;br /&gt;&lt;div&gt;Once a context has been established between two classes, the user interface makes it possible to add transformations.   In the example above, the source class has a property &lt;code&gt;a:dob&lt;/code&gt; that holds date of birth values as raw strings, such as "30/04/1985".  We want to map this into the target property &lt;code&gt;b:birthDate&lt;/code&gt;, which is a well-formed   &lt;code&gt;xsd:date&lt;/code&gt; in the format "1985-04-30".  TopBraid's SPARQL library provides a built-in function &lt;code&gt;spif:parseDate&lt;/code&gt; to make this task easier. Use the mouse to draw a connection from &lt;code&gt;a:dob&lt;/code&gt; to &lt;code&gt;b:birthDate&lt;/code&gt;. A dialog such as the following will appear.&lt;/div&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/-ueuIx5npkVg/TbDERZgwKdI/AAAAAAAAATQ/mchHGHdr_yY/s1600/SPINMap-3.5.png" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 310px;" src="http://4.bp.blogspot.com/-ueuIx5npkVg/TbDERZgwKdI/AAAAAAAAATQ/mchHGHdr_yY/s400/SPINMap-3.5.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5598190140006607314" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div&gt;In this dialog you can either manually select a transformation function, or check if the system has any suggestions for you, on the Suggestions tab. In this case, the system suggests &lt;code&gt;spif:parseDate&lt;/code&gt; with pre-defined patterns to convert raw dates into valid &lt;code&gt;xsd:date&lt;/code&gt; literals. Pressing OK, this creates a mapping transformation as shown below.&lt;/div&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/-lFhHz7nE_NY/TbDEcQTMKiI/AAAAAAAAATY/hw2zvsKY6rE/s1600/SPINMap-4.png" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 135px;" src="http://4.bp.blogspot.com/-lFhHz7nE_NY/TbDEcQTMKiI/AAAAAAAAATY/hw2zvsKY6rE/s400/SPINMap-4.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5598190326512364066" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div&gt;At any point in time, TopBraid Composer makes it easy to try the mapping out. Assuming TopSPIN is the selected inference engine, just press the &lt;b&gt;Run Inferences&lt;/b&gt; button in the main tool bar to see the results.&lt;/div&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/-b9AlVSSACs4/TbDElG5njoI/AAAAAAAAATg/7ionQjhn6AA/s1600/SPINMap-5.png" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 100px;" src="http://2.bp.blogspot.com/-b9AlVSSACs4/TbDElG5njoI/AAAAAAAAATg/7ionQjhn6AA/s400/SPINMap-5.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5598190478608010882" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div&gt;As you can see above, each instance of the &lt;code&gt;a:Person&lt;/code&gt; class has been mapped into a corresponding instance of &lt;code&gt;b:Customer&lt;/code&gt;. The URI of the target resources has been generated using the string insertion  template based on first name and last name.  Furthermore, proper birth dates have been generated from the raw source strings.   The context menu of the Inferences view provides options to assert the resulting RDF triples if desired, or you can use the Triples View to move them elsewhere.&lt;/div&gt;&lt;br /&gt;&lt;div&gt;It is possible to add any number of other transformations in similar ways. Some transformations take more than one argument.  In that case, additional input anchor points will be displayed, as shown for the node "concat with separator" below.&lt;/div&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/-_zr8c8G_jps/TbDEu_vKCDI/AAAAAAAAATo/olv2Mk06jLc/s1600/SPINMap-6.png" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 193px;" src="http://4.bp.blogspot.com/-_zr8c8G_jps/TbDEu_vKCDI/AAAAAAAAATo/olv2Mk06jLc/s400/SPINMap-6.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5598190648483776562" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Note that a complex example like above uses a number of different design patterns. Some additional of those patterns are explained in the &lt;b&gt;&lt;a href="http://vimeo.com/22695742"&gt;tutorial video&lt;/a&gt;&lt;/b&gt;, that I would strongly recommend if you want to save time with this technology.&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;b&gt;Understanding and Extending SPINMap&lt;/b&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;The mini tutorial above might be enough for many users to get started. For advanced users with knowledge of SPIN, the following background may be helpful to understand how SPINMap works, and how it can be extended.&lt;/div&gt;&lt;br /&gt;&lt;div&gt;SPINMap is an entirely declarative application of SPIN.  This means you can explore the mappings generated by the visual editor from an RDF perspective, e.g. using TBC forms.  In the example above, the form for &lt;code&gt;a:Person&lt;/code&gt; displays a collection of SPIN Template calls:&lt;/div&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/-30wBLjkYLIk/TbDGmWcpZDI/AAAAAAAAATw/kRJg5voTrL0/s1600/SPINMap-7.png" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 117px;" src="http://1.bp.blogspot.com/-30wBLjkYLIk/TbDGmWcpZDI/AAAAAAAAATw/kRJg5voTrL0/s400/SPINMap-7.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5598192698984588338" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div&gt;You can drill into the templates by opening up the + sign that appears when you hover the mouse over the template icon.&lt;/div&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/-q8yfiWIKbFI/TbDGvdjEnuI/AAAAAAAAAT4/BQzYCJXCluY/s1600/SPINMap-8.png" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 225px;" src="http://4.bp.blogspot.com/-q8yfiWIKbFI/TbDGvdjEnuI/AAAAAAAAAT4/BQzYCJXCluY/s400/SPINMap-8.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5598192855509409506" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div&gt;The example above illustrates that SPINMap is based on a (small) collection of generic templates, such as &lt;code&gt;spinmap:Mapping-2-1&lt;/code&gt; which represents a mapping from 2 source properties into 1 target property. Each of those templates a linked to a &lt;code&gt;spinmap:Context&lt;/code&gt; which is used at execution time to determine the target URIs.   Furthermore, the argument &lt;code&gt;spinmap:expression&lt;/code&gt; points to a SPARQL expression, SELECT or ASK query, or even a constant URI or literal that is used to compute the target value from the source value(s). The SPINMap templates are using the function &lt;code&gt;spin:eval&lt;/code&gt;to evaluate those expressions at execution time. When executed, the expression will be invoked with pre-assigned values for &lt;code&gt;?arg1&lt;/code&gt;, &lt;code&gt;?arg2&lt;/code&gt; etc, based on the current values of &lt;code&gt;spinmap:sourcePredicate1&lt;/code&gt; on the source instances.&lt;/div&gt;&lt;br /&gt;&lt;div&gt;Since in practice any SPARQL function can be used as &lt;code&gt;spinmap:expression&lt;/code&gt;, users can also add their own SPIN functions where appropriate.  It is also possible to use the built-in SPARQL functions such as &lt;code&gt;xsd:string()&lt;/code&gt;.&lt;/div&gt;&lt;div&gt;The mapping context uses a similar mechanism, also based on &lt;code&gt;spin:eval&lt;/code&gt; to create target URIs.  You can open any instance of &lt;code&gt;spinmap:Context&lt;/code&gt; to see how this is done.&lt;/div&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/-wQgKRLbCU7w/TbDG5K2gtVI/AAAAAAAAAUA/kRxu4KO3FQw/s1600/SPINMap-9.png" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 297px;" src="http://3.bp.blogspot.com/-wQgKRLbCU7w/TbDG5K2gtVI/AAAAAAAAAUA/kRxu4KO3FQw/s400/SPINMap-9.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5598193022289360210" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;div&gt;In the example above, the target function &lt;code&gt;spinmapl:buildURI2&lt;/code&gt; is used to derive a new URI from two input properties and a template. You are free to define your own target functions there, as long as they are instances of &lt;code&gt;spinmap:TargetFunction&lt;/code&gt; (and subclass of &lt;code&gt;spinmap:TargetFunctions&lt;/code&gt;).&lt;/div&gt;&lt;br /&gt;&lt;div&gt;If you are writing your own functions, or want to make the system smarter, you can add your own &lt;code&gt;spinmap:suggestionXY&lt;/code&gt; values to the functions. These are SPARQL CONSTRUCT queries that may construct zero or more instances of the function, with partially filled in fields, as well as a &lt;code&gt;spinmap:suggestionScore&lt;/code&gt;.  See the function &lt;code&gt;spif:parseDate&lt;/code&gt; for an example of what can be done with this mechanism.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31416365-2278097142381523869?l=composing-the-semantic-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://composing-the-semantic-web.blogspot.com/feeds/2278097142381523869/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=31416365&amp;postID=2278097142381523869' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/2278097142381523869'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/2278097142381523869'/><link rel='alternate' type='text/html' href='http://composing-the-semantic-web.blogspot.com/2011/04/spinmap-sparql-based-ontology-mapping.html' title='SPINMap: SPARQL-based Ontology Mapping with a Graphical Notation'/><author><name>Holger Knublauch</name><uri>http://www.blogger.com/profile/13180242480924209321</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://www.knublauch.com/images/platypus.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-eTaalBUwLCo/TbDCzFzEorI/AAAAAAAAASo/YSEycx_Gi80/s72-c/Screen%2Bshot%2B2011-04-21%2Bat%2B4.04.05%2BPM.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-31416365.post-3646592088176896829</id><published>2011-04-04T17:12:00.000-07:00</published><updated>2011-04-04T17:47:29.612-07:00</updated><title type='text'>SPIN is a W3C Member Submission</title><content type='html'>The SPARQL Rules language &lt;a href="http://spinrdf.org/"&gt;&lt;b&gt;SPIN&lt;/b&gt;&lt;/a&gt; has evolved over the last couple of years as an integral part of TopQuadrant's TopBraid Suite. SPIN started during a discussion between Dean Allemang and myself, in which we brainstormed about having an RDF syntax for SPARQL. I went ahead and implemented this based on Jena's ARQ API, and the result eventually became the &lt;a href="http://www.w3.org/Submission/spin-sparql/"&gt;SPIN RDF Syntax&lt;/a&gt;. This was no rocket science, because similar ideas of representing higher level languages by means of RDF blank node structures had been explored by OWL and SWRL.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Prior to our work on SPIN, we had already experimented with various mechanisms to link SPARQL queries with RDF data structures, so that they could be shared as query libraries. TopBraid veterans may remember the sparql:query property that was introduced to store SPARQL queries (as strings) together with RDF models. So while I was working on the SPIN RDF Syntax, I noticed that we now have a much better way of achieving this goal. A quick cross-reference to object-oriented languages led to me select properties such as spin:rule and spin:constraint to point from a class to a SPARQL query, expressed in RDF. This later became the &lt;a href="http://www.w3.org/Submission/spin-modeling/"&gt;SPIN Modeling Vocabulary&lt;/a&gt;.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Once I had the rules and constraint mechanism in place, I noticed that many rules and constraints were following similar patterns, with just one or two values different in each rule. This led to the creation of &lt;a href="http://composing-the-semantic-web.blogspot.com/2009/01/understanding-spin-templates.html"&gt;SPIN Templates&lt;/a&gt;. Templates then became the foundation of user-defined &lt;a href="http://composing-the-semantic-web.blogspot.com/2009/01/understanding-spin-functions.html"&gt;SPIN Functions&lt;/a&gt;. With those two pieces in place, SPIN suddenly became a language that was fundamentally different (and better) than what similar languages such as SWRL provided, because it became possible for users to define their own modeling vocabulary, and even extend the expressivity of SPARQL.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The first version of SPIN was &lt;a href="http://composing-the-semantic-web.blogspot.com/2009/01/introducing-spin-sparql-inferencing.html"&gt;published&lt;/a&gt; as part of TopBraid Composer in January 2009. Since then, it was positively received by our user community and practical use cases have enabled us to fine tune and extend the language over the years. Now, around three years after its first experimental versions, we found the time was right to officially share SPIN with the broader community, and make clear that it is not a proprietary TopQuadrant technology. Together with James Hendler and Kingsley Idehen, we put together a &lt;a href="http://www.w3.org/Submission/spin-overview/"&gt;SPIN W3C Member Submission&lt;/a&gt; that has just been published on the W3C site.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The status of a Member Submission means that TopQuadrant encourages other tool vendors to also provide SPIN implementations, and as I have heard there is work in progress already. The Member Submission also indicates that SPIN &lt;a href="http://www.w3.org/Submission/2011/02/Comment/"&gt;may&lt;/a&gt; play a role as input to future revisions of other standards such as RIF. This is all very good. Of course a full spec of SPIN as an official W3C standard would be even better, but going through the whole standardization process is a long and difficult journey. Given that SWRL had become a similar de-facto standard with Member Submission status alone indicates to me that SPIN has good chances of achieving the same. In fact I strongly believe that the fact that SPIN is based on SPARQL will be crucial in winning the hearts and minds of many Semantic Web and Linked Data enthusiasts. SPIN can co-exist with other languages including &lt;a href="http://composing-the-semantic-web.blogspot.com/2009/01/owl-2-rl-in-sparql-using-spin.html"&gt;OWL 2 RL&lt;/a&gt; and &lt;a href="http://topquadrantblog.blogspot.com/2010/08/how-to-find-skos-constraint-violations.html"&gt;SKOS&lt;/a&gt;. SPIN doesn't require any special execution engine apart from a SPARQL store. The learning curve is very low for anyone who already knows SPARQL. SPIN is part of the Semantic Web technology stack.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;A good place to start learning SPIN is the &lt;a href="http://www.topquadrant.com/products/SPIN.html"&gt;&lt;b&gt;TopBraid SPIN&lt;/b&gt;&lt;/a&gt; page, with screenshots and links to a tutorial. For programmers, there is an &lt;a href="http://topbraid.org/spin/api/"&gt;open source SPIN API&lt;/a&gt; available.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31416365-3646592088176896829?l=composing-the-semantic-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://composing-the-semantic-web.blogspot.com/feeds/3646592088176896829/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=31416365&amp;postID=3646592088176896829' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/3646592088176896829'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/3646592088176896829'/><link rel='alternate' type='text/html' href='http://composing-the-semantic-web.blogspot.com/2011/04/spin-is-w3c-member-submission.html' title='SPIN is a W3C Member Submission'/><author><name>Holger Knublauch</name><uri>http://www.blogger.com/profile/13180242480924209321</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://www.knublauch.com/images/platypus.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-31416365.post-2381357011128706318</id><published>2011-01-25T17:36:00.000-08:00</published><updated>2011-01-25T17:54:10.120-08:00</updated><title type='text'>A Textual Syntax for SPARQLMotion</title><content type='html'>&lt;a href="http://sparqlmotion.org/"&gt;SPARQLMotion&lt;/a&gt; is an RDF-based scripting language that is suitable to be presented and edited graphically to form data processing pipelines. Many of our customers are using SPARQLMotion and we are constantly extending and refining the tools to make it more powerful. One of the recent enhancements that made it into TopBraid 3.4 is support for an alternative textual notation for SPARQLMotion. A spec for this notation can be found here:&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;a href="http://sparqlmotion.org/smXMLSyntax.html"&gt;&lt;b&gt;http://sparqlmotion.org/smXMLSyntax.html&lt;/b&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;An example of how this XML-based notation for SPARQLMotion can be used is shown in the TopBraid Composer screenshot's sm:bodyScript field below.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_44lV0kDjySE/TT98mF4UFQI/AAAAAAAAASU/cutiy5wLcs0/s1600/SM-XML-Example.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 369px;" src="http://2.bp.blogspot.com/_44lV0kDjySE/TT98mF4UFQI/AAAAAAAAASU/cutiy5wLcs0/s400/SM-XML-Example.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5566304658308470018" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;The script above is stored in the same RDF-based format like other SPARQLMotion scripts, and can still be visualized graphically:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_44lV0kDjySE/TT9-MTEOxOI/AAAAAAAAASc/ijlqrzFU248/s1600/SM-Graph-Example.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 300px; height: 282px;" src="http://1.bp.blogspot.com/_44lV0kDjySE/TT9-MTEOxOI/AAAAAAAAASc/ijlqrzFU248/s400/SM-Graph-Example.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5566306414194771170" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;In the past few years since SPARQLMotion was created, several people had asked about a notation that can be edited with conventional text editing tools to create scripts. Among the advantages of a text-based notation is that it becomes easier to perform large-scale refactorings to move things around. It is sometimes simply faster, plus there is no need to "invent" artificial URIs for the nodes in a script. A great plus of the XML-based notation is that it becomes easy to insert &lt;a href="http://uispin.org/"&gt;SPARQL Web Pages&lt;/a&gt; (aka UISPIN) snippets directly into a single document. This can significantly accelerate the development of SPARQL-based web services.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The XML notation does have various limitations though. In particular it is only suitable for a subset of SPARQLMotion - there is no concept of multiple predecessor nodes in a linear notation.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31416365-2381357011128706318?l=composing-the-semantic-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://composing-the-semantic-web.blogspot.com/feeds/2381357011128706318/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=31416365&amp;postID=2381357011128706318' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/2381357011128706318'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/2381357011128706318'/><link rel='alternate' type='text/html' href='http://composing-the-semantic-web.blogspot.com/2011/01/textual-syntax-for-sparqlmotion.html' title='A Textual Syntax for SPARQLMotion'/><author><name>Holger Knublauch</name><uri>http://www.blogger.com/profile/13180242480924209321</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://www.knublauch.com/images/platypus.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_44lV0kDjySE/TT98mF4UFQI/AAAAAAAAASU/cutiy5wLcs0/s72-c/SM-XML-Example.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-31416365.post-4710431028012631507</id><published>2011-01-10T18:59:00.000-08:00</published><updated>2011-01-10T19:18:41.350-08:00</updated><title type='text'>Understanding SPARQL Rules with the SPIN Statistics View</title><content type='html'>&lt;div&gt;One of the new features of &lt;a href="http://www.topquadrant.com/products/TB_Composer.html"&gt;TopBraid Composer&lt;/a&gt; 3.4 is a new view called SPIN Statistics. Whenever this view is open and you run some &lt;a href="http://spinrdf.org/"&gt;SPARQL Rules&lt;/a&gt;, this will record the execution time of each individual rule. When completed, you can browse the performance characteristics of each rule, grouped by invocations or by the associated class. In the following screenshot, the &lt;a href="http://topbraid.org/spin/owlrl-all.html"&gt;SPIN rules for OWL 2 RL&lt;/a&gt; executed over the pizza ontology are recorded:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_44lV0kDjySE/TSvIwsupiyI/AAAAAAAAASM/i-jjTpz-uII/s1600/TBC-SPIN-Statistics-OWL2RL.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 114px;" src="http://1.bp.blogspot.com/_44lV0kDjySE/TSvIwsupiyI/AAAAAAAAASM/i-jjTpz-uII/s400/TBC-SPIN-Statistics-OWL2RL.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5560758903885105954" /&gt;&lt;/a&gt;According to the statistics in this screenshot, the rule that implements the transitivity of rdfs:subClassOf has taken the largest fraction of the time. This can help identify performance bottlenecks, and may also be useful to understand better what happens inside of the rule engine. The view can be filled incrementally, e.g. to accumulate how certain rules fire over different data sets.&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31416365-4710431028012631507?l=composing-the-semantic-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://composing-the-semantic-web.blogspot.com/feeds/4710431028012631507/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=31416365&amp;postID=4710431028012631507' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/4710431028012631507'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/4710431028012631507'/><link rel='alternate' type='text/html' href='http://composing-the-semantic-web.blogspot.com/2011/01/understanding-sparql-rules-with-spin.html' title='Understanding SPARQL Rules with the SPIN Statistics View'/><author><name>Holger Knublauch</name><uri>http://www.blogger.com/profile/13180242480924209321</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://www.knublauch.com/images/platypus.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_44lV0kDjySE/TSvIwsupiyI/AAAAAAAAASM/i-jjTpz-uII/s72-c/TBC-SPIN-Statistics-OWL2RL.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-31416365.post-2989333223801876608</id><published>2010-12-13T17:44:00.000-08:00</published><updated>2010-12-13T19:22:47.844-08:00</updated><title type='text'>The Teamwork Ontology</title><content type='html'>The newly released &lt;a href="http://topquadrant.com/products/release_notes/v3_4_0.html"&gt;TopBraid Suite 3.4&lt;/a&gt; introduces the &lt;a href="http://www.topquadrant.com/solutions/ent_vocab_net.html"&gt;Enterprise Vocabulary Net (EVN)&lt;/a&gt;, an out-of-the-box solution for web-based development and management of interconnected controlled vocabularies. The focus of this product for now is on collaborative editing of SKOS models, and the EVN link above will lead you to screenshots showing this in action. I should write a couple of blog entries about this, but here is one about one particular aspect of the EVN system - its support for keeping track of changes (on the SKOS models) in a multi-user environment.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The requirements of EVN include the ability of teams to collaborate on edits on an enterprise vocabulary. Imagine a media company wants to build a semantic web model of concepts that are relevant in its domain. This media company would have domain experts on the "news" channel, and for this news channel, a controlled vocabulary would be needed to be able to categorize incoming news items so that they can be processed more easily down the road. A simple SKOS hierarchy would define standard identifiers (URIs) for things like Sports, and under that there would be sub-concepts such as RacquetSports, with further specializations including Tennis and Badminton.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;In order to build such a controlled vocabulary, the media company would create a team of domain experts, and each group of experts would collaborate independently to fill in the various sub-trees of the overall enterprise vocabulary. In the TopBraid EVN system, this is implemented through an editing process in which different people can play different roles. Assume the sports experts want to add another bunch of categories to classify the various kinds of football, then they would open a so-called "working copy". The working copy is a logical extension of the master model, but also includes local changes that are not yet visible to the rest of the team. The sports team can experiment with arbitrary edits in their working copy sandbox. When done, they can change the status of their working copy to trigger a review process. At this stage, no further edits will be done, until a reviewer (who "owns" the master copy) had a chance to OK or reject those edits. If OK, the working copy will be retired, and all changes will be applied to the master copy and thus published to the rest of the enterprise. If rejected, the sports people may want to make additional edits.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;In order to support such workflows, we have designed an RDF based framework for tracking and managing changes on RDF models. This framework, internally called "teamworks support" is based on the teamwork ontology (&lt;a href="http://topbraid.org/teamwork"&gt;http://topbraid.org/teamwork&lt;/a&gt;), an excerpt of which is outlined in the class diagram below, together with some technical details.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_44lV0kDjySE/TQbR-yj2FMI/AAAAAAAAAR4/IMYHyCD6hJE/s1600/teamwork-class-diagram.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 268px;" src="http://2.bp.blogspot.com/_44lV0kDjySE/TQbR-yj2FMI/AAAAAAAAAR4/IMYHyCD6hJE/s400/teamwork-class-diagram.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5550354467434927298" /&gt;&lt;/a&gt;The teamwork ontology represents changes (teamwork:Change) made by users (sioc:UserAccount) on governed resources. The governed resources are either a whole model (the master copy, an instance of owl:Ontology), or working copies (teamwork:Tag). If a group of users wants to add a new category of sports concepts, then it would create a teamwork:Tag and give it a label such as "Add football sports". This will become the container of any number of smaller changes, each represented as instances of teamwork:Change, which are recorded together with a time stamp and creator. Each Change points to one or more added or deleted RDF triples, where the triples are stored as reified statements of the class teamwork:Statement. A Change can be associated with a working copy (teamwork:Tag) via the property teamwork:tag. The collection of Change objects associated to a Tag form a group of edits that can be tracked in the workflow using the property teamwork:status at the teamwork:Tag. Example status values are teamwork:Uncommitted, teamwork:FrozenForReview and teamwork:Rejected.&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The teamwork user model manages user accounts as well as the roles that each user can play within a working copy and the master vocabulary. This is done through the sub-properties of teamwork:role: viewer (read-only), editor (write access) and manager (write access and workflow control).&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The teamwork triples above are stored in separate graphs, called the teamwork graphs, that are linked to the edited vocabularies via a file ending with .tch.*. For example, the graph example.tdb may have a companion graph stored in example.tch.tdb. As soon as TopBraid finds a .tch file with a matching name, it will put the ontology under teamwork control, which means that changes will be automatically tracked whenever someone writes the the graph. Furthermore, all graphs under teamwork control will show up on the log in page of the EVN application. The following figure illustrates this set up:&lt;/div&gt;&lt;div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_44lV0kDjySE/TQbeYZrV4eI/AAAAAAAAASA/2muyL4jaBgo/s1600/teamwork-architecture.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 344px;" src="http://3.bp.blogspot.com/_44lV0kDjySE/TQbeYZrV4eI/AAAAAAAAASA/2muyL4jaBgo/s400/teamwork-architecture.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5550368101571617250" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;The teamwork graph will contain any metadata about the changes, i.e. any teamwork:Change objects, the reified triples, information about the working copies etc. It may easily become larger than the actual main model, because it can keep track of the whole audit trail, and may use four triples for each changed triple. When a user logs into a working copy, the system creates a logical view - a graph that does not necessarily have a physical representation, but may be populated on demand. When created, this logical view will check the teamwork database for any uncommitted changes associated with the given working copy. Those changes will then be visible to the editing user, without having to be materialized in the actual master copy database. When the user makes some edits, the changes will only be logged into the teamwork database. Changes only make it into the master database, if the manager approves them. From that moment on, they will become automatically visible to any existing logical view.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;There is much more to say about this whole architecture, but I'll leave these details for later. It suffices to say that the user interfaces of EVN and TopBraid Composer will shield the user from all those details. But if you ever want to get low level access to those teamwork repositories yourself, you can easily do that: just open the .tch files in TopBraid Composer and browse the content. If you have made some edits from EVN, you can see which triples are impacted in the teamwork graph. You can use SPARQL to query the changes, e.g. to find all changes that mention a given resource, or all changes within a certain time interval. You can also use scripting languages like SPARQLMotion to perform batch operations on the teamwork repositories.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The fact that we are using RDF all the way down makes the TopBraid teamwork support a very transparent and consistent architecture for change management.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31416365-2989333223801876608?l=composing-the-semantic-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://composing-the-semantic-web.blogspot.com/feeds/2989333223801876608/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=31416365&amp;postID=2989333223801876608' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/2989333223801876608'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/2989333223801876608'/><link rel='alternate' type='text/html' href='http://composing-the-semantic-web.blogspot.com/2010/12/teamwork-ontology.html' title='The Teamwork Ontology'/><author><name>Holger Knublauch</name><uri>http://www.blogger.com/profile/13180242480924209321</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://www.knublauch.com/images/platypus.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_44lV0kDjySE/TQbR-yj2FMI/AAAAAAAAAR4/IMYHyCD6hJE/s72-c/teamwork-class-diagram.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-31416365.post-8749680575659526544</id><published>2010-11-28T15:03:00.000-08:00</published><updated>2010-11-28T15:09:38.874-08:00</updated><title type='text'>UISPIN is now SPARQL Web Pages</title><content type='html'>As part of the official release of UISPIN 1.0 with TopBraid Suite 3.4, we have decided to give it a more compelling and more descriptive name: &lt;a href="http://uispin.org"&gt;SPARQL Web Pages (SWP)&lt;/a&gt;. There are no technical implications of the new name - it's mostly to communicate better what this technology is all about: Creating HTML (and XML) documents by embedding SPARQL expressions and queries into template documents. The namespaces and many of the technical references will continue to use the term UISPIN, which illustrates the lower-level technical aspect (of being the User Interface layer of the &lt;a href="http://spinrdf.org"&gt;SPIN&lt;/a&gt; framework).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31416365-8749680575659526544?l=composing-the-semantic-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://composing-the-semantic-web.blogspot.com/feeds/8749680575659526544/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=31416365&amp;postID=8749680575659526544' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/8749680575659526544'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/8749680575659526544'/><link rel='alternate' type='text/html' href='http://composing-the-semantic-web.blogspot.com/2010/11/uispin-is-now-sparql-web-pages.html' title='UISPIN is now SPARQL Web Pages'/><author><name>Holger Knublauch</name><uri>http://www.blogger.com/profile/13180242480924209321</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://www.knublauch.com/images/platypus.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-31416365.post-1907906405353878999</id><published>2010-09-01T03:13:00.000-07:00</published><updated>2010-09-12T18:03:44.476-07:00</updated><title type='text'>RDFS Plus as a subset of OWL RL in SPARQL Rules</title><content type='html'>There is a growing interest in the &lt;a href="http://www.w3.org/TR/owl2-profiles/#Reasoning_in_OWL_2_RL_and_RDF_Graphs_using_Rules"&gt;OWL RL&lt;/a&gt; profile of the Web Ontology Language, e.g. see recent &lt;a href="http://www.semanticoverflow.com/questions/1570/what-criteria-were-used-for-selecting-omitting-owl-2-rl-rdf-rules"&gt;postings on Semantic Overflow&lt;/a&gt; or &lt;a href="http://dallemang.typepad.com/my_weblog/2010/08/extending-owl-rl-.html"&gt;Dean Allemang's blog entry&lt;/a&gt;. OWL RL has been defined by the W3C working group as a subset of OWL 2 that can be formally represented by rules. There are lots of rule engines out there that can be used to represent this subset. I had &lt;a href="http://composing-the-semantic-web.blogspot.com/2009/01/owl-2-rl-in-sparql-using-spin.html"&gt;written&lt;/a&gt; about our implementation of OWL RL using &lt;a href="http://spinrdf.org/"&gt;SPARQL Rules (SPIN)&lt;/a&gt;. This implementation can be downloaded and used with SPIN aware tools, such as &lt;a href="http://www.topquadrant.com/products/TB_Composer.html"&gt;TopBraid Composer&lt;/a&gt;. A human readable display of those rules can be found here: &lt;a href="http://topbraid.org/spin/owlrl-all.html"&gt;&lt;b&gt;OWL 2 RL in SPARQL&lt;/b&gt;&lt;/a&gt;.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Some people wonder about the limitations of OWL RL - it does not cover the full expressiveness of OWL after all. How could something so limiting be of any value at all? But this question is only relevant if you are sold into selecting the OWL vocabulary in the first place. This isn't as obvious as it may seem. There is a huge interest in lighter knowledge representation and modeling formalisms such as SKOS, and the emerging Linked Data cloud also only makes use of a very limited subset of OWL.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;If you have read Dean Allemang's and Jim Hendler's &lt;a href="http://www.elsevierdirect.com/product.jsp?isbn=9780123735560"&gt;Working Ontologist&lt;/a&gt; book, you may have heard about an even smaller subset of OWL, sometimes called RDFS Plus. This is basically RDF Schema, plus some carefully selected terms from OWL. As an exercise, I recently went through a &lt;a href="http://www.w3.org/2007/OWL/wiki/Fragments"&gt;list&lt;/a&gt; of features that roughly cover what RDFS Plus might look like, which Jim had sent to me. All I had to do was to pick those rules from the OWL RL implementation that mentioned the terms from the RDFS Plus vocabulary, and collected them as SPIN Templates in the file at&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;a href="http://topbraid.org/spin/rdfsplus"&gt;http://topbraid.org/spin/rdfsplus&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;A human-readable rendering of this namespace with a list of SPARQL CONSTRUCT rules is here:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;a href="http://topbraid.org/spin/rdfsplus.html"&gt;&lt;b&gt;RDFS Plus in SPARQL&lt;/b&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;This exercise illustrates how easy it is to define any number of languages simply in terms of rules. There is a rule for rdfs:subClassOf, a rule for owl:inverseOf etc. When executed together, a small set of rules can lead to interesting inferences. But now take this one step further, and add support for any other vocabulary, such as SKOS:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;a href="http://topbraid.org/spin/skosspin"&gt;http://topbraid.org/spin/skosspin&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;See this &lt;a href="http://topquadrantblog.blogspot.com/2010/08/how-to-find-skos-constraint-violations.html"&gt;blog posting&lt;/a&gt; on how to use this for SKOS constraint checking. And then take this idea another step further, and add some rules for other popular vocabularies such as FOAF or Good Relations, or add support for &lt;a href="http://composing-the-semantic-web.blogspot.com/2009/08/units-ontology-with-spin-support.html"&gt;unit conversion using SPIN&lt;/a&gt;. Suddenly you can express relationships between things brought together from multiple online shops with different units, that vaguely define subclass or broader/narrower relationships between each other.&lt;/div&gt;&lt;div style="text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;You can basically select whatever kinds of inferences you need for your application. And you can execute them all with the same engine, you can edit them all with the same tool, and you can debug, profile and optimize them with the same platform. OWL RL and RDFS Plus are really good building blocks, but they are part of a family of languages, including the many languages (aka vocabularies and ontologies) that are still to come. I wrote before about how different this approach is from a the &lt;a href="http://composing-the-semantic-web.blogspot.com/2010/04/where-owl-fails.html"&gt;hard-coded, closed world view of some OWL&lt;/a&gt; fanatics, who still insist that moving beyond OWL DL is evil, and that all you need is a tableau reasoner. Rule-based approaches like SPARQL Rules (SPIN) make it easy to define your own language, or to assemble your own language from existing components.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31416365-1907906405353878999?l=composing-the-semantic-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://composing-the-semantic-web.blogspot.com/feeds/1907906405353878999/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=31416365&amp;postID=1907906405353878999' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/1907906405353878999'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/1907906405353878999'/><link rel='alternate' type='text/html' href='http://composing-the-semantic-web.blogspot.com/2010/09/rdfs-plus-as-subset-of-owl-rl-in-sparql.html' title='RDFS Plus as a subset of OWL RL in SPARQL Rules'/><author><name>Holger Knublauch</name><uri>http://www.blogger.com/profile/13180242480924209321</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://www.knublauch.com/images/platypus.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-31416365.post-7021723329190222193</id><published>2010-04-07T18:42:00.000-07:00</published><updated>2010-04-07T19:37:45.394-07:00</updated><title type='text'>WHERE OWL fails</title><content type='html'>&lt;div&gt;&lt;a href="http://www.proxml.be/"&gt;Paul Hermans&lt;/a&gt; has written an insightful series of blog entries (&lt;a href="http://www.proxml.be/users/paul/weblog/aaad2/Integrity_constraints_in_SKOS_part_1_.html"&gt;part 1&lt;/a&gt;, &lt;a href="http://www.proxml.be/users/paul/weblog/55d41/Integrity_constraints_in_SKOS_part_2.html"&gt;part 2&lt;/a&gt;, &lt;a href="http://www.proxml.be/users/paul/weblog/bfa21/Integrity_Constraints_in_SKOS_part_3.html"&gt;part 3&lt;/a&gt;, &lt;a href="http://www.proxml.be/users/paul/weblog/0a621/SKOS_part_4_property_chains.html"&gt;part 4&lt;/a&gt;) in which he reports on his experiences trying to express some SKOS integrity constraints and inference rules with OWL 2. After failing to express those things with OWL 2, he then demonstrates how his goals can be easily achieved with SPARQL with the help of the &lt;a href="http://spinrdf.org/"&gt;SPIN&lt;/a&gt; framework.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;His conclusions (the last sentences from his blog entries):&lt;/div&gt;&lt;ol&gt;&lt;li&gt;"If you speak SPARQL fluently, it is fairly easy to define constraints on your RDF data using SPIN."&lt;/li&gt;&lt;li&gt;"And the winner for constraint S13 is clearly SPIN."&lt;/li&gt;&lt;li&gt;"Once again fairly easy to do with SPIN; a long study of the particularities of OWL2 DL restrictions to find out that this constraint cannot be expressed in OWL2 DL."&lt;/li&gt;&lt;li&gt;"SPIN wins again."&lt;/li&gt;&lt;/ol&gt;&lt;div&gt;Paul is in no way associated with TopQuadrant and we have not asked him to create those write ups for marketing purposes - I discovered them by chance. Paul appears to be fluent with a large variety of technologies and makes balanced use of whatever tools and languages are most useful for his given tasks.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;So why does OWL fail in those examples? In my opinion, these examples expose a fundamental design limitation of OWL: OWL is hard-coded against specific design patterns, but anything that goes beyond those patterns cannot be expressed. Furthermore, the choice of supported design patterns is misguided by theoretical assumptions about DL inferencing that are quite often irrelevant for practical purposes.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Let's look at a longer version of this answer. The data model of the Semantic Web is a graph structure consisting of RDF triples. The strengths of RDF is that people can define their own ways of representing data and knowledge, and thus create arbitrary RDF graph patterns. Users are free to define classes with any number of associated properties, forming larger structures that go far beyond the triple level.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;In order to check constraints or execute rules on those graph structures, a general graph matching language is needed. A strong candidate for this is SPARQL, especially its WHERE clause. The WHERE clause is able to match fairly complex sub-graph patterns and provides variable bindings that can be used to report constraint violations or to fire the right hand side of a rule.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;OWL on the other hand side is not able to represent arbitrary RDF graph patterns, but only a sub-set of those patterns that the designers of OWL found useful. Many of those patterns have seemingly arbitrary restrictions, as illustrated by Paul's examples (e.g., mixing different property types is not allowed in property chains). OWL 2 and some of its implementations such as the OWL API have driven this approach to extremes, making it not even possible to represent those patterns syntactically. This is because OWL 2 is not based on the RDF data model and therefore cannot talk about RDF in general.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;So if you want to ask a question that the OWL 2 designers have not anticipated, then you cannot use OWL.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;To make matters worse, OWL 2 is heavily influenced by research from the field of Description Logics, which many real-world users find both artificial and unhelpful. The goal of DL is to find a "tractable" sub-set of logic that allows inference engines to "guarantee" that all possible questions will be answered in finite time. While this sounds like an attractive value proposition from a theoretical point of view, practical evidence shows that the sub-set selected for OWL DL does not cover enough real-world use cases (see Paul's entries). Furthermore, there is enough practical evidence suggesting that while OWL DL inferencing may terminate in finite time, this time might be after the heat death of the universe and therefore completely useless. Just look at the mailing list archives of popular OWL DL inference engines to read about complaints of how slow those engines are in the real world. With SPARQL and SPIN you can of course also create very slow queries, but at least you have much greater flexibility and expressivity. And like with any language, a fair amount of engineering and experience allows you to prevent performance pitfalls. You also cannot expect to throw any complex query at your SQL database and expect ideal response times. Engineering is needed.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;In defense of OWL, there are lots of useful design patterns encoded in this language, and it is great that the community has a standard vocabulary to talk about classes and things like property cardinalities. There needs to be &lt;i&gt;some&lt;/i&gt; standard to capture ontology design patterns, and OWL does a good job for many of them. But this makes OWL just one out of a catalog of vocabularies, on the same level as SKOS or FOAF or SIOC or GoodRelations. It's simply a good vocabulary to talk about classes, while SKOS is a good vocabulary to talk about taxonomies and GoodRelations is a good vocabulary to talk about business.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;But for anything that is actionable for the real world, a combination of various vocabularies and a rich constraint and rule language like &lt;a href="http://spinrdf.org"&gt;SPIN&lt;/a&gt; is needed.&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31416365-7021723329190222193?l=composing-the-semantic-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://composing-the-semantic-web.blogspot.com/feeds/7021723329190222193/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=31416365&amp;postID=7021723329190222193' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/7021723329190222193'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/7021723329190222193'/><link rel='alternate' type='text/html' href='http://composing-the-semantic-web.blogspot.com/2010/04/where-owl-fails.html' title='WHERE OWL fails'/><author><name>Holger Knublauch</name><uri>http://www.blogger.com/profile/13180242480924209321</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://www.knublauch.com/images/platypus.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-31416365.post-7935191391210457668</id><published>2010-04-03T10:00:00.000-07:00</published><updated>2010-04-03T10:00:01.906-07:00</updated><title type='text'>The SPIN Technology Stack</title><content type='html'>&lt;div&gt;Regular readers of this blog may notice that I am a big fan of SPARQL-based technologies. In fact, most of my work in the last couple of years went into defining extensions to SPARQL, and implementing editing and debugging tools for those extensions. The results of this work have been made core features of the &lt;b&gt;&lt;a href="http://topquadrant.com/products/TB_Suite.html"&gt;TopBraid Suite&lt;/a&gt;&lt;/b&gt;, one of the most successful industrial semantic development platforms.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The first of those SPARQL extensions was &lt;a href="http://sparqlmotion.org/"&gt;&lt;b&gt;SPARQLMotion&lt;/b&gt;&lt;/a&gt; that somehow emerged out of discussions on scripting languages between me and &lt;a href="http://en.wikipedia.org/wiki/Dean_Allemang"&gt;Dean Allemang&lt;/a&gt; (wow: he has a Wikipedia page) and other TopQuadrant colleagues. SPARQLMotion was published in the end of 2007 and has &lt;a href="http://composing-the-semantic-web.blogspot.com/2010/03/sparqlmotion-debugger.html"&gt;matured&lt;/a&gt; considerably in the last year, often driven by real-world feedback from our growing user base. SPARQLMotion is a visual scripting language that simplifies the development of data processing pipelines. In addition to its use in TopBraid Composer, SPARQLMotion scripts can be executed as &lt;a href="http://www.topquadrant.com/products/TB_Live.html"&gt;TopBraid Live&lt;/a&gt; web services or used to drive &lt;a href="http://www.topquadrant.com/products/TB_Ensemble.html"&gt;TopBraid Ensemble&lt;/a&gt; applications.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;A year later, at the end of 2008, we published the &lt;b&gt;&lt;a href="http://spinrdf.org/"&gt;SPARQL Inferencing Notation (SPIN)&lt;/a&gt;&lt;font class="Apple-style-span" style="font-weight: normal;"&gt;, a SPARQL-based rule and constraint checking language. SPIN also greatly extends SPARQL itself through its support for user-defined functions, magic properties and templates. SPARQLMotion now uses parts of SPIN for its base infrastructure, and SPIN functions can also be used in SPARQLMotion scripts. Major application areas of SPIN range from ontology mapping to rule-based systems and even computer games.&lt;/font&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The newest addition to this family is &lt;b&gt;&lt;a href="http://uispin.org/"&gt;UISPIN&lt;/a&gt;&lt;/b&gt;, published as a beta release with TopBraid Composer 3.3. UISPIN makes it possible to link RDF and OWL models with user interface descriptions that can be rendered as HTML or SVG documents. UISPIN will enable the creation of a new generation of dynamic business applications in which the rendering of content is entirely model-driven. UISPIN is also based on SPIN and borrows its ideas of procedural attachment to classes and pre-bound variables.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Taking a step back, we can now draw a pretty picture to illustrate how those languages fit perfectly together, forming the &lt;a href="http://spinrdf.org/spinstack.html"&gt;&lt;b&gt;SPIN Technology Stack&lt;/b&gt;&lt;/a&gt;:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_44lV0kDjySE/S7KU6iyRjTI/AAAAAAAAARo/PjAlNZdYGMM/s1600/spin-stack.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 382px;" src="http://4.bp.blogspot.com/_44lV0kDjySE/S7KU6iyRjTI/AAAAAAAAARo/PjAlNZdYGMM/s400/spin-stack.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5454585832190086450"&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;This pragmatic collection of technologies offers a fairly complete infrastructure for projects based on linked data and semantic web. Based only on RDF and SPARQL as well as bits of RDF Schema (and, if you like, OWL), the SPIN Stack covers a wide range of business needs:&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;RDFS/OWL + SPIN: rich, self-describing &lt;b&gt;domain models&lt;/b&gt;&lt;/li&gt;&lt;li&gt;SPARQLMotion: executable &lt;b&gt;behavior&lt;/b&gt;&lt;/li&gt;&lt;li&gt;UISPIN: model-driven dynamic &lt;b&gt;user interfaces&lt;/b&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;Software developers may recognize that those three pieces correspond to the well-known &lt;a href="http://en.wikipedia.org/wiki/Model–view–controller"&gt;Model-View-Controller&lt;/a&gt; (MVC) architecture pattern. The SPIN Stack now basically covers all aspects of classical software architecture. These languages are careful extensions of the official Semantic Web standards that take RDF/OWL and SPARQL out of the research labs and into the real world.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;And the best thing is that there is a lot of energy behind SPARQL (with SPARQL 1.1 on its way) and lots of other extensions, online SPARQL end points and efficient SPARQL databases on the market. As this market grows and more and more developers become familiar with SPARQL, the SPIN Technology Stack will be a safe investment for companies that wish to create flexible solutions based on smart, self-describing data.&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31416365-7935191391210457668?l=composing-the-semantic-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/7935191391210457668'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/7935191391210457668'/><link rel='alternate' type='text/html' href='http://composing-the-semantic-web.blogspot.com/2010/04/spin-technology-stack.html' title='The SPIN Technology Stack'/><author><name>Holger Knublauch</name><uri>http://www.blogger.com/profile/13180242480924209321</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://www.knublauch.com/images/platypus.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_44lV0kDjySE/S7KU6iyRjTI/AAAAAAAAARo/PjAlNZdYGMM/s72-c/spin-stack.png' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-31416365.post-5774516781759285310</id><published>2010-04-02T10:00:00.000-07:00</published><updated>2010-04-02T10:00:04.428-07:00</updated><title type='text'>UISPIN Example: Documenting SPIN Functions</title><content type='html'>&lt;div&gt;The &lt;a href="http://uispin.com/"&gt;&lt;b&gt;UISPIN&lt;/b&gt;&lt;/a&gt; framework can be used to create HTML documents from templates that contain embedded SPARQL queries and expressions. You can attach those templates to the classes of your domain model to help the system find the most suitable rendering of the instances. In this blog entry I show how this technique can be applied to create ontology documentation. In particular I create a UISPIN model for rendering SPIN functions, but similar ideas can be applied to other language elements such as OWL classes. This example also demonstrates many key features of UISPIN, including user-defined elements and control structures.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The end result of this example will look like the following. Whenever a user navigates to a SPIN function (here: &lt;b&gt;spl:object&lt;/b&gt;), then the Browser will display the HTML shown below.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_44lV0kDjySE/S7GyIWml3HI/AAAAAAAAARI/jGj7Cgxp4VY/s1600/spin.ui-spl-object.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 346px;" src="http://2.bp.blogspot.com/_44lV0kDjySE/S7GyIWml3HI/AAAAAAAAARI/jGj7Cgxp4VY/s400/spin.ui-spl-object.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5454336480298523762" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;The resulting HTML page displays the qname of the function in the heading, then the comment of the function, then a section listing all arguments of the function and finally the body query (if one exists).&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;In order to produce such a rendering, I have created a new file that contains the UISPIN definitions for the SPIN ontology. This file imports the SPIN namespace (http://spinrdf.org/spin) and the TUI namespace (http://uispin.org/tui, which in turn imports the HTML support for UISPIN). Since I want to document all SPIN functions, I have attached the following &lt;b&gt;ui:instanceView&lt;/b&gt; to the class &lt;b&gt;spin:Function&lt;/b&gt;.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_44lV0kDjySE/S7Gyz0FHP2I/AAAAAAAAARQ/HEEuXn486VA/s1600/spin.ui-instanceView.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 225px;" src="http://2.bp.blogspot.com/_44lV0kDjySE/S7Gyz0FHP2I/AAAAAAAAARQ/HEEuXn486VA/s400/spin.ui-instanceView.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5454337226945544034" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;The UISPIN snippet above basically states that all instances of &lt;b&gt;spin:Function&lt;/b&gt; shall be rendered as a HTML div element containing a h2 etc. The snippet contains many SPARQL expressions in the {= ... } notation, and those expressions are executed when the page is being rendered. As usual, the variable &lt;b&gt;?this&lt;/b&gt; points to the current instance, i.e. an instance of &lt;b&gt;spin:Function&lt;/b&gt;, and functions such as &lt;b&gt;spl:object&lt;/b&gt; can be called to conveniently retrieve properties of &lt;b&gt;?this&lt;/b&gt;.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The snippet above also contains the control element &lt;b&gt;ui:if&lt;/b&gt; that only inserts its child elements if the &lt;b&gt;ui:condition&lt;/b&gt; evaluates to true.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Finally, there is also a user-defined UISPIN element, &lt;b&gt;spin.ui:ArgumentsList&lt;/b&gt;, which is defined as shown in the next TopBraid Composer screenshot.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_44lV0kDjySE/S7HmoHUfCAI/AAAAAAAAARY/FChBmqy-kaA/s1600/spin.ui-ArgumentsList.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 244px; height: 400px;" src="http://3.bp.blogspot.com/_44lV0kDjySE/S7HmoHUfCAI/AAAAAAAAARY/FChBmqy-kaA/s400/spin.ui-ArgumentsList.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5454394200556505090" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;A user-defined UISPIN element has a unique identifier (URI) so that it can be shared and reused on the Semantic Web. Then it can have any number of arguments, using the &lt;b&gt;spl:Argument&lt;/b&gt; SPIN template at &lt;b&gt;spin:constraint&lt;/b&gt;. By the way this is the same design pattern as for user-defined &lt;a href="http://spinrdf.org/spin.html"&gt;SPIN&lt;/a&gt; functions, templates and &lt;a href="http://sparqlmotion.org/"&gt;SPARQLMotion&lt;/a&gt; modules.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The core of any user-defined UISPIN class though is its &lt;b&gt;ui:prototype&lt;/b&gt;. This is the snippet that will be inserted into the document where the element is used. In the prototype, the values of the arguments are pre-bound to the variables shown in bold face. In the example above, the value of the &lt;b&gt;spin.ui:module&lt;/b&gt; argument will be bound to the variable &lt;b&gt;?module&lt;/b&gt; in the prototype. If you scroll up two screenshots, you can see that the call of the &lt;b&gt;spin.ui:ArgumentsList&lt;/b&gt; element includes a value for &lt;b&gt;spin.ui:module&lt;/b&gt;. This means that the current value of the variable &lt;b&gt;?this&lt;/b&gt; will be inserted as &lt;b&gt;?module&lt;/b&gt; into the prototype. The prototype itself contains a control element of type &lt;b&gt;ui:forEach&lt;/b&gt; that traverses all arguments of the current module, and creates one table row and table data element for each of them.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Finally, the prototype also makes use of the control element &lt;b&gt;ui:resourceView&lt;/b&gt;, which will insert the default rendering of the &lt;b&gt;ui:resource&lt;/b&gt; into the target document. The values of &lt;b&gt;ui:resource&lt;/b&gt; in this case are the arguments (&lt;b&gt;?arg&lt;/b&gt;), and those are instances of &lt;b&gt;spl:Argument&lt;/b&gt;. This class has the following &lt;b&gt;ui:instanceView&lt;/b&gt; attached to it.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_44lV0kDjySE/S7H8MMhvB1I/AAAAAAAAARg/RaMtAMu04b8/s1600/spin.ui-Argument.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 124px;" src="http://3.bp.blogspot.com/_44lV0kDjySE/S7H8MMhvB1I/AAAAAAAAARg/RaMtAMu04b8/s400/spin.ui-Argument.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5454417910173730642" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;While the above snippet may be hard to read due to its formatting, you may see that it will display the predicate's qname, followed by its value type, followed by the word [Optional].&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Let's quickly summarize the main concepts from this example:&lt;/div&gt;&lt;div&gt;&lt;ol&gt;&lt;li&gt;You can attach HTML snippets to classes using the property &lt;b&gt;ui:instanceView&lt;/b&gt;.&lt;/li&gt;&lt;li&gt;The variable &lt;b&gt;?this&lt;/b&gt; points to the current instance of the class.&lt;/li&gt;&lt;li&gt;Views may contain user-defined elements, which have a prototype.&lt;/li&gt;&lt;li&gt;In the prototype, the arguments of the element are pre-bound as variables.&lt;/li&gt;&lt;li&gt;ui:if can be used to insert an HTML block based on a condition being true.&lt;/li&gt;&lt;li&gt;ui:forEach can be used to repeat a block for each row of a SPARQL query.&lt;/li&gt;&lt;li&gt;ui:resourceView will insert the default rendering (e.g. ui:instanceView) of a given resoource.&lt;/li&gt;&lt;/ol&gt;&lt;div&gt;Please give UISPIN a try by downloading &lt;a href="http://www.topquadrant.com/products/TB_download.html"&gt;TopBraid Composer ME 3.3&lt;/a&gt;. and let us know your feedback on the &lt;a href="http://groups.google.com/group/topbraid-users"&gt;topbraid-users&lt;/a&gt; mailing list. Note that UISPIN is still in beta stage, and your input may shape its future.&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31416365-5774516781759285310?l=composing-the-semantic-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/5774516781759285310'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/5774516781759285310'/><link rel='alternate' type='text/html' href='http://composing-the-semantic-web.blogspot.com/2010/04/uispin-example-documenting-spin.html' title='UISPIN Example: Documenting SPIN Functions'/><author><name>Holger Knublauch</name><uri>http://www.blogger.com/profile/13180242480924209321</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://www.knublauch.com/images/platypus.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_44lV0kDjySE/S7GyIWml3HI/AAAAAAAAARI/jGj7Cgxp4VY/s72-c/spin.ui-spl-object.png' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-31416365.post-1923762478993030222</id><published>2010-04-01T10:00:00.000-07:00</published><updated>2010-04-01T10:00:02.725-07:00</updated><title type='text'>Charts and Business Reports with UISPIN</title><content type='html'>&lt;div&gt;&lt;a href="http://uispin.org/"&gt;UISPIN&lt;/a&gt; makes it easy to develop new components that can be used like HTML tags in a document. Those components may comprise of a complex snippet of HTML and other XML-based languages such as SVG. UISPIN components can be published on the web, where they are identified by their URI. &lt;a href="http://uispin.org/charts.html"&gt;UISPIN Charts&lt;/a&gt; is a library of reusable components for visualizing data on charts and maps. Based on Google Charts and Google Maps, there is no need to install anything - the components are entirely declarative and ready to use.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The &lt;a href="http://uispin.org/charts.html"&gt;&lt;b&gt;UISPIN Charts page&lt;/b&gt;&lt;/a&gt; shows many example screenshots of the various kinds of charts and maps that are currently supported: Pie charts, Bar charts, Map charts, and Google Maps. More will be added in the future.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Here is a step-by-step tutorial illustrating how to use those charts. We will create the pie chart shown in the following screen shot.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_44lV0kDjySE/S7A_7PUVhsI/AAAAAAAAAPo/bEln5dfXbqw/s1600/PieChart-Election.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 261px;" src="http://4.bp.blogspot.com/_44lV0kDjySE/S7A_7PUVhsI/AAAAAAAAAPo/bEln5dfXbqw/s400/PieChart-Election.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5453929435702331074" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;Let's first look into the RDF model of the data that we want to visualize. This data is about election results, and is downloadable as a Turtle file from &lt;a href="http://uispin.com/examples/chartsExampleData.ttl"&gt;here&lt;/a&gt;. Download it into your TopBraid Composer ME 3.3 workspace to follow the exercise.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The data file defines the classes shown in the diagram below. Instances of the class &lt;b&gt;ex:Election&lt;/b&gt; point to a collection of &lt;b&gt;ex:ElectionResults&lt;/b&gt;. Each result links a party with a percentage (an xsd:float literal).&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_44lV0kDjySE/S7BBg1U7ahI/AAAAAAAAAPw/3OhKntefLQ8/s1600/PieChart-Diagram.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 386px; height: 313px;" src="http://1.bp.blogspot.com/_44lV0kDjySE/S7BBg1U7ahI/AAAAAAAAAPw/3OhKntefLQ8/s400/PieChart-Diagram.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5453931181072149010" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;Here is a form view of the ex:Election instance that we want to visualize. There are four ex:ElectionResults and they are blank nodes.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_44lV0kDjySE/S7BCSRDBStI/AAAAAAAAAP4/CO3Emlb-jj4/s1600/PieChart-Election-Instance.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 273px; height: 400px;" src="http://1.bp.blogspot.com/_44lV0kDjySE/S7BCSRDBStI/AAAAAAAAAP4/CO3Emlb-jj4/s400/PieChart-Election-Instance.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5453932030326819538" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;In order to use the chart components, we need to create a file that imports the UISPIN &lt;a href="http://uispin.org/charts"&gt;charts vocabulary&lt;/a&gt;. We can either import this namespace into the data document itself, or we can create a new document that imports both the charts and the data model. Since we do not want to clutter the data file, we create a new RDF file and drag the charts namespace as well as the data model into the Imports View. The charts namespace is part of the system ontologies, under the TopBraid/UISPIN project. The imports view should look similar to the following screenshot.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_44lV0kDjySE/S7B1MWX81WI/AAAAAAAAAQY/iI2P1XsKDdo/s1600/PieChart-Imports-View.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 397px; height: 174px;" src="http://4.bp.blogspot.com/_44lV0kDjySE/S7B1MWX81WI/AAAAAAAAAQY/iI2P1XsKDdo/s400/PieChart-Imports-View.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5453988003770586466" /&gt;&lt;/a&gt;&lt;div style="text-align: left;"&gt;Having both the domain model and the charts namespace in the same RDF model allows us to create links between the Election classes and suitable visualizations. Select the class &lt;b&gt;ex:Election&lt;/b&gt; so that it shows up on the form. You will now see a property &lt;b&gt;ui:instanceView&lt;/b&gt; on the form. This is where we will put the definition of the pie chart later.&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;But first let's think about the actual data. Pie charts visualize slices of data in proportion to one another. Each slice can have a label (here: the name of the political party). These value-label pairs form a table, and this table is the input to the pie chart. Select the instance of &lt;b&gt;ex:Election&lt;/b&gt; (&lt;b&gt;ex:AustralianFederalElection2006&lt;/b&gt;) and use the SPARQL View to run the following query:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_44lV0kDjySE/S7BznM6qMzI/AAAAAAAAAQQ/nBKCu7nKSiE/s1600/PieChart-SPARQLView.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 206px;" src="http://1.bp.blogspot.com/_44lV0kDjySE/S7BznM6qMzI/AAAAAAAAAQQ/nBKCu7nKSiE/s400/PieChart-SPARQLView.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5453986266065023794" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;This query returns the numeric value in the first column, and the label in the second. This happens to be exactly the format that the &lt;a href="http://uispin.org/charts.html#PieChart"&gt;&lt;b&gt;charts:PieChart&lt;/b&gt;&lt;/a&gt; component expects. Note that the query above uses a built-in feature of TopBraid Composer: in the SPARQL view, the variable &lt;b&gt;?this&lt;/b&gt; is pre-bound with the currently selected resource.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Go back to the class &lt;b&gt;ex:Election&lt;/b&gt; and locate the &lt;b&gt;ui:instanceView&lt;/b&gt; property on its form. We could now add an empty row and type the UISPIN snippet of the pie chart in, but in this exercise we use a different route: Open the context menu behind the &lt;b&gt;ui:instanceView&lt;/b&gt; property name and select &lt;b&gt;Create blank node...&lt;/b&gt; which opens a class selection dialog as the following.&lt;/div&gt;&lt;div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_44lV0kDjySE/S7B2crpefzI/AAAAAAAAAQg/nYpXQfkMbQ0/s1600/PieChart-CreateBlankNode.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 379px;" src="http://3.bp.blogspot.com/_44lV0kDjySE/S7B2crpefzI/AAAAAAAAAQg/nYpXQfkMbQ0/s400/PieChart-CreateBlankNode.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5453989383870775090" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;You need to select the class &lt;b&gt;charts:PieChart&lt;/b&gt; here. In order to find it quickly, click on the &lt;b&gt;Group by namespace&lt;/b&gt; button in the lower left corner. After clicking on OK, a new anonymous instance of &lt;b&gt;charts:PieChart&lt;/b&gt; will be created and displayed as a nested form as shown next.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_44lV0kDjySE/S7B2_ti9VzI/AAAAAAAAAQo/vZ23hw-IUrU/s1600/PieChart-BlankNode.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 319px; height: 128px;" src="http://2.bp.blogspot.com/_44lV0kDjySE/S7B2_ti9VzI/AAAAAAAAAQo/vZ23hw-IUrU/s400/PieChart-BlankNode.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5453989985675728690" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;This nested form will enumerate all potential arguments of the pie chart class, including &lt;b&gt;charts:label&lt;/b&gt; and &lt;b&gt;ui:resultSet&lt;/b&gt;. Scroll down to find the widget for &lt;b&gt;ui:resultSet&lt;/b&gt;, add an empty row and copy and paste the SPARQL query from the query view into it:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_44lV0kDjySE/S7B30yvMjPI/AAAAAAAAAQw/NVvsGebaBWs/s1600/PieChart-resultSet.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 293px; height: 159px;" src="http://2.bp.blogspot.com/_44lV0kDjySE/S7B30yvMjPI/AAAAAAAAAQw/NVvsGebaBWs/s400/PieChart-resultSet.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5453990897602301170" /&gt;&lt;/a&gt;Now, go to &lt;b&gt;charts:label&lt;/b&gt; and select &lt;b&gt;Add SPARQL expression&lt;/b&gt; from its context menu. This will open up an empty row, in which you can paste the expression &lt;b&gt;ui:label(?this)&lt;/b&gt;, which will insert the name of the current election into the pie chart. Finally, set &lt;b&gt;html:width&lt;/b&gt; and &lt;b&gt;html:height&lt;/b&gt; to 500 by 240 as shown below:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_44lV0kDjySE/S7B48Q8cSrI/AAAAAAAAAQ4/c2gQQU-tt14/s1600/PieChart-NestedForm.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 376px; height: 300px;" src="http://4.bp.blogspot.com/_44lV0kDjySE/S7B48Q8cSrI/AAAAAAAAAQ4/c2gQQU-tt14/s400/PieChart-NestedForm.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5453992125481634482" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;That's the complete definition of our pie chart, and closing the nested form you can see its XML syntax:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_44lV0kDjySE/S7B5arze0UI/AAAAAAAAARA/Q8dxVZxHAUM/s1600/PieChart-instanceView.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 396px; height: 151px;" src="http://3.bp.blogspot.com/_44lV0kDjySE/S7B5arze0UI/AAAAAAAAARA/Q8dxVZxHAUM/s400/PieChart-instanceView.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5453992648087884098" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;You could have entered this directly in XML syntax instead of going through the form. In any case, we can now go back to the instance of &lt;b&gt;ex:Election&lt;/b&gt; and click on the Browser tab at the bottom of the editor window to get the screenshot from the top of this article.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;This pie chart is now the default visualization of all instances of &lt;b&gt;ex:Election&lt;/b&gt;. But since the &lt;b&gt;charts:PieChart&lt;/b&gt; element is just one among many other available elements (including the whole range of HTML tags), we can turn the pie chart into a comprehensive report that contains other views (such as a &lt;b&gt;charts:BarChart&lt;/b&gt;), an HTML table and whatever else we want to display.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31416365-1923762478993030222?l=composing-the-semantic-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/1923762478993030222'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/1923762478993030222'/><link rel='alternate' type='text/html' href='http://composing-the-semantic-web.blogspot.com/2010/04/charts-and-business-reports-with-uispin.html' title='Charts and Business Reports with UISPIN'/><author><name>Holger Knublauch</name><uri>http://www.blogger.com/profile/13180242480924209321</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://www.knublauch.com/images/platypus.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_44lV0kDjySE/S7A_7PUVhsI/AAAAAAAAAPo/bEln5dfXbqw/s72-c/PieChart-Election.png' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-31416365.post-5249865751530219129</id><published>2010-03-31T15:31:00.000-07:00</published><updated>2010-03-31T15:31:00.549-07:00</updated><title type='text'>UISPIN: Creating HTML and SVG Documents with SPARQL</title><content type='html'>&lt;div&gt;&lt;a href="http://uispin.com/"&gt;&lt;b&gt;UISPIN&lt;/b&gt;&lt;/a&gt; is a new framework that can be used to link RDF resources with user interface descriptions that can be rendered as HTML or Scalable Vector Graphics (SVG) pages. Based on &lt;a href="http://spinrdf.org/"&gt;SPIN&lt;/a&gt;, UISPIN makes it easy to embed SPARQL expressions into XML snippets, so that the content of those snippets can be dynamically assembled into complete XHTML documents and SVG graphics. Here is an example of a typical UISPIN snippet (for rendering SKOS concepts):&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_44lV0kDjySE/S7Af4bZsEyI/AAAAAAAAAPY/51GbO-3on88/s1600/skos-ui-08-InstanceView.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 113px;" src="http://4.bp.blogspot.com/_44lV0kDjySE/S7Af4bZsEyI/AAAAAAAAAPY/51GbO-3on88/s400/skos-ui-08-InstanceView.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5453894203034309410" /&gt;&lt;/a&gt;The UISPIN snippet above would be rendered in HTML as follows:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_44lV0kDjySE/S7A8IBW0_cI/AAAAAAAAAPg/nugk3dGXm9Q/s1600/skos-ui-09-Spiders.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 393px;" src="http://3.bp.blogspot.com/_44lV0kDjySE/S7A8IBW0_cI/AAAAAAAAAPg/nugk3dGXm9Q/s400/skos-ui-09-Spiders.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5453925257246473666" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;UISPIN is comparable to template languages such as JSP and PHP, but is natively optimized for the Semantic Web and Linked Data. Among others, UISPIN makes it possible to define new XML tags that encapsulate reusable (HTML/SVG) building blocks, and to share those building blocks on the Web in RDF.&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://www.topquadrant.com/products/TB_Composer.html"&gt;TopBraid Composer&lt;/a&gt; ME 3.3.0 is the first tool that provides comprehensive support for editing, debugging and browsing UISPIN documents. UISPIN itself and its implementation are still in beta stage, and we publish it to encourage early adopters to play with this new technology and provide feedback. We will move quickly to bring UISPIN to a stable state in the coming months.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;There is already a large body of documentation and examples online, and I will report about more case studies and examples on this blog in the coming weeks. To get an overview, I recommend walking through the mini tutorial on &lt;a href="http://uispin.com/"&gt;&lt;b&gt;uispin.com&lt;/b&gt;&lt;/a&gt;. This will give you a good idea of the basic concepts and might even be sufficient to get you started. For details and the official specification, please check &lt;a href="http://uispin.org/"&gt;&lt;b&gt;uispin.org&lt;/b&gt;&lt;/a&gt;.&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31416365-5249865751530219129?l=composing-the-semantic-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/5249865751530219129'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/5249865751530219129'/><link rel='alternate' type='text/html' href='http://composing-the-semantic-web.blogspot.com/2010/03/uispin-creating-html-and-svg-documents.html' title='UISPIN: Creating HTML and SVG Documents with SPARQL'/><author><name>Holger Knublauch</name><uri>http://www.blogger.com/profile/13180242480924209321</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://www.knublauch.com/images/platypus.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_44lV0kDjySE/S7Af4bZsEyI/AAAAAAAAAPY/51GbO-3on88/s72-c/skos-ui-08-InstanceView.png' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-31416365.post-4405608334980540663</id><published>2010-03-30T20:49:00.000-07:00</published><updated>2010-03-30T20:49:00.610-07:00</updated><title type='text'>Converting UML Files to RDF via Java/EMF Objects and SPARQLMotion</title><content type='html'>&lt;div&gt;TopBraid 3.3 comes with two new &lt;a href="http://sparqlmotion.org/"&gt;SPARQLMotion&lt;/a&gt; modules that can be used to convert arbitrary EMF files (including UML and XSD) to RDF. The underlying mechanism is very simple and extremely flexible:&lt;/div&gt;&lt;div&gt;&lt;ol&gt;&lt;li&gt;&lt;a href="http://www.eclipse.org/"&gt;Eclipse&lt;/a&gt; is able to load .uml files into a MOF-based Java object model called &lt;a href="http://www.eclipse.org/modeling/mdt/?project=uml2"&gt;EMF&lt;/a&gt;.&lt;/li&gt;&lt;li&gt;SPARQLMotion provides a new module &lt;b&gt;sml:ImportJavaObjectsFromEMFFile&lt;/b&gt; that takes a UML file as argument and loads its EMF Java objects into a SPARQLMotion variable.&lt;/li&gt;&lt;li&gt;SPARQLMotion provides a new module &lt;b&gt;sml:ConvertJavaObjectsToRDF&lt;/b&gt; that can traverse arbitrary Java object graphs to create RDF objects with the same structure.&lt;/li&gt;&lt;li&gt;Now that we have the UML file represented in RDF, we can apply arbitrary transformations, in particular &lt;a href="http://spinrdf.org/spin.html#spin-rules"&gt;SPIN rules&lt;/a&gt; (SPARQL CONSTRUCTs) to create whatever ontology we like.&lt;/li&gt;&lt;/ol&gt;&lt;div&gt;In an example SPARQLMotion script, this process looks as follows:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_44lV0kDjySE/S7AGLT7drLI/AAAAAAAAAOg/9jvGqTOc3zI/s1600/UML-Import-SM-Script.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 353px; height: 310px;" src="http://1.bp.blogspot.com/_44lV0kDjySE/S7AGLT7drLI/AAAAAAAAAOg/9jvGqTOc3zI/s400/UML-Import-SM-Script.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5453865940143680690" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;In the import step, we have to specify the file name (here: an example UML file) and the name of an output variable, that allows subsequent steps to access the EMF objects:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_44lV0kDjySE/S7AG2AplKWI/AAAAAAAAAOo/ldgpYjK71w4/s1600/UML-Import-SM-ImportUMLFileModule.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 270px; height: 298px;" src="http://4.bp.blogspot.com/_44lV0kDjySE/S7AG2AplKWI/AAAAAAAAAOo/ldgpYjK71w4/s400/UML-Import-SM-ImportUMLFileModule.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5453866673702775138" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;Next, we instruct the SPARQLMotion engine to convert the Java objects to RDF. This will start at the object specified by the variable uml, and then call all public getXY and isXY methods to collect the properties of the objects. The algorithm will include adjacent Java objects, as long as they are from a list of classes and packages specified under sml:javaClass:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_44lV0kDjySE/S7AII1SnHvI/AAAAAAAAAOw/md0LG6GJRtg/s1600/UML-Import-SM-ConvertJavaObjectsModule.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 270px; height: 338px;" src="http://1.bp.blogspot.com/_44lV0kDjySE/S7AII1SnHvI/AAAAAAAAAOw/md0LG6GJRtg/s400/UML-Import-SM-ConvertJavaObjectsModule.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5453868096582786802" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;As the output of this step, the module has produced an RDF graph containing instances as well as class and property definitions, all derived from the Java objects using reflection. All Java classes are mapped into a default namespace (abbreviated with the prefix "uml" in the screenshot below):&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_44lV0kDjySE/S7AJHAGBgmI/AAAAAAAAAO4/orHfvUlRr5E/s1600/UML-Import-InferredClasses.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 361px; height: 374px;" src="http://4.bp.blogspot.com/_44lV0kDjySE/S7AJHAGBgmI/AAAAAAAAAO4/orHfvUlRr5E/s400/UML-Import-InferredClasses.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5453869164634669666" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;A TopBraid Composer class diagram shows that the generated classes also have RDF properties associated with them, all automatically derived from the Java objects:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_44lV0kDjySE/S7AJ1ci-hMI/AAAAAAAAAPA/pJBpnCaOcvs/s1600/UML-Import-ClassDiagram.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 294px;" src="http://2.bp.blogspot.com/_44lV0kDjySE/S7AJ1ci-hMI/AAAAAAAAAPA/pJBpnCaOcvs/s400/UML-Import-ClassDiagram.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5453869962546283714" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;Now that we have those RDF/OWL classes, we can attach SPARQL CONSTRUCT queries as SPIN rules to them. (Here, we use a property umlspin:mappingRule which is a subproperty of spin:rule which has max iteration count set to 1 to speed up the mapping):&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_44lV0kDjySE/S7ALxCBI0iI/AAAAAAAAAPI/rg0AFPY1Q4Y/s1600/UML-Import-Rules.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 233px;" src="http://3.bp.blogspot.com/_44lV0kDjySE/S7ALxCBI0iI/AAAAAAAAAPI/rg0AFPY1Q4Y/s400/UML-Import-Rules.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5453872085728809506" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;These two example SPIN rules traverse the generated UML classes starting at the current class ?this, and create corresponding OWL classes and rdfs:subClassOf relationships between them. Of course, additional mapping rules are needed to represent the other UML elements such as associations and attributes. In our example SPARQLMotion script above, those SPIN rules are loaded from a generic mapping file umlspin.ttl. Note that the rules above call a user-defined SPIN function umlspin:getOWLClass that creates a URI resource from a namespace and a UML name.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;With those rules in place, we just need to run the SPIN rules engine (TopSPIN) and get an OWL class hierarchy from whatever has been defined in the UML file:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_44lV0kDjySE/S7ANDYLxIlI/AAAAAAAAAPQ/tckqz0RtTzI/s1600/UML-Import-Result.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 149px; height: 152px;" src="http://1.bp.blogspot.com/_44lV0kDjySE/S7ANDYLxIlI/AAAAAAAAAPQ/tckqz0RtTzI/s400/UML-Import-Result.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5453873500428247634" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;The approach presented here is not completely out-of-the-box yet, but you can see that it offers a great deal of flexibility because developers can add or change any number of SPIN rules to fine tune the mapping. For example, in one case you may want to create owl:ObjectProperties from UML associations, while in other cases a reified object might be a better choice.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The SPIN based importer raises the level of abstraction and makes it possible to define complex mappings without having to work with a programming language like Java. This empowers a larger group of people to contribute mapping rules. The UML/MOF world consists of many related standards, and the SPIN/SPARQLMotion-based mapping enables the domain experts of those standards (e.g. mechanical engineers) to fine tune the importers.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Finally, other EMF-based importers exist for formats such as XML Schema, and the approach presented above would of course also work for any other Java object model, as long as it provides access to its properties using getXY and isXY methods. You can basically connect your own native Java objects into an RDF triple store by providing a bit of glue code (as a SPARQLMotion module similar to the EMF loader above).&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31416365-4405608334980540663?l=composing-the-semantic-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/4405608334980540663'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/4405608334980540663'/><link rel='alternate' type='text/html' href='http://composing-the-semantic-web.blogspot.com/2010/03/converting-uml-files-to-rdf-via-javaemf.html' title='Converting UML Files to RDF via Java/EMF Objects and SPARQLMotion'/><author><name>Holger Knublauch</name><uri>http://www.blogger.com/profile/13180242480924209321</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://www.knublauch.com/images/platypus.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_44lV0kDjySE/S7AGLT7drLI/AAAAAAAAAOg/9jvGqTOc3zI/s72-c/UML-Import-SM-Script.png' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-31416365.post-993684182643190466</id><published>2010-03-25T18:49:00.000-07:00</published><updated>2010-03-25T19:29:08.967-07:00</updated><title type='text'>The SPARQLMotion Debugger</title><content type='html'>TopQuadrant's visual data processing language &lt;a href="http://sparqlmotion.org/"&gt;SPARQLMotion&lt;/a&gt; is now in routine use in many projects around the world. Its graphical notation and rich set of features makes it a powerful language to import, process and export linked data from almost any format, using Semantic Web technologies. Over the last two years, TopBraid's SPARQLMotion engine has become increasingly robust and it is now fair to say that it is becoming a de-facto standard language for linked data (at least in the professional world where the TBC-ME price tag is not an obstacle).&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;An important part of turning a (formerly) experimental language into an industry-strength solution is to provide tools that aid developers in the construction and testing phases of their project. In this spirit, we have added a graphical SPARQLMotion Debugger to &lt;a href="http://www.topquadrant.com/products/TB_Composer.html"&gt;TopBraid Composer&lt;/a&gt; 3.3. This debugger makes it possible to interrupt an executing SPARQLMotion script, to introspect into variable bindings and arguments, to ask test queries against the current state, and to display the current RDF graph.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Let's look into debugging the SPARQLMotion script shown below.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_44lV0kDjySE/S6wVgumuzkI/AAAAAAAAAN4/H-mPnILH6A0/s1600/SMDebugger-Graph.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 351px;" src="http://3.bp.blogspot.com/_44lV0kDjySE/S6wVgumuzkI/AAAAAAAAAN4/H-mPnILH6A0/s400/SMDebugger-Graph.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5452756900849307202" /&gt;&lt;/a&gt;There are now two execution buttons at the top of the SPARQLMotion graph editor. The green arrow executes the script normally. If a module has been selected, then the script will only execute until this point. The green bug button will execute the script but immediately open the debugger window. The debugger will also be shown whenever a module is reached that has a breakpoint attached to it. To set a breakpoint, select a module and then press the button with the small blue dot. In either case, the debugger will show up as shown below.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_44lV0kDjySE/S6wXK_c1ZyI/AAAAAAAAAOI/VP9cJOzDScc/s1600/SMDebugger-VariablesTab.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 244px;" src="http://3.bp.blogspot.com/_44lV0kDjySE/S6wXK_c1ZyI/AAAAAAAAAOI/VP9cJOzDScc/s400/SMDebugger-VariablesTab.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5452758726437332770" /&gt;&lt;/a&gt;The left part of the debugger displays the currently executed modules, including those from nested sub-scripts (shown indented under their parents). You can set additional breakpoints there to make sure you don't miss anything important. The main area of the debugger can be switched between three different tabs, including the Variables tab shown above. This tab displays all current input variable bindings, allowing you to see the exact state of the engine when it enters the current module. Below the variables, you can see the input arguments to the current module. The values of those arguments are shown in exactly the same way as the engine will interpret them, e.g. they will have string templates applied to them already.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The next tab can be used to ask arbitrary SPARQL queries to further explore what the current module will see when it executes. If the module takes a SPARQL query as an input argument, then this will be suggested as the initial query.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_44lV0kDjySE/S6wYcq0htKI/AAAAAAAAAOQ/pXXH4RauNGc/s1600/SMDebugger-QueryTab.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 244px;" src="http://2.bp.blogspot.com/_44lV0kDjySE/S6wYcq0htKI/AAAAAAAAAOQ/pXXH4RauNGc/s400/SMDebugger-QueryTab.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5452760129648833698" /&gt;&lt;/a&gt;Finally, if you wonder about the structure of the input RDF graphs, you can switch to the third tab (shown below). The tree structure of the graphs represents the imports closure (sub-graphs). Having this view will be helpful if you wonder why certain queries don't work as expected - they may operate on a different set of input graphs than you may believe.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_44lV0kDjySE/S6wY3cLeGtI/AAAAAAAAAOY/XINf_lSyFXk/s1600/SMDebugger-InputGraphsTab.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 244px;" src="http://2.bp.blogspot.com/_44lV0kDjySE/S6wY3cLeGtI/AAAAAAAAAOY/XINf_lSyFXk/s400/SMDebugger-InputGraphsTab.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5452760589575002834" /&gt;&lt;/a&gt;When all is said and done, you can use the buttons at the bottom to either continue the execution up to the next breakpoint, or to step into the next executing module. Note that the debugger will also show up when you run web services and TopBraid Ensemble callbacks.&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The new SPARQLMotion Debugger addresses one major challenge that many users have: understanding exactly what's happening. SPARQLMotion is now no longer a black box, and there is no longer the need to create artificial debugging and trace output to trace what's happening behind the scenes. I am confident this debugger will significantly reduce the learning curve and create many happy SPARQLMotion users.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31416365-993684182643190466?l=composing-the-semantic-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://composing-the-semantic-web.blogspot.com/feeds/993684182643190466/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=31416365&amp;postID=993684182643190466' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/993684182643190466'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/993684182643190466'/><link rel='alternate' type='text/html' href='http://composing-the-semantic-web.blogspot.com/2010/03/sparqlmotion-debugger.html' title='The SPARQLMotion Debugger'/><author><name>Holger Knublauch</name><uri>http://www.blogger.com/profile/13180242480924209321</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://www.knublauch.com/images/platypus.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_44lV0kDjySE/S6wVgumuzkI/AAAAAAAAAN4/H-mPnILH6A0/s72-c/SMDebugger-Graph.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-31416365.post-1206544739305118210</id><published>2009-11-02T09:23:00.000-08:00</published><updated>2009-11-02T09:23:00.179-08:00</updated><title type='text'>Magic Properties with SPIN</title><content type='html'>&lt;a href="http://esw.w3.org/topic/SPARQL/Extensions/Computed_Properties"&gt;Magic Properties&lt;/a&gt; (aka property functions) are a popular extension point supported by many SPARQL engines. Looking like normal triple matches, magic properties can be used to dynamically compute property values even if there are no corresponding triples in the actual model. For example, in the kennedys ontology, a magic property called :grandParent could be used to dynamically find grandparent relationships even though only the direct parent relationships are asserted in the model:&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_44lV0kDjySE/St4UbQwIlfI/AAAAAAAAAMY/p-sil3nhv_k/s1600-h/MagicProperty-usage.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 374px; height: 223px;" src="http://2.bp.blogspot.com/_44lV0kDjySE/St4UbQwIlfI/AAAAAAAAAMY/p-sil3nhv_k/s400/MagicProperty-usage.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5394771862222312946" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;In the example above, the SPARQL engine will use some internal "magic" to figure out which values need to be returned for the ?grandParent variable. How this internal magic is implemented is left to the particular engine, and in the case of Jena this is simply a Java method call in which people can add their own custom code.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;These magic properties can be extremely powerful, and often are the only escape mechanism if the default expressivity of SPARQL isn't good enough for a task. However, the current mechanisms of defining such magic properties require low-level (Java) programming and leads to queries that are neither transparent to the end user, nor platform independent.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The new version of &lt;a href="http://spinrdf.org/"&gt;SPIN&lt;/a&gt; 1.1 addresses those shortcomings and provides a powerful mechanism for defining magic properties entirely in RDF. Let's look at an example first. The following TopBraid Composer 3.2 screenshot shows the definition of the magic property :grandParent:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_44lV0kDjySE/St4WyyNo0cI/AAAAAAAAAMg/TRaXbSSAs-8/s1600-h/MagicProperty-definition.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 275px; height: 400px;" src="http://4.bp.blogspot.com/_44lV0kDjySE/St4WyyNo0cI/AAAAAAAAAMg/TRaXbSSAs-8/s400/MagicProperty-definition.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5394774465364677058" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;A magic SPIN property is an instance of the property metaclass spin:MagicProperty. Like &lt;a href="http://composing-the-semantic-web.blogspot.com/2009/01/understanding-spin-functions.html"&gt;regular SPIN functions&lt;/a&gt;, magic properties can define arguments that represent the left hand side of the magic property. Here, the argument sp:arg1 has type kennedys:Person indicating that this property can be applied to subjects of type Person. The results of the right hand side of the triple are computed by the nested SPARQL query specified as spin:body. In this body, the variable ?arg1 represents the Person whose grand parents we are asking for. When a SPIN-aware SPARQL engine hits the triple pattern with the :grandParent predicate in it, it will execute the nested body query and bind the variable on the right with the results of the SELECT query. The results in the first screenshot (JosephKennedy and RoseFitzgerald) have been computed this way: the grand parents are the parents of the parents.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;An interesting characteristic of magic properties is that they may be applied in any "direction", i.e. either with a variable on the subject position, a variable as object or even in both places. For example, the :grandParent relationship can be queried to find all grand children of RoseFitzgerald (including JohnKennedyJr):&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_44lV0kDjySE/St4ZjBlCuzI/AAAAAAAAAMo/XTADaGAXR8A/s1600-h/MagicProperty-usage2.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 342px; height: 317px;" src="http://3.bp.blogspot.com/_44lV0kDjySE/St4ZjBlCuzI/AAAAAAAAAMo/XTADaGAXR8A/s400/MagicProperty-usage2.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5394777493146352434" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;In this case, the nested SPARQL query is simply executed with different bindings (?arg1 is left blank and ?grandParent is pre-bound with RoseFitzgerald). We can also leave both sides blank and the system will return all existing grand parent/grand child relationships in the whole model.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Now comes the really interesting bit. Think about it: this is a mechanism that can be used to define new (SPARQL) predicates entirely based on other SPARQL queries. These SPARQL queries may be recursive and may use other magic properties. The SPARQL engine can walk through the results delivered by one magic property and, while doing this, can consider any other kind of background knowledge that it needs to compute to fulfill its task. If a solution does not lead to new matches, the system will backtrack and try the next one. In traditional rule languages (incl. Prolog) this technique is called &lt;a href="http://en.wikipedia.org/wiki/Backward_chaining"&gt;backward chaining&lt;/a&gt;. Each user-defined magic SPIN property can be regarded as a rule that is fired on demand to support the task of solving a goal (finding matches).&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Magic SPIN properties greatly extend the power of SPARQL, and do so in a very transparent and Semantic Web compliant way.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31416365-1206544739305118210?l=composing-the-semantic-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://composing-the-semantic-web.blogspot.com/feeds/1206544739305118210/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=31416365&amp;postID=1206544739305118210' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/1206544739305118210'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/1206544739305118210'/><link rel='alternate' type='text/html' href='http://composing-the-semantic-web.blogspot.com/2009/11/magic-properties-with-spin.html' title='Magic Properties with SPIN'/><author><name>Holger Knublauch</name><uri>http://www.blogger.com/profile/13180242480924209321</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://www.knublauch.com/images/platypus.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_44lV0kDjySE/St4UbQwIlfI/AAAAAAAAAMY/p-sil3nhv_k/s72-c/MagicProperty-usage.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-31416365.post-2478802860588521906</id><published>2009-11-02T09:19:00.000-08:00</published><updated>2009-11-02T09:21:15.497-08:00</updated><title type='text'>SPARQL Debugger and Profiler</title><content type='html'>&lt;div&gt;SPARQL queries may get complex and often contain a series of operators such as triple matches, filter clauses, optional statements and unions. In many cases, building correct and efficient queries using those elements requires multiple attempts.  This is often because it is difficult to see what the SPARQL engine is doing under the hood.&lt;/div&gt;&lt;br /&gt;&lt;div&gt;As of version 3.2, TopBraid Composer (Maestro Edition) introduces a Debugger View that has been designed to help query designers by providing an interactive view into a query at execution time.  The Debugger can be used to:&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Display the internal data structure (algebra) that the SPARQL engine is using to execute the query&lt;/li&gt;  &lt;li&gt;To walk through the execution of the query&lt;/li&gt;  &lt;li&gt;To display intermediate variable bindings&lt;/li&gt;  &lt;li&gt;To execute a query until it reaches a certain &lt;em&gt;break point&lt;/em&gt;&lt;/li&gt;  &lt;li&gt;To collect statistics about the number of query steps involved in every operator&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;This is a sophisticated feature that can be extremely powerful, but it also requires a decent understanding of how SPARQL works. People with some programming background may find the debugger more useful than beginners.&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;b&gt;Background&lt;/b&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;Let's start with some background on how SPARQL works. The key feature of SPARQL is the WHERE clause, which contains conditions that return variable bindings based on the query graph. Depending on the type of query, these variable bindings are then returned in the SELECT clause, or used to CONSTRUCT new triples. In order to understand the characteristics of a query, we therefore need to focus on the WHERE clause, and modifiers such as ORDER BY.&lt;/div&gt;&lt;br /&gt;When a query is processed, the SPARQL engine will first create an internal data structure, called &lt;a href="http://www.w3.org/TR/rdf-sparql-query/#sparqlDefinition"&gt;Algebra&lt;/a&gt;. The query is executing this data structure, while the textual representation with keywords such as SELECT and WHERE only serves as the user interface and query exchange language.  It is important to understand that different query syntaxes may be converted into the same algebra data structure, and that the same query syntax may be rendered into different algebras depending on the choices of the SPARQL engine. In particular, the engine may decide to optimize certain patterns. Seeing the internal data structure will often lead to surprising results.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;For example, the query&lt;/div&gt;&lt;pre&gt;SELECT ?subject ?object&lt;br /&gt;WHERE {&lt;br /&gt;   ?subject rdfs:subClassOf ?object .&lt;br /&gt;   ?subject rdfs:label ?label .&lt;br /&gt;   FILTER (fn:starts-with(?label, "C")) .&lt;br /&gt;}&lt;/pre&gt;&lt;div&gt;is converted into a SPARQL Algebra data structure that can be rendered into textual form as follows:&lt;/div&gt;&lt;pre&gt;(project (?subject ?object)&lt;br /&gt;(filter (fn:starts-with ?label "C")&lt;br /&gt;  (bgp&lt;br /&gt;    (triple ?subject rdfs:subClassOf ?object)&lt;br /&gt;    (triple ?subject rdfs:label ?label)&lt;br /&gt;)))&lt;/pre&gt;&lt;div&gt;In this notation, you can see that the SPARQL engine is working with a nested tree structure of operators such as &lt;code&gt;project&lt;/code&gt;, &lt;code&gt;filter &lt;/code&gt;and &lt;code&gt;bgp&lt;/code&gt;.  These operators typically have attributes or child elements, for example &lt;code&gt;bgp&lt;/code&gt; (Basic Graph Pattern) contains a list of triple patterns to evaluate. Note that it is up to the SPARQL engine to optimize those operators so that they lead to fewer database requests. In particular, multiple triple matches may be combined to a single operation to benefit from server-side joins.&lt;/div&gt;&lt;br /&gt;&lt;div&gt;The Algebra operators form a tree structure, in which each node returns an iterator of variable bindings.  For example, the basic graph pattern above may return the binding ?label="Matriarch"^^xsd:string, ?object=Person, ?subject=Matriarch.  These bindings are served up to the next operator in the processing pipeline.  For example, the filter operator will evaluate whether the ?label starts with "C" and then pass the same bindings to its parent operation, the project step.  Thus, each operator receives a stream of input bindings and may create new bindings for its parent.  The final results of the query are the output bindings of the root operator (here, project).&lt;/div&gt;&lt;br /&gt;&lt;div&gt;The algorithm of the SPARQL engine (at least the Jena ARQ engine used by Composer) follows the evaluation model above, and builds a nested hierarchy of iterators.  Each of those iterators has two main functions:&lt;/div&gt;&lt;ol&gt;&lt;li&gt;&lt;code&gt;hasNext&lt;/code&gt; to check whether there is any additional result binding available&lt;/li&gt;  &lt;li&gt;&lt;code&gt;next&lt;/code&gt; to return the next binding and move to the next step&lt;/li&gt;&lt;/ol&gt;&lt;div&gt;The SPARQL Debugger allows users to trace the evaluation of the SPARQL engine to see when &lt;code&gt;hasNext&lt;/code&gt; and &lt;code&gt;next&lt;/code&gt; are invoked, and whether they return new variable bindings.  When you step through the query manually, the user interface will display arrows in different colors to illustrate the current position, and display variable bindings in a table. &lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;b&gt;Getting Started with the Debugger View&lt;/b&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;TopBraid Composer's SPARQL Debugger is accessible from multiple places:&lt;/div&gt;&lt;ul&gt;&lt;li&gt;In the SPARQL View, use the &lt;b&gt;Debug query &lt;/b&gt;button to open the currently edited query in the Debugger view.&lt;/li&gt;  &lt;li&gt;In the context menu of &lt;code&gt;spin:rule&lt;/code&gt; property values on the form, use &lt;b&gt;Debug SPIN query&lt;/b&gt; to debug the SPIN rule. Note that this may add a clause &lt;code&gt;?this rdf:type [Class] &lt;/code&gt;to the query, just like the SPIN engine would do.&lt;/li&gt; &lt;/ul&gt;&lt;br /&gt;&lt;div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_44lV0kDjySE/St4sQqPm02I/AAAAAAAAANI/FsntqcaniPY/s1600-h/SPARQLDebugger-Overview.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 168px;" src="http://1.bp.blogspot.com/_44lV0kDjySE/St4sQqPm02I/AAAAAAAAANI/FsntqcaniPY/s400/SPARQLDebugger-Overview.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5394798068365710178" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;As shown above, the Debugger is split into multiple areas. The main area on the left displays the query.  Two different renderings are available:&lt;/div&gt;&lt;ul&gt;   &lt;li&gt;&lt;b&gt;Algebra&lt;/b&gt; displays the internal Jena ARQ data structure&lt;/li&gt;   &lt;li&gt;&lt;b&gt;SPARQL&lt;/b&gt; displays the same query in pseudo-SPARQL, which is derived from the Algebra (reverse engineered if you want) and therefore may look different from the original SPARQL syntax.&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;You can switch between those two renderings at any time and will get the same features.  Depending on your experience, the SPARQL view might be easier to get started, but the Algebra view is much more informative as it provides the real underlying data structure.&lt;/div&gt;&lt;br /&gt;Both textual views have a control bar on their left border. This bar displays the current step position with an arrow, and also displays any break points.  Double-click on the bar to set or remove break points.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;On the right hand side, a table displays current variable bindings. These are only filled if the current execution step is "green", i.e. is returning the &lt;code&gt;next&lt;/code&gt; operation with some values.&lt;/div&gt;&lt;br /&gt;&lt;div&gt;The tool bar contains buttons to control the behavior of the SPARQL view. The following buttons are available:&lt;/div&gt;&lt;ul&gt;  &lt;li&gt;&lt;b&gt;Run&lt;/b&gt; continues the execution of the query until the next break point.&lt;/li&gt;  &lt;li&gt;&lt;b&gt;Step Over&lt;/b&gt; continues the execution of the query to the next step.&lt;/li&gt;  &lt;li&gt;&lt;b&gt;Profiler&lt;/b&gt; activates or de-activates profiling.  When activated, the engine will record the triple matches (findSPO) queries done against the triple source, and display the resulting statistics behind each operation.&lt;/li&gt;  &lt;li&gt;&lt;b&gt;Layout vertically&lt;/b&gt; switches between vertical and horizontal layout. Horizontal layout is better suitable for "wide" queries, vertical layout for lots of variable bindings.&lt;/li&gt;  &lt;li&gt;&lt;b&gt;Preferences&lt;/b&gt; opens up the SPARQL Preferences page, which may impact how the SPARQL engine optimizes the query algebra.  Changes will have effect after restarting the query.&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;b&gt;Profiling&lt;/b&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;If profiling mode has been activated (and, if needed, the query restarted), then the query engine will operate on a modified triple store which, as a side effect of running queries, will also collect statistical information. In particular, this records which find(SPO) queries have been made, and how many triples have been iterated over.  The accumulated numbers of those calls (find/triples) will be displayed for each operation in cyan color on the right edge of the text display.  In the following example, there are two triple patterns that lead to low-level queries.&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_44lV0kDjySE/St4wEDaOhnI/AAAAAAAAANQ/phT2lIA5pqc/s1600-h/SPARQLDebugger-Profiling.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 287px; height: 172px;" src="http://3.bp.blogspot.com/_44lV0kDjySE/St4wEDaOhnI/AAAAAAAAANQ/phT2lIA5pqc/s400/SPARQLDebugger-Profiling.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5394802249829353074" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;In the above screen shot, the upper triple match just leads to a single query (for all rdfs:subClassOf triples), and this query has (so far) returned 15 matches.  The second (optional) triple match has been executed 15 times (for each of the former matches), but only five results were found so far.  From these numbers you can see that the optional operation is far more "expensive" in terms of number of queries than the subClassOf query.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;To summarize, TopBraid's new SPARQL debugger is a powerful low-level tool for people who want to understand the execution behavior of a query or SPIN rule in the SPARQL engine. The debugger and its profiler can provide valuable insights that may lead to much more efficient queries.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31416365-2478802860588521906?l=composing-the-semantic-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://composing-the-semantic-web.blogspot.com/feeds/2478802860588521906/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=31416365&amp;postID=2478802860588521906' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/2478802860588521906'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/2478802860588521906'/><link rel='alternate' type='text/html' href='http://composing-the-semantic-web.blogspot.com/2009/11/sparql-debugger-and-profiler.html' title='SPARQL Debugger and Profiler'/><author><name>Holger Knublauch</name><uri>http://www.blogger.com/profile/13180242480924209321</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://www.knublauch.com/images/platypus.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_44lV0kDjySE/St4sQqPm02I/AAAAAAAAANI/FsntqcaniPY/s72-c/SPARQLDebugger-Overview.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-31416365.post-2129323126014860059</id><published>2009-10-30T13:29:00.000-07:00</published><updated>2009-10-30T19:17:47.950-07:00</updated><title type='text'>Fixing Constraint Violations with spin:fix</title><content type='html'>&lt;div&gt;&lt;a href="http://composing-the-semantic-web.blogspot.com/2009/01/video-sparql-based-inferencing-and.html"&gt;Constraint checking&lt;/a&gt; is a popular feature of many Semantic Web tools to ensure that instance data meets the design objectives attached to classes and properties in an ontology. Data entry tools like TopBraid Composer and Ensemble use the SPARQL-based constraint checking language SPIN to make sure that users get warnings if the data they are entering is violating constraints. If a violation is reported, the user would read through the violation message and then change the data on the form.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;One of the new features of &lt;a href="http://spinrdf.org/"&gt;SPIN&lt;/a&gt; 1.1 is the property &lt;b&gt;spin:fix&lt;/b&gt; which can be used to let the system suggest operations that would repair a constraint violation automatically. The basic idea is that spin:fix can be attached to the spin:ConstraintViolation produced by a spin:constraint query to link the violation with one or more SPARQL Update requests. Those SPARQL Update requests may INSERT or DELETE triples to create a state in which the constraint is no longer violated. If spin:fixes are created, then the user interface may suggest them to the user with a single click. In the TopBraid Composer 3.2 screenshot below, the resource InvalidSquare violates the constraint that instances of Square must have equal width and height:&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_44lV0kDjySE/St4jiTpL48I/AAAAAAAAAMw/sc5TVjUYHMk/s1600-h/SPINFix-usage.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 356px; height: 361px;" src="http://1.bp.blogspot.com/_44lV0kDjySE/St4jiTpL48I/AAAAAAAAAMw/sc5TVjUYHMk/s400/SPINFix-usage.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5394788475931976642" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;The following spin:constraint (attached to the Square class) implements the suggestions above:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_44lV0kDjySE/St4kRVVKIXI/AAAAAAAAAM4/0X3kpG7Y59U/s1600-h/SPINFix-definition.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 242px; height: 288px;" src="http://4.bp.blogspot.com/_44lV0kDjySE/St4kRVVKIXI/AAAAAAAAAM4/0X3kpG7Y59U/s400/SPINFix-definition.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5394789283838697842" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;You can see that the constraint creates a spin:ConstraintViolation that is attached to two instances of :SetObject via spin:fix. The class :SetObject is a SPIN template with the following definition:&lt;/div&gt;&lt;div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_44lV0kDjySE/St4llQ-WF4I/AAAAAAAAANA/iAgHK-ILH6Q/s1600-h/SPINFix-template.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 229px; height: 400px;" src="http://4.bp.blogspot.com/_44lV0kDjySE/St4llQ-WF4I/AAAAAAAAANA/iAgHK-ILH6Q/s400/SPINFix-template.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5394790725778282370" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;The SPIN templates suggested as fixes could come from a library of re-usable building blocks. I assume that most constraint violations can be repaired by replacing, adding or deleting certain triples, and these cases can be generalized easily. Furthermore, the spin:constraints themselves can be generalized into templates, so that the ontology designer in the end just needs to pick the correct template to get a really powerful and convenient constraint checking mechanism.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Also note that the constraint fixing mechanism above could be useful beyond user interfaces, for example to automatically repair incoming data streams in web service calls.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31416365-2129323126014860059?l=composing-the-semantic-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://composing-the-semantic-web.blogspot.com/feeds/2129323126014860059/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=31416365&amp;postID=2129323126014860059' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/2129323126014860059'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/2129323126014860059'/><link rel='alternate' type='text/html' href='http://composing-the-semantic-web.blogspot.com/2009/10/fixing-constraint-violations-with.html' title='Fixing Constraint Violations with spin:fix'/><author><name>Holger Knublauch</name><uri>http://www.blogger.com/profile/13180242480924209321</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://www.knublauch.com/images/platypus.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_44lV0kDjySE/St4jiTpL48I/AAAAAAAAAMw/sc5TVjUYHMk/s72-c/SPINFix-usage.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-31416365.post-1781956938244165768</id><published>2009-10-27T19:33:00.000-07:00</published><updated>2009-10-27T20:17:35.762-07:00</updated><title type='text'>OWL 2 Support in TopBraid Composer</title><content type='html'>Following today's announcement that &lt;a href="http://www.w3.org/TR/owl2-overview/"&gt;OWL 2&lt;/a&gt; has become an official W3C recommendation, I am pleased to announce that &lt;a href="http://www.topquadrant.com/products/TB_Composer.html"&gt;TopBraid Composer&lt;/a&gt; 3.2 (to be published by the end of this week) has comprehensive OWL 2 support. Here is a sampler of some of the new capabilities.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Property Chain Axioms&lt;/b&gt; can be used to define relationships between multiple properties, for example to define that an uncle is the brother of a parent. In OWL 2 mode, TopBraid's Properties form contains a new widget for entering such property chains using owl:propertyChainAxiom. Another kind of new property axioms, owl:propertyDisjointWith can be edited on the same page.&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_44lV0kDjySE/Suev0FMbXVI/AAAAAAAAANY/SzW3i7_-guY/s1600-h/OWL2-PropertyChainAxioms.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 364px; height: 322px;" src="http://1.bp.blogspot.com/_44lV0kDjySE/Suev0FMbXVI/AAAAAAAAANY/SzW3i7_-guY/s400/OWL2-PropertyChainAxioms.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5397475987709189458" /&gt;&lt;/a&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;User-Defined Datatypes&lt;/b&gt; are a mechanism of narrowing down datatype properties to specific value ranges, such as integer &gt; 0. In typical cases, such datatypes are entered as allValuesFrom restrictions on the class form. We use the &lt;a href="http://www.w3.org/TR/owl2-manchester-syntax/"&gt;Manchester Syntax&lt;/a&gt; for that purpose:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_44lV0kDjySE/SuexzJzvVcI/AAAAAAAAANg/C8_L60FfLlI/s1600-h/OWL2-DatatypeRestriction.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 281px; height: 266px;" src="http://1.bp.blogspot.com/_44lV0kDjySE/SuexzJzvVcI/AAAAAAAAANg/C8_L60FfLlI/s400/OWL2-DatatypeRestriction.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5397478170791204290" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;In addition to class axioms, user-defined datatypes can also be used as global rdfs:ranges:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_44lV0kDjySE/SueyajqxCiI/AAAAAAAAANo/BiJ87Cv2Uho/s1600-h/OWL2-DatatypeRange.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 302px; height: 332px;" src="http://1.bp.blogspot.com/_44lV0kDjySE/SueyajqxCiI/AAAAAAAAANo/BiJ87Cv2Uho/s400/OWL2-DatatypeRange.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5397478847747787298" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;OWL 2 Class Axioms&lt;/b&gt; including qualified cardinality restrictions and all other features supported by the Manchester Syntax can be entered on the class forms:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_44lV0kDjySE/SuezZctDH6I/AAAAAAAAANw/f9sq_8H1D48/s1600-h/OWL2-ClassAxioms.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 345px; height: 323px;" src="http://2.bp.blogspot.com/_44lV0kDjySE/SuezZctDH6I/AAAAAAAAANw/f9sq_8H1D48/s400/OWL2-ClassAxioms.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5397479928210071458" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;All other OWL 2 extensions such as new property meta-classes, keys and syntactic sugar can be edited through the generic RDF editing capabilities of TopBraid - the extended OWL 2 system vocabulary has been very helpful for this. Of course, TopBraid Composer can load and save any OWL 2 file in formats such as RDF/XML or Turtle.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;At the time of writing this, I am not aware of any OWL 2 compliant inference engines that we could freely distribute with TopBraid Composer. Currently available options include OWL RL engines such as &lt;a href="http://composing-the-semantic-web.blogspot.com/2009/01/owl-2-rl-in-sparql-using-spin.html"&gt;SPIN&lt;/a&gt; or Oracle 11g RDF. I am sure more will follow, and anyone in the community is invited to contribute plug-ins to those inference engines that we cannot legally ship with our platform, as separate downloads.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The new OWL 2 support is available in all editions of TopBraid Composer, including the &lt;a href="http://www.topquadrant.com/products/TB_Composer.html#free"&gt;Free Edition&lt;/a&gt;.&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31416365-1781956938244165768?l=composing-the-semantic-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://composing-the-semantic-web.blogspot.com/feeds/1781956938244165768/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=31416365&amp;postID=1781956938244165768' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/1781956938244165768'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/1781956938244165768'/><link rel='alternate' type='text/html' href='http://composing-the-semantic-web.blogspot.com/2009/10/owl-2-support-in-topbraid-composer.html' title='OWL 2 Support in TopBraid Composer'/><author><name>Holger Knublauch</name><uri>http://www.blogger.com/profile/13180242480924209321</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://www.knublauch.com/images/platypus.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_44lV0kDjySE/Suev0FMbXVI/AAAAAAAAANY/SzW3i7_-guY/s72-c/OWL2-PropertyChainAxioms.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-31416365.post-8626598306300243275</id><published>2009-10-19T15:15:00.000-07:00</published><updated>2009-10-19T15:46:12.417-07:00</updated><title type='text'>RDFex: Partial ontology imports</title><content type='html'>One of the overall design goals of Linked Data and the Semantic Web is vocabulary re-use. Instead of having thousands of "Person" classes, new ontologies should attempt to re-use existing Person definitions, such as those found in the &lt;a href="http://www.foaf-project.org/"&gt;FOAF&lt;/a&gt; namespace. This schema re-use makes it easier for Semantic Web agents to link data together, and potentially reduces the maintenance costs as it becomes possible to benefit from the whole infrastructure and community around those shared ontologies.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;However, there are a couple of well-known reasons why such a re-use is not always feasible or desirable, leading to situations in which developers feel they need to reinvent the wheel. One particular problem is that the OWL construct for linking vocabularies (owl:imports) has all-or-nothing semantics: if my ontology owl:imports the FOAF namespace, then I would suck all definitions of FOAF into my own model, even though I just care about one or two concepts. The result is that in Semantic Web inference engines, browsers or editors, my ontology will be full of definitions that are just distracting, or unnecessarily increase the complexity of my model. Since owl:imports is not the ideal mechanism, people sometimes simply extract term definitions from other files and paste them into their own files - look for example at the bottom of &lt;a href="http://bloody-byte.net/rdf/cidoc-crm/mappings.ttl"&gt;this&lt;/a&gt; file. This, of course, leads to other maintenance problems and is generally not a clean approach.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;For an internal project in which I wanted to re-use parts of the SIOC namespace, I have implemented a new web service called &lt;a href="http://rdfex.org/"&gt;&lt;b&gt;rdfex.org&lt;/b&gt;&lt;/a&gt;. RDFex is a very simple, yet IMHO elegant, mechanism for using owl:imports to import snippets of other namespaces without having to copy and paste them. The basic idea is that the rdfex.org server can be used as a proxy for various popular ontologies (including DC, FOAF and SIOC), so that users can specify which classes, properties and individuals from those namespaces they would like to import (using owl:imports). For example, the proxy ontology &lt;a href="http://rdfex.org/foaf/Person,firstName"&gt;http://rdfex.org/foaf/Person,firstName&lt;/a&gt; represents all triples defining the class foaf:Person and the property foaf:firstName, including their rdf:type, rdfs:labels, rdfs:comments and any relationships between those terms (such as rdfs:domain and rdfs:range). Any combination of those resources is available because the result will be dynamically assembled at request time.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The upcoming release of the TopBraid platform 3.2 also has native support for those rdfex imports, so that the system can do this extraction from local copies instead of having to go to the web. TopQuadrant is committed to supporting this service in the future, so please feel free to use it if you find it useful.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31416365-8626598306300243275?l=composing-the-semantic-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://composing-the-semantic-web.blogspot.com/feeds/8626598306300243275/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=31416365&amp;postID=8626598306300243275' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/8626598306300243275'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/8626598306300243275'/><link rel='alternate' type='text/html' href='http://composing-the-semantic-web.blogspot.com/2009/10/rdfex-partial-ontology-imports.html' title='RDFex: Partial ontology imports'/><author><name>Holger Knublauch</name><uri>http://www.blogger.com/profile/13180242480924209321</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://www.knublauch.com/images/platypus.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-31416365.post-4136770497036042698</id><published>2009-09-04T10:00:00.000-07:00</published><updated>2009-09-04T10:47:18.930-07:00</updated><title type='text'>Currency conversion with the Units Ontology, SPARQLMotion and SPIN</title><content type='html'>&lt;div&gt;As the Linked Data cloud is steaming ahead, the first large online stores (recently: &lt;a href="http://lists.w3.org/Archives/Public/semantic-web/2009Aug/0145.html"&gt;BestBuy.com&lt;/a&gt;) are publishing their products in a machine-friendly RDF format. In order to exchange product information in a meaningful way, the various product vendors should use a shared (or at least mappable) vocabulary to represent prices, so that internet search engines and crawlers can better compare values. In the real world, &lt;a href="http://www.xe.com/iso4217.php"&gt;three-letter currency codes&lt;/a&gt; such as USD, EUR and AUD are being used. These abbreviations are a standard vocabulary, but having just a string representation is an error-prone strategy - e.g. the string "AMD" could be either the Armenian Drams currency, or a computer chip manufacturer.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;We have recently &lt;a href="http://composing-the-semantic-web.blogspot.com/2009/08/units-ontology-with-spin-support.html"&gt;published&lt;/a&gt; a comprehensive &lt;a href="http://qudt.org/"&gt;units ontology (QUDT)&lt;/a&gt; that also includes all of the world's currencies. For each currency, a globally unique identifier (URI) is used. These URI resources also point back to the currency abbreviation, using a property called qud:abbreviation. A good strategy for ontology designers would be to use those URIs as ranges of their properties, instead of string codes. Using those standard URIs will have some benefits down the road...&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;This morning I have created a &lt;a href="http://topbraid.org/spin/currencies"&gt;SPIN library of currency conversion functions&lt;/a&gt; that can be used to convert between various currencies, using the very latest conversion factors. These functions can be used in SPARQL queries or SPIN rules. For example, we have a function currencies:getRateByCodes that gets the latest exchange rate between two currencies, specified by the three-letter codes:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_44lV0kDjySE/SqFMbh6yYpI/AAAAAAAAALo/4RBL3A6rgtU/s1600-h/getRateByCodes-Example.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 373px; height: 209px;" src="http://4.bp.blogspot.com/_44lV0kDjySE/SqFMbh6yYpI/AAAAAAAAALo/4RBL3A6rgtU/s400/getRateByCodes-Example.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5377663465902203538" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;This particular SPIN function is backed by a &lt;a href="http://sparqlmotion.org/"&gt;SPARQLMotion&lt;/a&gt; script that takes two currency codes (arg1 and arg2) as input and then calls an external web service to retrieve the latest exchange rate. The web service delivers XML, and a simple XPath expression is used to extract the value into an xsd:float RDF literal:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_44lV0kDjySE/SqFMNY5CtLI/AAAAAAAAALg/MY0kpWLC1QQ/s1600-h/getRate-SPARQLMotion-Script.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 342px; height: 400px;" src="http://3.bp.blogspot.com/_44lV0kDjySE/SqFMNY5CtLI/AAAAAAAAALg/MY0kpWLC1QQ/s400/getRate-SPARQLMotion-Script.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5377663222960796850" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;We can drill into the Call web service module to see that it is simply calling a REST web service, inserting the two arguments into the URL string:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_44lV0kDjySE/SqFOdkDl7rI/AAAAAAAAAL4/DBws0cE8Uls/s1600-h/CallWebService-Details.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 168px;" src="http://3.bp.blogspot.com/_44lV0kDjySE/SqFOdkDl7rI/AAAAAAAAAL4/DBws0cE8Uls/s400/CallWebService-Details.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5377665699859001010" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Based on this low-level function, we can define additional higher-level functions. The following screenshot shows the complete definition of a &lt;a href="http://www.google.com/url?q=http://composing-the-semantic-web.blogspot.com/2009/01/understanding-spin-functions.html"&gt;SPIN function&lt;/a&gt; that takes two qud:CurrencyUnits as input, then gets their respective abbreviations, and finally calls the getRateByCodes function:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_44lV0kDjySE/SqFNfbbIErI/AAAAAAAAALw/-waQvn10I0o/s1600-h/getRateByCurrencies-Form.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 300px; height: 400px;" src="http://1.bp.blogspot.com/_44lV0kDjySE/SqFNfbbIErI/AAAAAAAAALw/-waQvn10I0o/s400/getRateByCurrencies-Form.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5377664632389898930" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Whenever the function is called, any SPIN-aware SPARQL engine will simply execute the SELECT query specified as the body of the function. This means that new functions are built by combining other functions. The same mechanism was used to define the convertLiteral function, as shown below:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_44lV0kDjySE/SqFPoMOHreI/AAAAAAAAAMA/agiIONzAsPA/s1600-h/convertLiteral-Form.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 331px; height: 400px;" src="http://3.bp.blogspot.com/_44lV0kDjySE/SqFPoMOHreI/AAAAAAAAAMA/agiIONzAsPA/s400/convertLiteral-Form.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5377666981950893538" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;The function above makes good use of the QUDT units ontology to shield the user from any low-level details. All the user needs to do is to specify the range of a property to be, say, unit:USDollar, and then all future values of that property will be stored as literals with that unit as datatype. The SPIN function can then look at the literal to find out about its currency. Then, the function can look up the unit's abbreviation and make the corresponding web service calls to fetch the current exchange rate. Finally, a simple multiplication returns the desired new value.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Once these functions are defined, they can be used in various places. For example, here is a class Product, which has two properties: one stores the price in US Dollars, and another represents the price in Australian Dollars. Only the USD price needs to be entered, because the class also has a &lt;a href="http://spinrdf.org/spin.html#spin-rules"&gt;SPIN rule&lt;/a&gt; attached to it which will automatically do this computation as an inference:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_44lV0kDjySE/SqFQ9ds0pGI/AAAAAAAAAMI/wu25MUrRK7A/s1600-h/Product-Class-Form.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 279px;" src="http://1.bp.blogspot.com/_44lV0kDjySE/SqFQ9ds0pGI/AAAAAAAAAMI/wu25MUrRK7A/s400/Product-Class-Form.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5377668446931952738" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;An example Product instance, with the inferred (blue) AUD price is shown below:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_44lV0kDjySE/SqFRStaI5aI/AAAAAAAAAMQ/GLda47RhNFE/s1600-h/Laptop-Price-Form.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 230px; height: 257px;" src="http://2.bp.blogspot.com/_44lV0kDjySE/SqFRStaI5aI/AAAAAAAAAMQ/GLda47RhNFE/s400/Laptop-Price-Form.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5377668811925808546" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;These rules can of course be generalized further into SPIN templates, or the range of the target property could be used instead of hard-coding the target currency anywhere. There are really endless possibilities here.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31416365-4136770497036042698?l=composing-the-semantic-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://composing-the-semantic-web.blogspot.com/feeds/4136770497036042698/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=31416365&amp;postID=4136770497036042698' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/4136770497036042698'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/4136770497036042698'/><link rel='alternate' type='text/html' href='http://composing-the-semantic-web.blogspot.com/2009/09/currency-conversion-with-units-ontology.html' title='Currency conversion with the Units Ontology, SPARQLMotion and SPIN'/><author><name>Holger Knublauch</name><uri>http://www.blogger.com/profile/13180242480924209321</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://www.knublauch.com/images/platypus.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_44lV0kDjySE/SqFMbh6yYpI/AAAAAAAAALo/4RBL3A6rgtU/s72-c/getRateByCodes-Example.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-31416365.post-5498786830976478936</id><published>2009-08-31T12:40:00.000-07:00</published><updated>2009-08-31T14:34:33.215-07:00</updated><title type='text'>Units ontology with SPIN support published</title><content type='html'>My co-workers at &lt;a href="http://topquadrant.com"&gt;TopQuadrant&lt;/a&gt; have just published a new &lt;a href="http://qudt.org/"&gt;OWL ontology about Quantities, Units, Dimensions and Datatypes (QUDT)&lt;/a&gt;. This is a result of a long term, ongoing project with NASA AMES, and our friends at NASA have permitted us to publish those ontologies to encourage the wider use outside of NASA.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;The QUDT ontology is very carefully designed and provides comprehensive coverage of almost every unit of measurement that is known to humankind. For example, it defines the unit Centimeter as follows:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_44lV0kDjySE/SpwqF9O5ZQI/AAAAAAAAAKg/t2rD0Kpd8nw/s1600-h/QUDT-Centimeter-Form.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 213px; height: 400px;" src="http://3.bp.blogspot.com/_44lV0kDjySE/SpwqF9O5ZQI/AAAAAAAAAKg/t2rD0Kpd8nw/s400/QUDT-Centimeter-Form.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5376218336998286594" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;Each unit has a stable URI, making it possible to link to it from your own domain models in a reliable way. For each unit, the ontology defines some useful metadata including abbreviation, a link to DBpedia and a categorization of units into groups, such as length units.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I think this units ontology can fill an important gap in the current Semantic Web and Linked Data efforts. Numeric data without any formalized units is pretty useless for machines, and sometimes even for humans. Currently, a unit may be mentioned somewhere hidden in a comment or not at all, but the QUDT ontology allows ontology designers to clearly specify these implicit assumptions. With explicitly modeled units, linked data can be processed and transformed in much more useful ways. For example, if a height it specified in Centimeters, then a smart linked data browser can automatically translate it into Feet for US American readers.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;There are two main ways of using the units ontology: you can use the unit resources to "annotate" your properties with a dedicated property such as qud:units. The values of your property would use built-in datatypes such as xsd:double. The other alternative is to embed the unit directly into the literals. For this use case, all units have also been declared to be rdfs:Datatypes. This makes it possible, to assign units as rdfs:ranges of a property as shown below:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_44lV0kDjySE/SpwwsVGuD_I/AAAAAAAAAKo/5-gzDVc-X1s/s1600-h/QUDT-Property-Example.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 227px; height: 272px;" src="http://2.bp.blogspot.com/_44lV0kDjySE/SpwwsVGuD_I/AAAAAAAAAKo/5-gzDVc-X1s/s400/QUDT-Property-Example.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5376225593311236082" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;Here, the property height has the range unit:Centimeter. An example instance would then show up like this:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_44lV0kDjySE/Spw4Zgno2qI/AAAAAAAAALY/ebC_0SWsmhM/s1600-h/QUDT-Instance-Example.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 219px; height: 215px;" src="http://1.bp.blogspot.com/_44lV0kDjySE/Spw4Zgno2qI/AAAAAAAAALY/ebC_0SWsmhM/s400/QUDT-Instance-Example.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5376234066077604514" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The specific height will then be stored in RDF literals such as "8380"^^unit:Centimeter. (The upcoming version 3.2 of TopBraid Composer will show the unit in parantheses behind the property name, but I didn't want to play tricks here).&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Now that the units have been formalized in an ontology, new ways of working with numeric data become possible. As &lt;a href="http://composing-the-semantic-web.blogspot.com/2009/01/video-sparql-based-unit-conversion-with.html"&gt;described&lt;/a&gt; earlier, the &lt;a href="http://spinrdf.org"&gt;SPIN&lt;/a&gt; framework can be used to define new SPARQL functions which can then be used to do things like unit conversion. We have published a &lt;a href="http://topbraid.org/spin/qudspin"&gt;SPIN Library&lt;/a&gt; which contains some generic unit conversion functions. For example, the qudspin:convert function can be used to convert any numeric value from a source unit (here: unit:Centimeter) to a target unit (unit:Foot):&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_44lV0kDjySE/Spw0gbst1WI/AAAAAAAAAKw/UOyo3JjriWI/s1600-h/QUDT-convertFunction.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 381px; height: 233px;" src="http://1.bp.blogspot.com/_44lV0kDjySE/Spw0gbst1WI/AAAAAAAAAKw/UOyo3JjriWI/s400/QUDT-convertFunction.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5376229786969298274" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;If the units are used as datatypes, then the function qudspin:convertLiteral can be used, saving one argument in the function call:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_44lV0kDjySE/Spw0pklFYJI/AAAAAAAAAK4/Stfz2sEO0E4/s1600-h/QUDT-convertLiteralFunction.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 217px;" src="http://2.bp.blogspot.com/_44lV0kDjySE/Spw0pklFYJI/AAAAAAAAAK4/Stfz2sEO0E4/s400/QUDT-convertLiteralFunction.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5376229943972028562" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;In the following example, we iterate over all instances with a :height property and display the height (in cm) as well as the converted height (in feet) using the SPIN function:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_44lV0kDjySE/Spw0y1y19cI/AAAAAAAAALA/J_v9VGSeSZ0/s1600-h/QUDT-convertLiteralFunction2.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 217px;" src="http://3.bp.blogspot.com/_44lV0kDjySE/Spw0y1y19cI/AAAAAAAAALA/J_v9VGSeSZ0/s400/QUDT-convertLiteralFunction2.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5376230103211963842" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Such unit conversion tasks have been made possible by adding conversion multipliers to the QUDT ontology. SPIN functions can use this extra metadata to drive mathematical computations. The function qudspin:convert is backed by a SPARQL query as shown below:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_44lV0kDjySE/Spw2LihH2UI/AAAAAAAAALQ/E3cLd6Bux0g/s1600-h/QUDT-convertFunction-Definition.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 273px; height: 400px;" src="http://4.bp.blogspot.com/_44lV0kDjySE/Spw2LihH2UI/AAAAAAAAALQ/E3cLd6Bux0g/s400/QUDT-convertFunction-Definition.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5376231627045722434" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;The SPIN framework makes it possible to define such SPARQL functions (and rules and constraints) in a completely declarative way. No extra hard-coding of anything is needed. Any SPIN-aware SPARQL engine can simply look up the definition of the qudspin:convert function on the web and learn about the underlying mathematics. Likewise, there is no need for humans to worry about the calculations themselves - they can treat the SPIN function as a black box.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The easiest way to play with this (for example using &lt;a href="http://www.topbraidcomposer.com"&gt;TopBraid Composer Free Edition&lt;/a&gt;) is to add an owl:imports statement to &lt;a href="http://topbraid.org/spin/qudspin"&gt;http://topbraid.org/spin/qudspin&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31416365-5498786830976478936?l=composing-the-semantic-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://composing-the-semantic-web.blogspot.com/feeds/5498786830976478936/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=31416365&amp;postID=5498786830976478936' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/5498786830976478936'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/5498786830976478936'/><link rel='alternate' type='text/html' href='http://composing-the-semantic-web.blogspot.com/2009/08/units-ontology-with-spin-support.html' title='Units ontology with SPIN support published'/><author><name>Holger Knublauch</name><uri>http://www.blogger.com/profile/13180242480924209321</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://www.knublauch.com/images/platypus.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_44lV0kDjySE/SpwqF9O5ZQI/AAAAAAAAAKg/t2rD0Kpd8nw/s72-c/QUDT-Centimeter-Form.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-31416365.post-3660221103410288212</id><published>2009-08-21T13:44:00.000-07:00</published><updated>2009-08-21T15:00:12.715-07:00</updated><title type='text'>Ontology Mapping with SPIN Templates</title><content type='html'>The question of how to transform data from one ontology to another comes up again and again, most recently in a &lt;a href="http://lists.w3.org/Archives/Public/semantic-web/2009Aug/0089.html"&gt;question&lt;/a&gt; on the W3C Semantic Web list. The requirement is very real: for example, assume you have a class Person (with firstName/lastName) and a class Member (with fullName), and you want to construct one Member for each Person, so that the fullName is derived by concatenating firstName + " " + lastName. So basically you want to transform some (legacy) data into a format that some other application can understand.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Ideally, there should be a reusable standard mapping ontology for this purpose, which is also executable and user-friendly in visual editing tools. I am not aware of such a standard ontology, but I know how it could be built. Clearly, the typical complexity of such mapping tasks goes beyond what is provided by modeling languages like OWL. A graph matching language like SPARQL with rich built-in functions will be better suited. SPARQL CONSTRUCT queries can be used to define such mappings, as &lt;a href="http://composing-the-semantic-web.blogspot.com/2006/09/ontology-mapping-with-sparql-construct.html"&gt;described on this blog&lt;/a&gt; three years ago.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The &lt;a href="http://spinrdf.org/"&gt;SPARQL Inferencing Notation (SPIN)&lt;/a&gt; provides a framework for organizing such SPARQL CONSTRUCT queries in a way that is easy to maintain and efficient to execute. In the following example I will walk through the steps needed to create a generic mapping ontology for tasks such as the one above, using &lt;a href="http://composing-the-semantic-web.blogspot.com/2009/01/understanding-spin-templates.html"&gt;SPIN Templates&lt;/a&gt;. The example is intentionally held very simple. The resulting file can be &lt;a href="http://topbraid.org/examples/spin/mapping/personMapping.owl"&gt;downloaded&lt;/a&gt; here and you can use &lt;a href="http://www.topquadrant.com/products/TB_Composer.html"&gt;TopBraid Composer&lt;/a&gt; (even the Free Edition) to execute it.&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Let's assume we have two ontologies, person and member with the following classes:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_44lV0kDjySE/So8Ka9jViBI/AAAAAAAAAJY/NsHd4z8BOjU/s1600-h/OntologiesOverview.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 66px;" src="http://2.bp.blogspot.com/_44lV0kDjySE/So8Ka9jViBI/AAAAAAAAAJY/NsHd4z8BOjU/s400/OntologiesOverview.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5372524338791942162" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;An example instance of the source ontology may look like the following, with values for firstName and lastName filled in:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_44lV0kDjySE/So8MHjeg5-I/AAAAAAAAAJg/xofQBS48VkE/s1600-h/SourceInstance.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 256px; height: 333px;" src="http://4.bp.blogspot.com/_44lV0kDjySE/So8MHjeg5-I/AAAAAAAAAJg/xofQBS48VkE/s400/SourceInstance.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5372526204398135266" /&gt;&lt;/a&gt;SPARQL can be used to create a mapping so that all instances of Person become Members, with a fullName derived from firstName and lastName. We would need two CONSTRUCT queries: one that adds the rdf:type triple to make the Persons also Members, and one that concatenates the firstName and lastName values into the fullName. You could attach those CONSTRUCT queries as SPIN rules to the classes as shown below. Note that the variable ?this means "for every instance of the class Person".&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_44lV0kDjySE/So8OD-vbDlI/AAAAAAAAAJo/jaScSQQLHg4/s1600-h/CONSTRUCTQueries.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 346px; height: 400px;" src="http://4.bp.blogspot.com/_44lV0kDjySE/So8OD-vbDlI/AAAAAAAAAJo/jaScSQQLHg4/s400/CONSTRUCTQueries.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5372528342020591186" /&gt;&lt;/a&gt;This mechanism will work fine, we can press the inferences button to run the SPIN rule engine and it will create the new RDF triples:&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_44lV0kDjySE/So8Rfl813DI/AAAAAAAAAKI/U8ckRdzomcM/s1600-h/Inferences.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 117px;" src="http://1.bp.blogspot.com/_44lV0kDjySE/So8Rfl813DI/AAAAAAAAAKI/U8ckRdzomcM/s400/Inferences.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5372532114937207858" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;We can see that the Person is now also a Member with a fullName:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_44lV0kDjySE/So8SjTo1_uI/AAAAAAAAAKQ/bE0fyG5C8e8/s1600-h/ResultInstance.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 245px; height: 395px;" src="http://4.bp.blogspot.com/_44lV0kDjySE/So8SjTo1_uI/AAAAAAAAAKQ/bE0fyG5C8e8/s400/ResultInstance.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5372533278252596962" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;However, the solution above requires that the person creating the mapping is familiar with SPARQL. Additionally, the transformations can not easily be reused and similar SPARQL queries need to be entered the next time a string concatenation is required.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;SPIN Templates can be used to encapsulate SPARQL queries so that they can be reused and edited easily. In the screenshot below I have replaced the hard-coded SPARQL queries with two SPIN template calls, which actually do the same but in a much nicer way:&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_44lV0kDjySE/So8O79Gg-VI/AAAAAAAAAJw/TO_yOjTQ9ok/s1600-h/ClassWithRules.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 329px;" src="http://1.bp.blogspot.com/_44lV0kDjySE/So8O79Gg-VI/AAAAAAAAAJw/TO_yOjTQ9ok/s400/ClassWithRules.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5372529303653251410" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;Another way of visualizing these is using TopBraid's Diagram facility:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_44lV0kDjySE/So8XuIrEUFI/AAAAAAAAAKY/6kmd63iMFUM/s1600-h/MappingDiagram.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 50px;" src="http://2.bp.blogspot.com/_44lV0kDjySE/So8XuIrEUFI/AAAAAAAAAKY/6kmd63iMFUM/s400/MappingDiagram.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5372538961845833810" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Let's look behind the scenes. The two entries under the spin:rule property are now SPIN Template Calls. A Template Call is an instance of a SPIN Template, but with arguments filled in. Here is the definition of the first SPIN Template, the concatenation rule:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_44lV0kDjySE/So8Po9ruJ3I/AAAAAAAAAJ4/8Q_zYcSZWAo/s1600-h/ConcatenateTemplate.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 263px; height: 400px;" src="http://3.bp.blogspot.com/_44lV0kDjySE/So8Po9ruJ3I/AAAAAAAAAJ4/8Q_zYcSZWAo/s400/ConcatenateTemplate.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5372530076903417714" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;The SPIN Template above is wrapping a SPARQL CONSTRUCT query (under spin:body). Templates can take arguments (under spin:constraint), which define how the template can be invoked. The values of the arguments will be "inserted" as variable bindings into the SPARQL query. In the example above, there are three arguments (sourceProperty1, sourceProperty2 and targetProperty) which are referenced in the body query as variables ?sourceProperty1 etc. In order to use such a template, the user simply needs to select the source class, go to "Create from SPIN Template..." under spin:rule, and fill in the arguments, as shown below.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_44lV0kDjySE/So8RGaFGA8I/AAAAAAAAAKA/jw0p5Gg2p5s/s1600-h/TemplateForm.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 291px;" src="http://1.bp.blogspot.com/_44lV0kDjySE/So8RGaFGA8I/AAAAAAAAAKA/jw0p5Gg2p5s/s400/TemplateForm.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5372531682253865922" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;The resulting Template Call will be associated with the class Person as a spin:rule, so that the SPIN (mapping) engine will infer the same new triples. The main achievement though is that the string concatenation module has now been generalized and could be reused in other ontologies. Since SPIN Templates are represented entirely in RDF, they can be shared on the web. Creating a library of such mapping modules would be a great topic for a Master's Thesis...&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31416365-3660221103410288212?l=composing-the-semantic-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://composing-the-semantic-web.blogspot.com/feeds/3660221103410288212/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=31416365&amp;postID=3660221103410288212' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/3660221103410288212'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/3660221103410288212'/><link rel='alternate' type='text/html' href='http://composing-the-semantic-web.blogspot.com/2009/08/ontology-mapping-with-spin-templates.html' title='Ontology Mapping with SPIN Templates'/><author><name>Holger Knublauch</name><uri>http://www.blogger.com/profile/13180242480924209321</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://www.knublauch.com/images/platypus.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_44lV0kDjySE/So8Ka9jViBI/AAAAAAAAAJY/NsHd4z8BOjU/s72-c/OntologiesOverview.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-31416365.post-2677079377171910146</id><published>2009-07-28T09:59:00.000-07:00</published><updated>2009-07-28T11:52:39.151-07:00</updated><title type='text'>SPIN Diff: Rule-based Comparison of RDF Models</title><content type='html'>One of the new features of the Maestro Edition of &lt;a href="http://www.topquadrant.com/products/composer_versions/v3_1_0.html"&gt;TopBraid Composer 3.1&lt;/a&gt; is a simple yet very flexible diff tool that can be used to compare two versions of an RDF file or database. Diffing is a common requirement of collaborative modeling work, but conventional text-based diff tools often fail miserably on RDF-based data.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;TopBraid's Diff feature is based on the SPARQL-based rule language &lt;a href="http://spinrdf.org/"&gt;SPIN&lt;/a&gt;. Our approach works as follows:&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;We have defined a simple &lt;a href="http://topbraid.org/diff"&gt;diff ontology&lt;/a&gt; that defines classes and properties to describe differences between two RDF models.&lt;/li&gt;&lt;li&gt;The diff engine creates instances of those diff ontology classes, e.g. diff:AddedTripleDiff.&lt;/li&gt;&lt;li&gt;The rules that construct those diff instances are expressed as SPARQL CONSTRUCT queries in SPIN.&lt;/li&gt;&lt;li&gt;Any RDF-based browser such as TopBraid Composer or Ensemble can be used to browse the results of the diff engine - they are simply another RDF model.&lt;/li&gt;&lt;li&gt;Likewise, any RDF-based processing language such as OWL, SPIN or &lt;a href="http://sparqlmotion.org/"&gt;SPARQLMotion&lt;/a&gt; can be used to post-process the output of the diff engine, for example to create more detailed diff reports for specific ontology design patterns.&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;Let's have a look at a simple example with the out-of-the-box behavior first. The example ontology contains a class Person with an owl:Restriction attached to it, as well as labels and comments. I have made some edits to the file and ran the diff tool from TopBraid Composer's Model menu. After selecting the old version of the file, the diff engine runs the rules encoded in the diff.owl file and produces a new file containing the change records. There is a stored SPARQL query in the diff file, defined as a &lt;a href="http://composing-the-semantic-web.blogspot.com/2009/01/understanding-spin-templates.html"&gt;SPIN Template&lt;/a&gt;, which can be used to conveniently list all Diff objects in a table. Use the Run SPARQL Query from SPIN Template button in Composer's main tool bar to open a diff report such as the following:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_44lV0kDjySE/Sm84RrC5piI/AAAAAAAAAIw/HfJqRFTe06c/s1600-h/Diff-Example-Output.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 102px;" src="http://1.bp.blogspot.com/_44lV0kDjySE/Sm84RrC5piI/AAAAAAAAAIw/HfJqRFTe06c/s400/Diff-Example-Output.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5363567557485372962" /&gt;&lt;/a&gt;The diff output file also imports the current domain ontology, and you can therefore double-click on any diff entry to navigate to the relevant subject or predicate. A closer look reveals that the diff reports consists of instances such as the following:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_44lV0kDjySE/Sm85_u6lixI/AAAAAAAAAJA/HRU5JTjPxU0/s1600-h/Diff-Example-AddedTriple-Instance.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 372px; height: 377px;" src="http://1.bp.blogspot.com/_44lV0kDjySE/Sm85_u6lixI/AAAAAAAAAJA/HRU5JTjPxU0/s400/Diff-Example-AddedTriple-Instance.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5363569448309852946" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;This instance of type diff:AddedTripleDiff states that a new rdfs:comment "A human being" has been added to the class difftest:Person. As you can see, the details of the particular change can be queried using properties such as rdf:subject.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The instance above has been created with the following SPIN rule, which is attached to the diff:AddedTripleDiff class:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_44lV0kDjySE/Sm862TIPYpI/AAAAAAAAAJI/50dath3dHhY/s1600-h/Diff-Rule.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 247px;" src="http://2.bp.blogspot.com/_44lV0kDjySE/Sm862TIPYpI/AAAAAAAAAJI/50dath3dHhY/s400/Diff-Rule.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5363570385743733394" /&gt;&lt;/a&gt;The trick is that the diff rules can query the old and the new triples using pre-defined named graphs (diff:new and diff:old), and then construct response objects based on comparisons across those two graphs. In the example above, a helper method from the &lt;a href="http://spinrdf.org/spl.html"&gt;SPIN Standard Modules Library&lt;/a&gt; spl:hasValue is used to check whether a given object has already been present in the old graph.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;As you can see, this whole diff engine is very much model-driven and not only operates on RDF, but also produces RDF as output, and uses SPARQL rules to query the RDF graphs. The particular collection of rules to fire is stored in the diff.owl file. This makes the engine very adjustable and extensible. For example, let's assume that we want the engine to be smarter about OWL syntax and create custom diff objects for changes to OWL restrictions. In order to do that, we create a new class diff:ChangedRestrictionDiff, and attach the following diff:rule to it:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_44lV0kDjySE/Sm9F_H3oBzI/AAAAAAAAAJQ/eNr9rxtF7ak/s1600-h/Diff-Custom-Rule.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 344px; height: 400px;" src="http://2.bp.blogspot.com/_44lV0kDjySE/Sm9F_H3oBzI/AAAAAAAAAJQ/eNr9rxtF7ak/s400/Diff-Custom-Rule.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5363582631967983410" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;This will then create more helpful diff messages such as "owl:minCardinality restriction on property firstName at class Person changed filler from 0 to 1". You can create similar custom-tailored rules for other ontology design patterns.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The generic approach presented here has the advantage of being very flexible. The current limitations are cases such as global renaming of a resource, which would currently be regarded as a collection of add and delete triple events. Higher-level rules are needed to analyze the lower-level diff results for such patterns and combine those "add/delete triple" events into "rename" events. Fortunately, given the open architecture of the system, anyone is able to contribute such changes without necessarily having to write any Java code. The beauty of generic model-driven engines is that this power is transferred to the end users. Furthermore, the behavior of the system is transparently encoded into rules that can be viewed by anyone, including software agents on the Semantic Web.&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31416365-2677079377171910146?l=composing-the-semantic-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://composing-the-semantic-web.blogspot.com/feeds/2677079377171910146/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=31416365&amp;postID=2677079377171910146' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/2677079377171910146'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/2677079377171910146'/><link rel='alternate' type='text/html' href='http://composing-the-semantic-web.blogspot.com/2009/07/spin-diff-rule-based-comparison-of-rdf.html' title='SPIN Diff: Rule-based Comparison of RDF Models'/><author><name>Holger Knublauch</name><uri>http://www.blogger.com/profile/13180242480924209321</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://www.knublauch.com/images/platypus.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_44lV0kDjySE/Sm84RrC5piI/AAAAAAAAAIw/HfJqRFTe06c/s72-c/Diff-Example-Output.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-31416365.post-6339054904347257910</id><published>2009-06-15T14:48:00.000-07:00</published><updated>2009-06-15T15:17:41.938-07:00</updated><title type='text'>Announcing TopBraid Composer Free Edition</title><content type='html'>I am thrilled to announce that TopQuadrant has just released a completely free version of its Semantic Web development tool TopBraid Composer! See the &lt;a href="http://www.topquadrant.com/docs/pr/06_16_09_TBC.pdf"&gt;press release&lt;/a&gt; here. In a nutshell, the Free Edition provides the basic editing capabilities of the Standard Edition, i.e. you can use it to load, edit and save RDF/OWL files using TopBraid's editing forms. Furthermore, the Free Edition has excellent SPARQL support, including full support for the SPARQL Inferencing Notation (&lt;a href="http://spinrdf.org"&gt;SPIN&lt;/a&gt;). Like all editions of TopBraid Composer, the Free Edition is based on Eclipse and provides a stable and well-documented environment for newcomers to Semantic Web technology.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;a href="http://www.topquadrant.com/products/TB_free_download.html"&gt;Download TopBraid Composer Free Edition&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31416365-6339054904347257910?l=composing-the-semantic-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://composing-the-semantic-web.blogspot.com/feeds/6339054904347257910/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=31416365&amp;postID=6339054904347257910' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/6339054904347257910'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/6339054904347257910'/><link rel='alternate' type='text/html' href='http://composing-the-semantic-web.blogspot.com/2009/06/announcing-topbraid-composer-free.html' title='Announcing TopBraid Composer Free Edition'/><author><name>Holger Knublauch</name><uri>http://www.blogger.com/profile/13180242480924209321</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://www.knublauch.com/images/platypus.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-31416365.post-5277543313758300012</id><published>2009-06-12T09:13:00.000-07:00</published><updated>2009-06-12T09:37:23.379-07:00</updated><title type='text'>SemTech pre-announcements</title><content type='html'>I am looking forward to the &lt;a href="http://www.semantic-conference.com/"&gt;Semantic Technology Conference&lt;/a&gt; in San Jose, which starts on Monday. My employer &lt;a href="http://www.topquadrant.com"&gt;TopQuadrant&lt;/a&gt; will be presenting a lot of new technology there and we will be making a couple of hopefully very interesting announcements. If you are in the area, please join us for the second &lt;a href="http://www.semantic-conference.com/session/1936/"&gt;TopBraid Users Group Meeting&lt;/a&gt; on Thursday morning, or visit our company booth in the exhibition hall during the show. We'll be giving demos of new capabilities throughout those events, and you can stop by to meet the team and ask questions. We would also like to talk to you if you are looking for a job.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Additionally, my colleague Robert Coyne will be co-presenting a talk on &lt;a href="http://www.semantic-conference.com/session/1816/"&gt;rich information space browsing&lt;/a&gt;. Dean Allemang will be leading a hands-on session on &lt;a href="http://www.semantic-conference.com/session/1850/"&gt;deploying solutions with TopBraid Suite&lt;/a&gt; on Thursday afternoon. Finally, I'll have the opportunity to talk about our &lt;a href="http://www.semantic-conference.com/session/2124/"&gt;object-oriented semantic web rule language SPIN&lt;/a&gt; on Wednesday afternoon. One interesting aspect of this talk is that it is entirely based on &lt;span class="Apple-style-span" style="font-style: italic;"&gt;free&lt;/span&gt; software, but that's all I am allowed to say for now :)&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31416365-5277543313758300012?l=composing-the-semantic-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://composing-the-semantic-web.blogspot.com/feeds/5277543313758300012/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=31416365&amp;postID=5277543313758300012' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/5277543313758300012'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/5277543313758300012'/><link rel='alternate' type='text/html' href='http://composing-the-semantic-web.blogspot.com/2009/06/semtech-pre-announcements.html' title='SemTech pre-announcements'/><author><name>Holger Knublauch</name><uri>http://www.blogger.com/profile/13180242480924209321</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://www.knublauch.com/images/platypus.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-31416365.post-3347775169234647327</id><published>2009-05-19T20:07:00.000-07:00</published><updated>2009-05-19T20:40:43.933-07:00</updated><title type='text'>Interacting with XML-based web services using SPARQLMotion</title><content type='html'>One of the new features of TopBraid 3.0 is improved handling of web services that return XML results. We have added two new module types to &lt;a href="http://sparqlmotion.org/"&gt;SPARQLMotion&lt;/a&gt; that can be used to walk through XML documents via &lt;a href="http://www.w3.org/TR/xpath"&gt;XPath&lt;/a&gt;. Here is an illustrated example of how to use these capabilities. You can also &lt;a href="http://sparqlmotion.org/examples/GeoNamesPostalCodes.n3"&gt;download&lt;/a&gt; and play with the example script.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The first step is a web service call using sml:ImportXMLFromWorkspace:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_44lV0kDjySE/ShN1I5xFfWI/AAAAAAAAAHg/WVOAgsgx1Nk/s1600-h/SM-XPath-Step1.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 167px;" src="http://2.bp.blogspot.com/_44lV0kDjySE/ShN1I5xFfWI/AAAAAAAAAHg/WVOAgsgx1Nk/s400/SM-XPath-Step1.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5337738779170274658" /&gt;&lt;/a&gt;In this example we are using a fixed URL from the geonames.org web service:&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_44lV0kDjySE/ShN1Z8IqCUI/AAAAAAAAAHo/LLaRI9-G1Lk/s1600-h/SM-XPath-Step1-Details.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 201px;" src="http://3.bp.blogspot.com/_44lV0kDjySE/ShN1Z8IqCUI/AAAAAAAAAHo/LLaRI9-G1Lk/s400/SM-XPath-Step1-Details.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5337739071863785794" /&gt;&lt;/a&gt;We can run this trivial script with the debug button to examine the XML result in TopBraid's console:&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_44lV0kDjySE/ShN1u58U6kI/AAAAAAAAAHw/VQ_uyNlHjPM/s1600-h/SM-XPath-XML-Results.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 355px;" src="http://1.bp.blogspot.com/_44lV0kDjySE/ShN1u58U6kI/AAAAAAAAAHw/VQ_uyNlHjPM/s400/SM-XPath-XML-Results.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5337739432052451906" /&gt;&lt;/a&gt;Our query takes a postal code as input and delivers an XML structure of matching Australian suburbs. We want to copy some of the result values into our simple Suburbs ontology, and capture name, latitude and longitude of each suburb.&lt;div&gt;&lt;br /&gt;&lt;div&gt;In order to do that, we want to walk through all &lt;span class="Apple-style-span" style="font-style: italic;"&gt;code&lt;/span&gt; tags of the XML result. We add an sml:IterateOverXPath module that takes the ?xml from the previous step as input:&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_44lV0kDjySE/ShN2TB-saaI/AAAAAAAAAH4/0JTxjxj7s-M/s1600-h/SM-XPath-Step2.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 171px; height: 251px;" src="http://2.bp.blogspot.com/_44lV0kDjySE/ShN2TB-saaI/AAAAAAAAAH4/0JTxjxj7s-M/s400/SM-XPath-Step2.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5337740052685154722" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div&gt;At this stage, Composer offers a convenience feature: right click on the IterateOverXPath module and select "Set XPath...": this will execute the script up to that module and open up an XPath creation dialog. This dialog can be used to select the path to the elements that we want to iterate over:&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_44lV0kDjySE/ShN3pR9MkBI/AAAAAAAAAIA/HdQzB2ftFdU/s1600-h/SM-XPath-Dialog1.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 282px;" src="http://3.bp.blogspot.com/_44lV0kDjySE/ShN3pR9MkBI/AAAAAAAAAIA/HdQzB2ftFdU/s400/SM-XPath-Dialog1.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5337741534442590226" /&gt;&lt;/a&gt;After we have defined and assigned the XPath, we can now specify what we want to do with each &lt;span class="Apple-style-span" style="font-style: italic;"&gt;code&lt;/span&gt; element from the XML document. In order to do so, we create the body of the iteration module as shown in the overview below. This body will be repeated for each &lt;span class="Apple-style-span" style="font-style: italic;"&gt;code&lt;/span&gt; element. The ?xml variable is then bound to the current &lt;span class="Apple-style-span" style="font-style: italic;"&gt;code&lt;/span&gt; element as root.&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_44lV0kDjySE/ShN4NeLzRMI/AAAAAAAAAII/KIIHa7dq-qs/s1600-h/SM-XPath-Script.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 385px;" src="http://2.bp.blogspot.com/_44lV0kDjySE/ShN4NeLzRMI/AAAAAAAAAII/KIIHa7dq-qs/s400/SM-XPath-Script.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5337742156200363202" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div&gt;Each of the three sml:BindByXPath modules has a local XPath starting at the respective code element. Again, we can use the "Set XPath..." feature to let the SPARQLMotion engine execute up to the module and open an XPath editor dialog:&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_44lV0kDjySE/ShN4nApheDI/AAAAAAAAAIQ/SKt6veKCZdw/s1600-h/SM-XPath-Dialog2.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 282px;" src="http://3.bp.blogspot.com/_44lV0kDjySE/ShN4nApheDI/AAAAAAAAAIQ/SKt6veKCZdw/s400/SM-XPath-Dialog2.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5337742594948560946" /&gt;&lt;/a&gt;We simply need to pick the example instance data (here, the specific latitude value) and the dialog will generalize it into an XPath expression in the text field. This will bind the specified text node to the variables ?name, ?lat and ?long. In the final step, we define a SPARQL Construct query using sml:ApplyConstruct to create RDF triples for those values:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_44lV0kDjySE/ShN5WjMqvoI/AAAAAAAAAIY/oShZBeo-uTE/s1600-h/SM-XPath-Construct.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 318px;" src="http://2.bp.blogspot.com/_44lV0kDjySE/ShN5WjMqvoI/AAAAAAAAAIY/oShZBeo-uTE/s400/SM-XPath-Construct.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5337743411676626562" /&gt;&lt;/a&gt;The complete script can now be executed, and SPARQLMotion we can infer the resulting triples so that we can browse them in TopBraid:&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_44lV0kDjySE/ShN5pTBwJYI/AAAAAAAAAIg/c1emTpnFHlo/s1600-h/SM-XPath-Executed.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 241px;" src="http://3.bp.blogspot.com/_44lV0kDjySE/ShN5pTBwJYI/AAAAAAAAAIg/c1emTpnFHlo/s400/SM-XPath-Executed.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5337743733753390466" /&gt;&lt;/a&gt;The result is that we have converted the XML data from the web service call into instances of the my:Suburb class in our ontology:&lt;div&gt;&lt;br /&gt;&lt;div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_44lV0kDjySE/ShN5-pShBdI/AAAAAAAAAIo/II5Wsj-DtRo/s1600-h/SM-XPath-Instances.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 327px; height: 400px;" src="http://1.bp.blogspot.com/_44lV0kDjySE/ShN5-pShBdI/AAAAAAAAAIo/II5Wsj-DtRo/s400/SM-XPath-Instances.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5337744100506535378" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;SPARQLMotion is of course more general than that, and you can combine such web service calls with any other type of processing supported by the engine. You can also use the same technique to interact with other XML documents such as local files.&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31416365-3347775169234647327?l=composing-the-semantic-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://composing-the-semantic-web.blogspot.com/feeds/3347775169234647327/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=31416365&amp;postID=3347775169234647327' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/3347775169234647327'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/3347775169234647327'/><link rel='alternate' type='text/html' href='http://composing-the-semantic-web.blogspot.com/2009/05/interacting-with-xml-based-web-services.html' title='Interacting with XML-based web services using SPARQLMotion'/><author><name>Holger Knublauch</name><uri>http://www.blogger.com/profile/13180242480924209321</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://www.knublauch.com/images/platypus.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_44lV0kDjySE/ShN1I5xFfWI/AAAAAAAAAHg/WVOAgsgx1Nk/s72-c/SM-XPath-Step1.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-31416365.post-8168746433531374552</id><published>2009-05-01T11:13:00.000-07:00</published><updated>2009-05-01T11:36:52.431-07:00</updated><title type='text'>TopBraid Suite 3.0 is here!</title><content type='html'>Roughly nine months after our previous official TopBraid Composer release, we have today released &lt;a href="http://www.topquadrant.com/products/composer_versions/v3_0_0.html"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;TopBraid Suite 3.0&lt;/span&gt;&lt;/a&gt;! This is not just another &lt;a href="http://www.topquadrant.com/products/TB_Composer.html"&gt;Composer&lt;/a&gt; version, but a significant milestone for TopQuadrant's product offerings. For the first time, we have integrated and aligned the releases of Composer with an all-new &lt;a href="http://www.topquadrant.com/products/TB_Live.html"&gt;TopBraid Live&lt;/a&gt; and &lt;a href="http://www.topquadrant.com/products/TB_Ensemble.html"&gt;TopBraid Ensemble&lt;/a&gt;.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Ensemble has been redesigned completely and makes the development of Semantic Web applications easier than ever - completely without programming in the traditional sense. The best way to experience these new capabilities is to start TBC Maestro and then open a web browser at http://localhost:8083/tbl. This will open up the TopBraid Live welcome screen from which you can open an Ensemble application on whatever ontology you have in your Composer workspace, such as the following:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_44lV0kDjySE/Sfs_gIcUqlI/AAAAAAAAAHY/uqoTFpWJef0/s1600-h/TBE-JavaOne-Example.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 246px;" src="http://2.bp.blogspot.com/_44lV0kDjySE/Sfs_gIcUqlI/AAAAAAAAAHY/uqoTFpWJef0/s400/TBE-JavaOne-Example.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5330924405177756242" /&gt;&lt;/a&gt;By default, Ensemble is a generic linked data browser and editor with features such as trees, graphs, tables, charts, search and maps. There are two main innovations of Ensemble that make it different from similar frameworks though:&lt;div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;Customizing an application is easy: for example, if you want to change the kind of hierarchy to display in the tree, just configure it in TBE and save your application so that others can use it too. We have a purely model-driven architecture that represents the state of each application in RDF.&lt;/li&gt;&lt;li&gt;Adding new functionality is easy: you can define &lt;a href="http://sparqlmotion.org"&gt;SPARQLMotion scripts&lt;/a&gt; on the server and make them accessible via buttons in TBE. For example, you can define new operations that manipulate the currently selected tree node in whatever way you like, or you can import new data from RSS feeds or whatever else SPARQLMotion allows you to do. And if that's not enough, you can of course extend SPARQLMotion on the server.&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div&gt;There are several other major innovations in TopBraid 3.0, including &lt;a href="http://spinrdf.org"&gt;SPIN&lt;/a&gt; which I have written about in many previous blog entries. We hope you enjoy the new TopBraid!&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31416365-8168746433531374552?l=composing-the-semantic-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://composing-the-semantic-web.blogspot.com/feeds/8168746433531374552/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=31416365&amp;postID=8168746433531374552' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/8168746433531374552'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/8168746433531374552'/><link rel='alternate' type='text/html' href='http://composing-the-semantic-web.blogspot.com/2009/05/topbraid-suite-30-is-here.html' title='TopBraid Suite 3.0 is here!'/><author><name>Holger Knublauch</name><uri>http://www.blogger.com/profile/13180242480924209321</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://www.knublauch.com/images/platypus.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_44lV0kDjySE/Sfs_gIcUqlI/AAAAAAAAAHY/uqoTFpWJef0/s72-c/TBE-JavaOne-Example.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-31416365.post-3713801359735635312</id><published>2009-04-29T14:51:00.000-07:00</published><updated>2009-04-29T15:01:14.754-07:00</updated><title type='text'>Upcoming talks at JavaOne and SemTech</title><content type='html'>June will be conference month for me, and I'll give two presentations on my favorite topic of how to use RDF and SPARQL to develop model-driven applications. The first talk will be at &lt;a href="http://java.sun.com/javaone/"&gt;JavaOne&lt;/a&gt; 2009 in San Francisco, entitled &lt;a href="http://www28.cplan.com/cc230/session_details.jsp?isid=305034&amp;amp;ilocation_id=230-1&amp;amp;ilanguage=english"&gt;"Developing smart Java code with Semantic Web technology"&lt;/a&gt;. The second talk at &lt;a href="http://www.semantic-conference.com/"&gt;Semantic Technology Conference&lt;/a&gt; 2009 in San Jose is called &lt;a href="http://www.semantic-conference.com/session/2124/"&gt;"SPIN: An object-oriented framework for business rules using SPARQL"&lt;/a&gt;. I hope to meet some of you there!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31416365-3713801359735635312?l=composing-the-semantic-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://composing-the-semantic-web.blogspot.com/feeds/3713801359735635312/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=31416365&amp;postID=3713801359735635312' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/3713801359735635312'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/3713801359735635312'/><link rel='alternate' type='text/html' href='http://composing-the-semantic-web.blogspot.com/2009/04/upcoming-talks-at-javaone-and-semtech.html' title='Upcoming talks at JavaOne and SemTech'/><author><name>Holger Knublauch</name><uri>http://www.blogger.com/profile/13180242480924209321</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://www.knublauch.com/images/platypus.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-31416365.post-4903944248767512596</id><published>2009-03-16T17:05:00.000-07:00</published><updated>2009-03-16T17:38:44.628-07:00</updated><title type='text'>Event-Condition-Action Rules with SPARQLMotion</title><content type='html'>Several customers have requested a mechanism to trigger certain actions in response to changes to an RDF source. This can be used, for example, to update entries in some database when new triples come in, or send a message to someone to notify her about changes, or simply to synchronize dependencies among multiple data spaces. For the new &lt;a href="http://www.topquadrant.com/topbraid/composer/tbc-3.0.0.html"&gt;beta 2 release of TopBraid&lt;/a&gt;, I have added a mechanism that can execute arbitrary &lt;a href="http://sparqlmotion.org/"&gt;SPARQLMotion&lt;/a&gt; scripts in response to changes to a model.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Here is an example of how it works. Download 3.0 and drop &lt;a href="http://sparqlmotion.org/examples/TrackChangesTest.sms.n3"&gt;this file&lt;/a&gt; into your workspace. The file contains a SPARQLMotion script. The file is ending with .sms.n3 which instructs TopBraid to load this file into memory when the system starts up. The script (shown below) contains a module of type sml:TrackChanges. Any script with such a module will be executed whenever a change has been made to the current RDF model in TopBraid.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_44lV0kDjySE/Sb7roWYtyXI/AAAAAAAAAHQ/m5jiw8cszGE/s1600-h/TrackChanges-Script.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 347px;" src="http://3.bp.blogspot.com/_44lV0kDjySE/Sb7roWYtyXI/AAAAAAAAAHQ/m5jiw8cszGE/s400/TrackChanges-Script.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5313943688780302706" /&gt;&lt;/a&gt;To play with this script, open the kennedys.owl ontology from TopBraid Composer's standard examples folder. Now, change the firstName or lastName of any Person in the model: you will see that the (full) name of the person also changes. This change is performed through SPARQL DELETE and INSERT calls at the end of the script above. This is similar to the SPIN-based mechanism for updating display labels that I &lt;a href="http://composing-the-semantic-web.blogspot.com/2009/03/deriving-human-readable-labels-with.html"&gt;described&lt;/a&gt; earlier today, but the changes are asserted and not only inferred. &lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The basic mechanism is as follows: The TrackChanges module produces instances of the class Change from a simple &lt;a href="http://topbraid.org/change"&gt;change ontology&lt;/a&gt;. Each Change points to reified triples (instances of rdf:Statement) via change:added or change:deleted. The modules that follow the TrackChanges module can now query the Change objects and decide what to do with it. In the example above, the script iterates over all subjects that have changed their firstName or lastName and then runs the aforementioned DELETE and INSERT calls. Any other module could also be inserted though, for example to send an email, write something to a log or whatever else SPARQLMotion offers.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;For the next release I plan to complete the integration of this mechanism with &lt;a href="http://composing-the-semantic-web.blogspot.com/2009/03/rapid-semantic-web-application.html"&gt;TopBraid Ensemble&lt;/a&gt;. Since Ensemble applications store their internal state in RDF, this would make it possible to perform changes to the user interface (alerts, status changes, updating charts) as a result of changes to the database. This will make it possible to implement knowledge-based stock tickers, new forms of social networks, intelligent collaboration platforms, pro-active agents etc - all with a declarative engine and no low-level coding involved apart from SPARQL. Stay tuned...&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31416365-4903944248767512596?l=composing-the-semantic-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://composing-the-semantic-web.blogspot.com/feeds/4903944248767512596/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=31416365&amp;postID=4903944248767512596' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/4903944248767512596'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/4903944248767512596'/><link rel='alternate' type='text/html' href='http://composing-the-semantic-web.blogspot.com/2009/03/event-condition-action-rules-with.html' title='Event-Condition-Action Rules with SPARQLMotion'/><author><name>Holger Knublauch</name><uri>http://www.blogger.com/profile/13180242480924209321</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://www.knublauch.com/images/platypus.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_44lV0kDjySE/Sb7roWYtyXI/AAAAAAAAAHQ/m5jiw8cszGE/s72-c/TrackChanges-Script.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-31416365.post-1500328496719379963</id><published>2009-03-16T13:27:00.000-07:00</published><updated>2009-03-16T14:07:37.825-07:00</updated><title type='text'>Using JavaScript to Define SPARQL Functions</title><content type='html'>Many real-world SPARQL queries make heavy use of built-in functions for tasks such as string processing and mathematical calculations. SPARQL comes with a pre-defined set of such built-in functions. However, in practice, these built-in libraries are frequently extended to solve specific problems that have not been anticipated by the language designers. Such extensions are typically implemented natively for a specific SPARQL execution engine, for example in Java. Needless to say, this is not a solution in the spirit of the (Semantic) Web, because it leads to a Tower of Babel with all kinds of dialects and platform-specific extensions.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;We have proposed &lt;a href="http://composing-the-semantic-web.blogspot.com/2009/01/understanding-spin-functions.html"&gt;SPIN Functions&lt;/a&gt; as one possible extension mechanism for SPARQL, that allows anyone to derive new SPARQL functions by combining other SPARQL functions and query templates. In general, SPIN functions are Semantic Web resources that can be referenced by their URI to get a description of the function's arguments, return value and executable body. However, even this approach does not cover all possible use cases, because it is still limited by the lower-level SPARQL operations and functions. Many problems can only be solved with a general-purpose programming language.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://www.topquadrant.com/topbraid/composer/tbc-3.0.0.html"&gt;TopBraid 3.0.0 beta 2&lt;/a&gt; now introduces an &lt;a href="http://spinrdf.org/spinx"&gt;extension&lt;/a&gt; of the SPIN functions mechanism that can be used to define new SPARQL functions with the help of JavaScript. In a nutshell, a SPINx function is a SPIN function that points to a snippet of JavaScript, or a JavaScript file, which will be executed whenever the function is run. The arguments of the SPARQL function call are made available as arguments to the corresponding JavaScript function. Here is a simple example:&lt;/div&gt;&lt;pre&gt;    ex:square&lt;br /&gt;      a spin:Function ;&lt;br /&gt;      rdfs:subClassOf spin:Functions ;&lt;br /&gt;      spin:constraint&lt;br /&gt;          [ a spl:Argument ;&lt;br /&gt;            rdfs:comment "The value to compute the square of" ;&lt;br /&gt;            spl:predicate sp:arg1 ;&lt;br /&gt;            spl:valueType xsd:float&lt;br /&gt;          ] ;&lt;br /&gt;      spin:returnType xsd:float ;&lt;br /&gt;      spinx:javaScriptCode "return arg1 * arg1;" .&lt;/pre&gt;&lt;div&gt;The function above can be called such as LET (?sq := ex:square(4)) to calculate the square value of the argument. In addition to having inline code via the spinx:javaScriptCode property, there is an option to simply link to a .js file that contains a function with the same name.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;This simple approach (a variation of which had been proposed by &lt;a href="http://sunsite.informatik.rwth-aachen.de/Publications/CEUR-WS//Vol-248/paper7.pdf"&gt;Gregory Williams&lt;/a&gt;) greatly extends the expressive power of SPARQL through a relatively platform independent mechanism - JavaScript interpreters such as &lt;a href="http://www.mozilla.org/rhino/"&gt;Mozilla Rhino&lt;/a&gt; are widely available on all major platforms. We have selected JavaScript for three major reasons: First, JavaScript (known as &lt;a href="http://www.ecma-international.org/publications/standards/Ecma-262.htm"&gt;ECMAScript&lt;/a&gt;) is a well-established interpretable language that many users are already familar with. Second, JavaScript is web-friendly: you can reference scripts via URLs and scripts may import other scripts from the web as well. Finally, JavaScript has an attractive security model that will make it more difficult to create malicious SPARQL extensions (of course, details would need to be fleshed out).&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The expressivity of JavaScript is great for many problems that are beyond the capabilities of SPARQL and its built-in features. You can freely express if-then-else conditions, loops, sub-procedure calls etc, and thus gradually build up your own function libraries in a portable fashion. A limitation right now is that the JavaScript-based SPARQL functions (in TopBraid) do not have any mechanism yet to access the current RDF graph at execution time. This would be needed to implement things like walking an rdf:List or computing average values etc; in short any use case that requires more background knowledge than what has been explicitly passed into the function as arguments. However, this is limitation can be fixed, for example by defining a small collection of built-in call back functions such as find(S,P,O) in JavaScript. There is a large body of related work on JavaScript RDF APIs that may also be leveraged for that purpose.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31416365-1500328496719379963?l=composing-the-semantic-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://composing-the-semantic-web.blogspot.com/feeds/1500328496719379963/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=31416365&amp;postID=1500328496719379963' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/1500328496719379963'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/1500328496719379963'/><link rel='alternate' type='text/html' href='http://composing-the-semantic-web.blogspot.com/2009/03/using-javascript-to-define-sparql.html' title='Using JavaScript to Define SPARQL Functions'/><author><name>Holger Knublauch</name><uri>http://www.blogger.com/profile/13180242480924209321</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://www.knublauch.com/images/platypus.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-31416365.post-8176081460732918631</id><published>2009-03-16T13:07:00.000-07:00</published><updated>2009-03-16T13:25:19.121-07:00</updated><title type='text'>Generalizing Graphs into SPARQL Queries</title><content type='html'>&lt;div&gt;The new &lt;a href="http://www.topquadrant.com/topbraid/composer/tbc-3.0.0.html"&gt;TopBraid Composer 3.0 beta 2&lt;/a&gt; now includes a simple visual SPARQL query editor that has been suggested by my colleague &lt;a href="http://dallemang.typepad.com/"&gt;Dean Allemang&lt;/a&gt;. This query editor is a feature of Composer's graph browser. Dean has discovered that he is using the Graph browser very frequently to explore complex relationships between RDF resources, and asked me: wouldn't it be cool if I could take a snapshot of this particular graph and generalize it so that I can find all sub-graphs of the model with similar structure? Take the example below:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_44lV0kDjySE/Sb6zk2hzQqI/AAAAAAAAAHA/o5189VMr1po/s1600-h/TBC-GraphSPARQLEditor-1.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 359px; height: 272px;" src="http://3.bp.blogspot.com/_44lV0kDjySE/Sb6zk2hzQqI/AAAAAAAAAHA/o5189VMr1po/s400/TBC-GraphSPARQLEditor-1.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5313882056037712546" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div&gt;Here, the user has started to explore the RDF graph at a specific instance of Person (Alina Mojica). Opening up the has gender relationship displays the link to the resource female. In the graph above, this link to female as well as the year of birth 1965 have been "fixed", while all other values remain variable. Pressing the star button above the graph now creates a SPARQL query:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_44lV0kDjySE/Sb60bcTRrCI/AAAAAAAAAHI/eEXGhdhwdNg/s1600-h/TBC-GraphSPARQLEditor-2.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 359px; height: 309px;" src="http://3.bp.blogspot.com/_44lV0kDjySE/Sb60bcTRrCI/AAAAAAAAAHI/eEXGhdhwdNg/s400/TBC-GraphSPARQLEditor-2.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5313882993890274338" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div&gt;Executing this SPARQL query (with another mouse click on the same button) gives us all female Persons that were also born in 1965. The same approach can be used to turn more complex graph patterns into templates - just fix those values that you want to keep and leave the rest as variables.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;A very similar graphical SPARQL editor, executing in a rich internet application based on Flex, is now also part of the new &lt;a href="http://composing-the-semantic-web.blogspot.com/2009/03/rapid-semantic-web-application.html"&gt;TopBraid Ensemble&lt;/a&gt;.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31416365-8176081460732918631?l=composing-the-semantic-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://composing-the-semantic-web.blogspot.com/feeds/8176081460732918631/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=31416365&amp;postID=8176081460732918631' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/8176081460732918631'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/8176081460732918631'/><link rel='alternate' type='text/html' href='http://composing-the-semantic-web.blogspot.com/2009/03/generalizing-graphs-into-sparql-queries.html' title='Generalizing Graphs into SPARQL Queries'/><author><name>Holger Knublauch</name><uri>http://www.blogger.com/profile/13180242480924209321</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://www.knublauch.com/images/platypus.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_44lV0kDjySE/Sb6zk2hzQqI/AAAAAAAAAHA/o5189VMr1po/s72-c/TBC-GraphSPARQLEditor-1.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-31416365.post-4710892093680129005</id><published>2009-03-16T11:49:00.000-07:00</published><updated>2009-03-16T12:08:03.795-07:00</updated><title type='text'>Deriving human-readable labels with SPIN</title><content type='html'>I know, it took me ages to get there, but &lt;a href="http://www.topquadrant.com/topbraid/composer/tbc-3.0.0.html"&gt;TopBraid Composer 3.0.0 beta 2&lt;/a&gt; finally introduces the ability to switch the whole user interface to display human-readable labels instead of resource identifiers such as qnames. There is a button in the tool bar that instructs TopBraid to use any values of rdfs:label or sub-properties thereof, and otherwise fall back to qnames. For example, in the following screen shot, Alfred Tucker's wife is displayed as "Kym Smith" instead of "kennedys:KymSmith".&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_44lV0kDjySE/Sb6hDOA179I/AAAAAAAAAGw/UvQjoSrZeBI/s1600-h/TBC-SPINLabels-1.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 324px; height: 315px;" src="http://2.bp.blogspot.com/_44lV0kDjySE/Sb6hDOA179I/AAAAAAAAAGw/UvQjoSrZeBI/s400/TBC-SPINLabels-1.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5313861687017074642" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div&gt;I believe the lack of this (trivial looking) feature has been a major disappointment for people coming from Protege or comparable tools :) Anyway, now that we have this feature in, let's do something cool with it. You may notice that the Kennedy ontology above contains three naming properties: first name, last name and name, where name can basically be derived by concatenating first and last names. In the kennedys.owl that is found in the examples folder of TBC, the name property has been asserted and manually maintained by the editors. A smarter way is to use a &lt;a href="http://spinrdf.org/"&gt;SPIN&lt;/a&gt; rule to do this maintenance work for us:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_44lV0kDjySE/Sb6h76RAntI/AAAAAAAAAG4/r9oloCVE9_I/s1600-h/TBC-SPINLabels-2.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 375px; height: 361px;" src="http://4.bp.blogspot.com/_44lV0kDjySE/Sb6h76RAntI/AAAAAAAAAG4/r9oloCVE9_I/s400/TBC-SPINLabels-2.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5313862660968718034" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div&gt;Here, the spin:rule gets the current values of firstName and lastName for the given instance of Person (?this), creates a full string (?name) using a SPARQL built-in function call, and then infers this ?name as value for the name property. Turn on incremental SPIN inferencing and the value will update after each change.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The beauty of this approach is that you can now use arbitrary SPARQL expressions to derive labels. And, as we all know, SPARQL is very expressive and &lt;a href="http://www.w3.org/2009/sparql/wiki/Category:Features"&gt;becomes even more expressive&lt;/a&gt; every day...&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31416365-4710892093680129005?l=composing-the-semantic-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://composing-the-semantic-web.blogspot.com/feeds/4710892093680129005/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=31416365&amp;postID=4710892093680129005' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/4710892093680129005'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/4710892093680129005'/><link rel='alternate' type='text/html' href='http://composing-the-semantic-web.blogspot.com/2009/03/deriving-human-readable-labels-with.html' title='Deriving human-readable labels with SPIN'/><author><name>Holger Knublauch</name><uri>http://www.blogger.com/profile/13180242480924209321</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://www.knublauch.com/images/platypus.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_44lV0kDjySE/Sb6hDOA179I/AAAAAAAAAGw/UvQjoSrZeBI/s72-c/TBC-SPINLabels-1.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-31416365.post-6672582497837437901</id><published>2009-03-16T10:08:00.000-07:00</published><updated>2009-03-16T10:59:30.983-07:00</updated><title type='text'>Rapid Semantic Web Application Development with TopBraid Ensemble</title><content type='html'>TopQuadrant's product family, called &lt;a href="http://www.topquadrant.com/topbraid"&gt;TopBraid Suite&lt;/a&gt;, consists of the semantic modeling tool &lt;a href="http://www.topquadrant.com/topbraid/composer"&gt;TopBraid Composer&lt;/a&gt;, a semantic server called &lt;a href="http://www.topquadrant.com/topbraid/live"&gt;TopBraid Live&lt;/a&gt;, and a client-side framework called &lt;a href="http://www.topquadrant.com/topbraid/ensemble"&gt;TopBraid Ensemble&lt;/a&gt;. In the new &lt;a href="http://www.topquadrant.com/topbraid/composer/tbc-3.0.0.html"&gt;Composer 3.0.0 beta 2 release&lt;/a&gt; we have finally aligned all these products into a single development and testing environment: When you download the Maestro edition of beta 2, you also get a personal edition of TopBraid Ensemble, ready to use without further download or installation needs!&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Let me show you how this works in practice. Launch TBC-ME 3.0.0 beta 2, and open a web browser. Then go to the URL http://localhost:8083/tbl. The following screen will show up:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_44lV0kDjySE/Sb6LIBMkO9I/AAAAAAAAAGY/P3Z89w3wf5g/s1600-h/TBS-StartPage.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 216px;" src="http://1.bp.blogspot.com/_44lV0kDjySE/Sb6LIBMkO9I/AAAAAAAAAGY/P3Z89w3wf5g/s400/TBS-StartPage.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5313837580220120018" /&gt;&lt;/a&gt;&lt;div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The TopBraid Ensemble team has put great efforts into refactoring and generalizing the Ensemble framework, so that it is now a comprehensive development framework for dynamic business applications. Ensemble applications consist of configurable rich-client components such as trees, forms and graphs (all based on Adobe Flex). These components can be re-arranged and re-wired in many ways, to customize an application's appearance and behavior for specific needs.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;A freshly installed Ensemble comes with a default application that contains a pre-defined configuration of all built-in components. You can select this default application and run it on any RDF/OWL model from your workspace. The following screen shows the default Ensemble application on the geotravel.owl example ontology:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_44lV0kDjySE/Sb6NNkkvoqI/AAAAAAAAAGg/-JLdIsZ5rcs/s1600-h/TopBraidEnsemble-geotravel.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 264px;" src="http://2.bp.blogspot.com/_44lV0kDjySE/Sb6NNkkvoqI/AAAAAAAAAGg/-JLdIsZ5rcs/s400/TopBraidEnsemble-geotravel.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5313839874639372962" /&gt;&lt;/a&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Ensemble is entirely driven by RDF/OWL models. Not only are the user interface components such as trees and forms driven by the underlying ontology, but the state of the whole application is represented by a flexible RDF-based data model. For example, if the selection of the Tree component (on the left) changes, then some RDF triples in the application's data model will change. Other components can react on those changes, and update their own internal state. If the selection of the tree changes, then the Results Grid (upper right) will display the instances of the selected class. This behavior is "soft-coded" though, and can be changed with a few mouse clicks. Below is a screenshot of a configuration dialog that can be used to customize and re-wire the components:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_44lV0kDjySE/Sb6OgBXXBYI/AAAAAAAAAGo/Yy5XM-w-WJY/s1600-h/TBE-Configuration-Tree.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 329px;" src="http://4.bp.blogspot.com/_44lV0kDjySE/Sb6OgBXXBYI/AAAAAAAAAGo/Yy5XM-w-WJY/s400/TBE-Configuration-Tree.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5313841291117135234" /&gt;&lt;/a&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;As shown above, it is possible to change certain properties for each component. For example, the root object and the transitive property of the tree component can be changed dynamically. Similarly, components can listen to events or publish events for other components to consume. This makes it very easy to create custom applications, for example, an application that displays a hierarchy of SKOS terms using the skos:broader property instead of a class tree. Needless to say, various user interface settings such as the choice of available buttons and style sheets are configurable as well. Any end-user with sufficient privileges can make those adjustments and then only needs to press the Save Application button to store this configuration and share it with her co-workers.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Like the rest of the TopBraid Suite, Ensemble is currently in beta stage and is very much work in progress. Now that the generic architecture and framework have been implemented, the team will focus on fleshing out the many details to make each component as flexible, powerful and visually appealing as possible. Expect significant improvements over the next few months - your feedback is appreciated in the meantime. Yet, our customers are not limited to the built-in components. We do provide a documented client-side API that allows anyone to add new Flex/ActionScript components. Furthermore, it is possible to drive parts of the application using server-side &lt;a href="http://sparqlmotion.org"&gt;SPARQLMotion&lt;/a&gt; scripts.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Using Ensemble as the foundation for custom rich internet applications means that you can re-use large chunks of client-side components as well as server-side infrastructure. This infrastructure is well aligned with Composer and its features, such as the various database back-ends. Instead of re-inventing the wheel, you can focus on building the ontologies for your particular domain, and put them to work in your team.&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31416365-6672582497837437901?l=composing-the-semantic-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://composing-the-semantic-web.blogspot.com/feeds/6672582497837437901/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=31416365&amp;postID=6672582497837437901' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/6672582497837437901'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/6672582497837437901'/><link rel='alternate' type='text/html' href='http://composing-the-semantic-web.blogspot.com/2009/03/rapid-semantic-web-application.html' title='Rapid Semantic Web Application Development with TopBraid Ensemble'/><author><name>Holger Knublauch</name><uri>http://www.blogger.com/profile/13180242480924209321</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://www.knublauch.com/images/platypus.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_44lV0kDjySE/Sb6LIBMkO9I/AAAAAAAAAGY/P3Z89w3wf5g/s72-c/TBS-StartPage.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-31416365.post-3267214958835314456</id><published>2009-03-07T10:40:00.000-08:00</published><updated>2009-03-07T10:44:32.740-08:00</updated><title type='text'>TopBraid SPIN API now Open Source</title><content type='html'>&lt;p&gt;Since the release of &lt;a href="http://spinrdf.org/"&gt;SPIN&lt;/a&gt; a few weeks ago, we already had several requests from people who would like to integrate SPIN functionality (SPARQL-based constraint checking, inferencing, user-defined functions) into their own applications. In order to encourage the wider adoption of SPIN in the community, we have therefore decided to make the key features of our SPIN implementation open source.&lt;/p&gt;&lt;p&gt;The &lt;a href="http://www.topquadrant.com/topbraid/spin/api"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;TopBraid SPIN API&lt;/span&gt;&lt;/a&gt; is built on Jena and provides the following features:&lt;/p&gt;&lt;ul&gt;    &lt;li&gt;Converters between textual SPARQL syntax and the SPIN RDF Vocabulary&lt;/li&gt;&lt;li&gt;A SPIN-based constraint checking engine (via spin:constraint)&lt;/li&gt;&lt;li&gt;A SPIN-based inferencing engine (via spin:rule and spin:constructor)&lt;/li&gt;&lt;li&gt;Support to execute user-defined SPIN functions using Jena/ARQ&lt;/li&gt;&lt;li&gt;Support to execute user-defined SPIN templates&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;The license has been selected to allow open source projects (from universities etc) to use SPIN without further complications. For closed source users, we offer a commercial license that also provides business users assurance and support. With this policy we hope to encourage researchers to provide their (open source) implementations back to the community to help the SPIN community grow.&lt;/p&gt;&lt;p&gt;The SPIN API is currently in beta, and the official 1.0 release is scheduled in conjunction with TopBraid 3.0 in the next few weeks. We appreciate your feedback in the meantime.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31416365-3267214958835314456?l=composing-the-semantic-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://composing-the-semantic-web.blogspot.com/feeds/3267214958835314456/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=31416365&amp;postID=3267214958835314456' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/3267214958835314456'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/3267214958835314456'/><link rel='alternate' type='text/html' href='http://composing-the-semantic-web.blogspot.com/2009/03/topbraid-spin-api-now-open-source.html' title='TopBraid SPIN API now Open Source'/><author><name>Holger Knublauch</name><uri>http://www.blogger.com/profile/13180242480924209321</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://www.knublauch.com/images/platypus.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-31416365.post-3397469842889613582</id><published>2009-01-18T10:06:00.001-08:00</published><updated>2009-01-18T12:03:21.124-08:00</updated><title type='text'>The Object-Oriented Semantic Web with SPIN</title><content type='html'>&lt;div style="text-align: left;"&gt;We have recently &lt;a href="http://composing-the-semantic-web.blogspot.com/2009/01/introducing-spin-sparql-inferencing.html"&gt;introduced&lt;/a&gt; the &lt;a href="http://spinrdf.org/"&gt;SPARQL Inferencing Notation (SPIN)&lt;/a&gt; as a mechanism that uses SPARQL to formalize the meaning and behavior of Semantic Web concepts. SPIN provides a light-weight RDF vocabulary that can be used to attach rules (SPARQL CONSTRUCT queries) and constraint checks (ASK queries) to class definitions.&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The design of SPIN was driven by requirements that we (at &lt;a href="http://www.topquadrant.com/"&gt;TopQuadrant&lt;/a&gt;) have collected from customers from "real-world" semantic technology projects. For many of those customers, the current stack of Semantic Web languages is simply not enough. OWL has been designed for certain use cases, but it fails to meet other requirements due to its open-world assumption. As Stefan Decker points out in the entertaining "&lt;a href="http://videolectures.net/iswc08_panel_schneider_owl/"&gt;An OWL 2 Far?&lt;/a&gt;" panel at the 2008 ISWC conference, OWL cannot even be used to check whether an instance of a class meets the cardinality restrictions. In the same panel, Tim Finin argues that OWL does not need to be the only language on the Semantic Web stack, and that instead families of languages are needed depending on the use case. So while OWL is great for some modeling tasks, there is room (and demand) for other modeling paradigms.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;In this article I will introduce SPIN from another angle to illustrate what makes it different, and why I believe that it provides good solutions to many real-world requirements. My main point is that SPIN is borrowing good practices from object-oriented programming and modeling languages and integrates object-oriented techniques with the flexible architecture of Semantic Web to produce a new way of working with linked data.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;As a "Hello World" example let's start with a simple ontology about geometric shapes. It defines a class Rectangle with the following characteristics (screenshot from &lt;a href="http://www.topquadrant.com/topbraid/composer"&gt;TopBraid Composer 3&lt;/a&gt;):&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_44lV0kDjySE/SXN04sNSSjI/AAAAAAAAAFM/XDk_4BbSlb0/s1600-h/SPINSquare-RectangleClass.png"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 242px; height: 400px;" src="http://2.bp.blogspot.com/_44lV0kDjySE/SXN04sNSSjI/AAAAAAAAAFM/XDk_4BbSlb0/s400/SPINSquare-RectangleClass.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5292702504378845746" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_44lV0kDjySE/SXN04sNSSjI/AAAAAAAAAFM/XDk_4BbSlb0/s1600-h/SPINSquare-RectangleClass.png"&gt;&lt;br /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;In this RDF/SPIN ontology, a Rectangle is a class that has three properties. The values of width and height are specified by the user, and a SPIN rule is used to compute the value of the area property by multiplying width and height. Let's have a look at the rule first. A SPIN rule is a SPARQL CONSTRUCT query that has been attached to a class using the spin:rule property. The CONSTRUCT query can use whatever feature of SPARQL it wants, for example to do mathematical calculations.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;A key contribution of SPIN is to introduce a mechanism that allows users to organize those SPARQL queries in a natural, object-oriented way. SPIN rules are not just plain lists of rules like in comparable rule languages (SWRL etc). Instead, the "procedural attachment" of SPIN means that you can arrange the rules in the class hierarchy where they belong. This follows the OO principles of abstraction and encapsulation. Since the rules (and constraints) are attached to classes, any human or agent who looks at the ontology can quickly understand the meaning of the classes and properties. Furthermore, the rules are "scoped" so that tools are better guided when they need to execute the rules and constraints. For example, TopBraid Composer's SPIN engine comes with a mode in which it does incremental inferencing. This means that whenever someone changes the values of width or height, then the value of area will update automatically, as shown with the example instance below:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_44lV0kDjySE/SXN4ofVfCrI/AAAAAAAAAFU/SqvWdV3JNGk/s1600-h/SPINSquare-RectangleInstance.png"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 258px; height: 395px;" src="http://2.bp.blogspot.com/_44lV0kDjySE/SXN4ofVfCrI/AAAAAAAAAFU/SqvWdV3JNGk/s400/SPINSquare-RectangleInstance.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5292706624092179122" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_44lV0kDjySE/SXN4ofVfCrI/AAAAAAAAAFU/SqvWdV3JNGk/s1600-h/SPINSquare-RectangleInstance.png"&gt;&lt;br /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Now let's extend the example and introduce a sub-class of Rectangle called Square. Squares inherit all characteristics of Rectangles, but they are constrained in so far that width and height of a Square must be equal. This fact is expressed using a SPIN constraint as shown below:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_44lV0kDjySE/SXN6g4BZRZI/AAAAAAAAAFc/PQZSSn0z8Iw/s1600-h/SPINSquare-SquareClass.png"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 274px; height: 399px;" src="http://2.bp.blogspot.com/_44lV0kDjySE/SXN6g4BZRZI/AAAAAAAAAFc/PQZSSn0z8Iw/s400/SPINSquare-SquareClass.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5292708692303103378" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_44lV0kDjySE/SXN6g4BZRZI/AAAAAAAAAFc/PQZSSn0z8Iw/s1600-h/SPINSquare-SquareClass.png"&gt;&lt;br /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The constraint is an ASK query that must evaluate to false for all instances of the associated class (Square). Again, any SPARQL graph matching pattern can be tested here, and the dedicated variable ?this is used to access the current instance as a starting point. Here is an example instance of the class Square:&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_44lV0kDjySE/SXN7sQGesmI/AAAAAAAAAFk/7WY5M9KpfqA/s1600-h/SPINSquare-SquareInstance.png"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 274px; height: 394px;" src="http://1.bp.blogspot.com/_44lV0kDjySE/SXN7sQGesmI/AAAAAAAAAFk/7WY5M9KpfqA/s400/SPINSquare-SquareInstance.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5292709987257070178" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;You can see that editing tools can use the constraint definitions to verify user input, and to provide warnings (yellow markers) if values violate a constraint. Since the SPIN constraints are scoped to the class, these tests can be performed very efficiently, only on the instance that the user is currently looking at. In TopBraid Composer, constraints can be incrementally tested after each editing step.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The image above also illustrates another object-oriented aspect of SPIN, namely inheritance: The class Square is a sub-class of Rectangle and thus also inherits the rule that calculates the area from width and height. The same inheritance mechanism applies to constraints, and sub-classes can further constrain or specialize the meaning of its parents.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Now let's look at the meta-modeling capabilities of SPIN, and its closed-world semantics. Previous articles on this blog introduced &lt;a href="http://composing-the-semantic-web.blogspot.com/2009/01/understanding-spin-functions.html"&gt;SPIN Functions&lt;/a&gt; and &lt;a href="http://composing-the-semantic-web.blogspot.com/2009/01/understanding-spin-templates.html"&gt;SPIN Templates&lt;/a&gt;. These are really powerful mechanisms that allow anyone to create their own modeling vocabulary. SPIN Functions are SPARQL functions that can be used in FILTER or LET statements. SPIN Templates are re-usable SPARQL queries that can be instantiated with parameters. In particular you can use pre-defined templates instead of typing in SPARQL queries by hand. SPIN comes with a &lt;a href="http://spinrdf.org/spl.html"&gt;library&lt;/a&gt; of such pre-defined functions and templates to support common modeling patterns. One of the templates from this library, called &lt;a href="http://spinrdf.org/spl.html#Attribute"&gt;spl:Attribute&lt;/a&gt;, can be used to link a class with a property, specifying min/max cardinality, value type and default value all in a single place. Here is an example attribute definition from the Rectangle class:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_44lV0kDjySE/SXN_kiaQTaI/AAAAAAAAAFs/GaY7wsZ7GsY/s1600-h/SPINSquare-RectangleAttribute.png"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 302px; height: 394px;" src="http://4.bp.blogspot.com/_44lV0kDjySE/SXN_kiaQTaI/AAAAAAAAAFs/GaY7wsZ7GsY/s400/SPINSquare-RectangleAttribute.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5292714252779408802" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_44lV0kDjySE/SXN_kiaQTaI/AAAAAAAAAFs/GaY7wsZ7GsY/s1600-h/SPINSquare-RectangleAttribute.png"&gt;&lt;br /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;This attribute definition is an instance of the spl:Attribute template, attached to Rectangle via spin:constraint. Its equivalent in OWL would be a collection of three owl:Restrictions attached to the class via rdfs:subClassOf. However, if we look at the definition of the spl:Attribute template, we can see that the semantics are different:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_44lV0kDjySE/SXOAohsUJaI/AAAAAAAAAF0/FJqAIVJjDN4/s1600-h/SPLAttribute-Body.png"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 176px;" src="http://4.bp.blogspot.com/_44lV0kDjySE/SXOAohsUJaI/AAAAAAAAAF0/FJqAIVJjDN4/s400/SPLAttribute-Body.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5292715420817827234" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_44lV0kDjySE/SXOAohsUJaI/AAAAAAAAAF0/FJqAIVJjDN4/s1600-h/SPLAttribute-Body.png"&gt;&lt;br /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The query above is the body of the spl:Attribute template. When used as a spin:constraint, the system will report constraint violations whenever an instance is found that violates one of the three conditions specified in the query. Among then, is the test for the minimum and maximum number of values: if a Rectangle has less than one or more than one value for width or height, then the system will report an error. If a SPIN template is found, the engine will substitute the occurrences of the argument variables (such as ?predicate and ?minCount) with the provided arguments. In other words, instead of using the template spl:Attribute, the class Rectangle could also have the following constraint, encoded directly as a SPARQL ASK query: &lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_44lV0kDjySE/SXOCdpxUdsI/AAAAAAAAAF8/UPjB9RskJt4/s1600-h/SPINSquare-RectangleConstraint.png"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 351px; height: 243px;" src="http://4.bp.blogspot.com/_44lV0kDjySE/SXOCdpxUdsI/AAAAAAAAAF8/UPjB9RskJt4/s400/SPINSquare-RectangleConstraint.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5292717433030997698" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;However, such SPARQL queries are complicating and hard to maintain, so that wrapping those queries into re-usable SPIN templates is a far better approach. Again, the principle of object-oriented encapsulation is put to use in SPIN. The user of a template does not need to understand all the low-level details of the underlying SPARQL. Similarly, a user does not need to understand the detailed definitions of SPIN functions (such as spl:objectCount and spl:instanceOf shown above), but instead he or she can simply pass in the arguments and leave the details to the engine. Using the SPIN templates mechanism, even the source code becomes easy to read:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_44lV0kDjySE/SXOIkOvojVI/AAAAAAAAAGE/ZkqJi7bOkWM/s1600-h/SPINSquare-RectangleAttributeSourceCode.png"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 135px;" src="http://2.bp.blogspot.com/_44lV0kDjySE/SXOIkOvojVI/AAAAAAAAAGE/ZkqJi7bOkWM/s400/SPINSquare-RectangleAttributeSourceCode.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5292724143105019218" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_44lV0kDjySE/SXOIkOvojVI/AAAAAAAAAGE/ZkqJi7bOkWM/s1600-h/SPINSquare-RectangleAttributeSourceCode.png"&gt;&lt;br /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I have uploaded the complete example source code of the &lt;a href="http://topbraid.org/examples/spinsquare.n3"&gt;spinsquare.n3&lt;/a&gt; file. You will notice that SPIN uses a triple-based &lt;a href="http://spinrdf.org/sp.html"&gt;RDF representation of SPARQL&lt;/a&gt; to overcome the limitations of a pure textual syntax.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;To summarize, SPIN applies concepts from object-oriented languages to the Semantic Web. The meaning and behavior of classes can be formalized in a machine-executable way using rules and constraints, and those rules and constraints are scoped locally to aid the execution engine in achieving best performance. Furthermore, SPIN can be used to define new modeling vocabularies, such as attribute definitions with closed-world semantics. If other semantics are needed, then they can be represented as well, as I have shown in a previous posting on expressing &lt;a href="http://composing-the-semantic-web.blogspot.com/2009/01/owl-2-rl-in-sparql-using-spin.html"&gt;OWL 2 RL in SPIN&lt;/a&gt;.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The expressive power of SPARQL and its wide adoption in industry means that languages like SPIN could go a long way to extend the reach of Semantic Web technology into areas where other languages fail. SPIN combines a powerful rule language with meta-modeling mechanisms including templates and functions. Instead of limiting ourselves to a single modeling paradigm or language, SPIN makes it possible to create task-specific new languages, or domain-specific services such as &lt;a href="http://composing-the-semantic-web.blogspot.com/2009/01/video-sparql-based-unit-conversion-with.html"&gt;unit conversion&lt;/a&gt;. All those SPIN-based languages are completely self-describing and thus only require a single unified execution engine. Thinking about this on the Semantic Web scale means that linked data can be published and used in much more powerful ways than currently envisioned.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31416365-3397469842889613582?l=composing-the-semantic-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://composing-the-semantic-web.blogspot.com/feeds/3397469842889613582/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=31416365&amp;postID=3397469842889613582' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/3397469842889613582'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/3397469842889613582'/><link rel='alternate' type='text/html' href='http://composing-the-semantic-web.blogspot.com/2009/01/object-oriented-semantic-web-with-spin.html' title='The Object-Oriented Semantic Web with SPIN'/><author><name>Holger Knublauch</name><uri>http://www.blogger.com/profile/13180242480924209321</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://www.knublauch.com/images/platypus.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_44lV0kDjySE/SXN04sNSSjI/AAAAAAAAAFM/XDk_4BbSlb0/s72-c/SPINSquare-RectangleClass.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-31416365.post-700686137382609877</id><published>2009-01-09T09:36:00.001-08:00</published><updated>2009-01-09T14:32:31.745-08:00</updated><title type='text'>SPARQLpedia as an Example SPARQLMotion Web Application</title><content type='html'>&lt;a href="http://www.topquadrant.com/"&gt;TopQuadrant&lt;/a&gt; has recently &lt;a href="http://composing-the-semantic-web.blogspot.com/2009/01/sparqlpedia-sharing-semantic-web.html"&gt;launched SPARQLpedia&lt;/a&gt;, a new web service that allows users to share SPARQL queries and to search for queries that others have submitted. The submitted queries are managed on a server-side RDF database together with searchable metadata such as author and submission date. Here is a screenshot of a simple SPARQLpedia web search interface:&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;center&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_44lV0kDjySE/SWeQrSUGmPI/AAAAAAAAACE/YQfHaqHFqdI/s1600-h/SPARQLpedia-SearchForm.png"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 322px;" src="http://1.bp.blogspot.com/_44lV0kDjySE/SWeQrSUGmPI/AAAAAAAAACE/YQfHaqHFqdI/s400/SPARQLpedia-SearchForm.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5289355360694868210" /&gt;&lt;/a&gt;&lt;/center&gt;&lt;div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Pressing the Search button will display a list of matching database entries:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;center&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_44lV0kDjySE/SWeRiGvY75I/AAAAAAAAACM/MbB6ESrt2J8/s1600-h/SPARQLpedia-SearchResults.png"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 246px;" src="http://2.bp.blogspot.com/_44lV0kDjySE/SWeRiGvY75I/AAAAAAAAACM/MbB6ESrt2J8/s400/SPARQLpedia-SearchResults.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5289356302480895890" /&gt;&lt;/a&gt;&lt;/center&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;And the user can click on any of the search results to display details (and execute the selected query):&lt;/div&gt;&lt;center&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_44lV0kDjySE/SWeSIaqe8NI/AAAAAAAAACU/MSmWrLetP8Y/s1600-h/SPARQLpedia-Details.png"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 287px;" src="http://1.bp.blogspot.com/_44lV0kDjySE/SWeSIaqe8NI/AAAAAAAAACU/MSmWrLetP8Y/s400/SPARQLpedia-Details.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5289356960664056018" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/center&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The underlying services of SPARQLpedia can also be called as (REST-based) web services, as described on the &lt;a href="http://sparqlpedia.org/api.html"&gt;API page&lt;/a&gt;.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;In a sense, SPARQLpedia is a typical web application:&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;The application's designers have prepared a database to store the entries&lt;/li&gt;&lt;li&gt;Users can add or delete entries from that database&lt;/li&gt;&lt;li&gt;Users can search for entries in the database by various criteria&lt;/li&gt;&lt;li&gt;A HTML web interface can be used to interact with the database&lt;/li&gt;&lt;li&gt;It can also be accessed programmatically via web services&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;In this blog article, I will give some details on how SPARQLpedia was implemented and highlight the role of &lt;a href="http://sparqlmotion.org/"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;SPARQLMotion&lt;/span&gt;&lt;/a&gt; as its server-side scripting language.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;sparqlpedia.org hosts a standard Apache Tomcat server that runs a &lt;a href="http://www.topquadrant.com/topbraid/live"&gt;TopBraid Live&lt;/a&gt; 3.0 beta application. Installing this server was straight forward and basically included dropping the TopBraid Live war file into the tomcat applications folder. TopBraid Live itself is a generic application development framework that makes tons of RDF/OWL related services available through its APIs. There are two server-side APIs in TopBraid Live:&lt;/div&gt;&lt;div&gt;&lt;ol&gt;&lt;li&gt;The SPARQLMotion API is an entirely model-driven way of creating web services based on the collection of services wrapped as SPARQLMotion modules.&lt;/li&gt;&lt;li&gt;The TopBraid Live Java API can be used to access and extend the capabilities of the server. In our example, we only needed it to add some new specialized SPARQL functions.&lt;/li&gt;&lt;/ol&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;Setting up the Database&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The first step of developing SPARQLpedia was to set up a database with an associated base schema. We are using &lt;a href="http://www.topquadrant.com/topbraid/composer"&gt;TopBraid Composer&lt;/a&gt; for this purpose. The entries in the database are themselves SPARQL queries (but it's easy to translate this to databases hosting product data, academic publications, medical records or whatever). SPARQL queries are entered as strings, but the database stores them in the &lt;a href="http://spinrdf.org/sp.html"&gt;SPIN RDF Syntax&lt;/a&gt;, because this will later allow us to run sophisticated queries on various aspects of the query that would be difficult to achieve if we only had the string representation. So, as a start, we have defined an empty schema ontology that imports the SPIN (&lt;a href="http://spinrdf.org/sp"&gt;sp&lt;/a&gt;) namespace. The rest of our database schema is simple: we store Entries that have been submitted by Users, as illustrated in the class diagram below.&lt;/div&gt;&lt;div style="text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_44lV0kDjySE/SWeaYEu52TI/AAAAAAAAACc/kTsLV-cnpDQ/s1600-h/SPEDIA-Diagram.png"&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 0, 0); "&gt;&lt;/span&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_44lV0kDjySE/SWeaYEu52TI/AAAAAAAAACc/kTsLV-cnpDQ/s1600-h/SPEDIA-Diagram.png"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 199px;" src="http://3.bp.blogspot.com/_44lV0kDjySE/SWeaYEu52TI/AAAAAAAAACc/kTsLV-cnpDQ/s400/SPEDIA-Diagram.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5289366025747945778" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The schema is a collection of RDFS classes and RDF properties. The class spedia:Entry only has a single subclass spedia:QueryEntry, but we may want to add additional types of entries later, such as discussion threads or votes. The schema is stored in a file spedia.owl in our Eclipse workspace.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Next we create a persistent database that will contain the submitted instances. For the simplicity, we use the &lt;a href="http://www.openrdf.org/"&gt;Sesame&lt;/a&gt; 2 native Java back-end in TopBraid, but we could have also used any of the other database types supported by TopBraid, including &lt;a href="http://agraph.franz.com/"&gt;AllegroGraph&lt;/a&gt; and &lt;a href="http://www.oracle.com/technology/tech/semantic_technologies/index.html"&gt;Oracle&lt;/a&gt;. Our Sesame database imports the spedia.owl from above and its files will be also stored in the workspace. We give it the base URI http://sparqlpedia.org/public, so that we access it later as a named graph from our SPARQLMotion scripts.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;Setting up the SPARQLMotion scripts&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://sparqlmotion.org/"&gt;SPARQLMotion&lt;/a&gt; is a visual semantic web scripting language that can be used to build data processing pipelines through a graphical user interface. Typical SPARQLMotion scripts take some input, do some processing and then create some output. TopBraid Composer 3, Maestro Edition is used to build SPARQLMotion scripts, so everything we do (from schema definition and database maintenance to the implementation of the services) is done within a single uniform environment. Let's have a look at an example script, the outline of which is shown in the following screenshot.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;center&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_44lV0kDjySE/SWeftPec6zI/AAAAAAAAACk/s2f1wqR3iiE/s1600-h/SPARQLpedia-deleteQueryScript.png"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 306px;" src="http://2.bp.blogspot.com/_44lV0kDjySE/SWeftPec6zI/AAAAAAAAACk/s2f1wqR3iiE/s400/SPARQLpedia-deleteQueryScript.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5289371886967122738" /&gt;&lt;/a&gt;&lt;/center&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;This SPARQLMotion script (stored in an OWL file deleteQuery.sms.n3 in the workspace) implements the functionality to delete a query from the repository. The script takes two arguments as input:&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;The uri identifying the query that shall be deleted&lt;/li&gt;&lt;li&gt;The password of the submitting user - in SPARQLpedia only the original author of a query can also delete it&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;SPARQLMotion scripts should be laid out (and read) from top to bottom, i.e. you see input coming in from the top, then the input will be processed through a pipeline and finally some results are returned. Each node in the diagram is of a certain module type, and the &lt;a href="http://sparqlmotion.org/sml.html"&gt;SPARQLMotion modules library&lt;/a&gt; provides a comprehensive list of frequently needed data processing tasks. The deleteQuery script has two exit points, marked by the two red icons at the bottom:&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;The left end module is used when the script is called via the web service API and just returns the string "OK" as its result.&lt;/li&gt;&lt;li&gt;The right end module is used when the script is called to render an HTML page.&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;Both end modules have the same type &lt;a href="http://sparqlmotion.org/sml.html#sml:ReturnText"&gt;sml:ReturnText&lt;/a&gt; but return different mime types. The rest of the script is the same in both cases, i.e. the arguments and the steps to perform the actual deletion are used independently of whether we use the web service API or the HTML call. The web services themselves are declared as subclasses of spin:Functions as shown below:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;center&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_44lV0kDjySE/SWejr4CKX_I/AAAAAAAAACs/3711tF1E1Vw/s1600-h/SPARQLpedia-deleteQueryClassHierarchy.png"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 356px; height: 184px;" src="http://3.bp.blogspot.com/_44lV0kDjySE/SWejr4CKX_I/AAAAAAAAACs/3711tF1E1Vw/s400/SPARQLpedia-deleteQueryClassHierarchy.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5289376261541093362" /&gt;&lt;/a&gt;&lt;/center&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The class spedia:deleteQueryBase is an "abstract" base class of the two different services and defines the arguments with the usual &lt;a href="http://composing-the-semantic-web.blogspot.com/2009/01/understanding-spin-functions.html"&gt;SPIN function&lt;/a&gt; syntax:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;center&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_44lV0kDjySE/SWekxySf-nI/AAAAAAAAAC0/_YU-KNOmeYc/s1600-h/SPARQLpedia-deleteQueryBase.png"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 336px; height: 375px;" src="http://4.bp.blogspot.com/_44lV0kDjySE/SWekxySf-nI/AAAAAAAAAC0/_YU-KNOmeYc/s400/SPARQLpedia-deleteQueryBase.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5289377462589848178" /&gt;&lt;/a&gt;&lt;/center&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The two non-abstract subclasses of deleteQueryBase "inherit" the argument declarations but also point to the SPARQLMotion module in the script that creates the result. For example, the web service deleteQueryHTML has the module ReturnHTML as its return module:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;center&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_44lV0kDjySE/SWemF7vNb7I/AAAAAAAAAC8/G-q9ekkBNTI/s1600-h/SPARQLpedia-deleteQueryHTML.png"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 328px;" src="http://2.bp.blogspot.com/_44lV0kDjySE/SWemF7vNb7I/AAAAAAAAAC8/G-q9ekkBNTI/s400/SPARQLpedia-deleteQueryHTML.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5289378908235198386" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/center&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Once the function has been stored in the workspace, it is accessible through a REST URL call, such as http://sparqlpedia.org:8080/tbl/server/tbl/servlet?action=sparqlmotion&amp;amp;id=deleteQuery&amp;amp;uri=...&amp;amp;password=... At development time, we can run the same script within TopBraid Composer ME by hitting localhost:8083 instead. Or we can debug the script manually through the debug button in the graph view of TBC. This has the benefit that we can look at each intermediate step of the script and inspect the state of the triple store and variable bindings with a few mouse clicks.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;A Closer Look at the SPARQLMotion Script&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Let's walk through the example script from above. The script starts with two Argument modules, which are placed automatically by TopBraid based on the function definition. Technically, these are the same instances of spl:Argument as shown as spin:constraints on the deleteQueryBase class. Here is a screenshot of the form for the password argument:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;center&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_44lV0kDjySE/SWfDp3JINGI/AAAAAAAAADs/IUXZTpxXzsY/s1600-h/deleteQuery-Argument.png"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 343px; height: 315px;" src="http://1.bp.blogspot.com/_44lV0kDjySE/SWfDp3JINGI/AAAAAAAAADs/IUXZTpxXzsY/s400/deleteQuery-Argument.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5289411411314226274" /&gt;&lt;/a&gt;&lt;/center&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Each argument can declare a value type that can be used for error checking, and will be used to transform the REST arguments (always strings) into the correct kind of RDF literals or resources. All downstream modules of the SPARQLMotion script can now access the value of the password argument as a SPARQL variable called ?argument. The other argument of the service is accessible as ?uri. The next module &lt;span class="Apple-style-span" style="font-weight: bold;"&gt;Check entry exists&lt;/span&gt; is of the type sml:AssertTrue (new in 3.0) and simply verifies that the provided URI is in fact a valid entry in the database:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;center&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_44lV0kDjySE/SWfGOfxo99I/AAAAAAAAAD0/nneUK0lsSDY/s1600-h/deleteQuery-CheckEntryExists.png"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 359px; height: 349px;" src="http://3.bp.blogspot.com/_44lV0kDjySE/SWfGOfxo99I/AAAAAAAAAD0/nneUK0lsSDY/s400/deleteQuery-CheckEntryExists.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5289414239720110034" /&gt;&lt;/a&gt;&lt;/center&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;When this module is executed, the specified ASK query will be executed. If the query returns false, the script will exit with an error message. The error message in constructed from the template given as sml:text, in which {?uri} is substituted with the actual argument value. But wait, which triple store does this query run on? If you scroll up to the script's overview you can see that the &lt;span class="Apple-style-span" style="font-weight: bold;"&gt;Check entry exists&lt;/span&gt; module also has the &lt;span class="Apple-style-span" style="font-weight: bold;"&gt;Connect to DB&lt;/span&gt; module as one of its predecessors. As usual in SPARQLMotion, the triples represented by the predecessors will be visible in the queries downstream. As shown in the following picture, &lt;span class="Apple-style-span" style="font-weight: bold;"&gt;Connect to DB&lt;/span&gt; just opens the Sesame database:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;center&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_44lV0kDjySE/SWfHDjE1MWI/AAAAAAAAAEE/IQXMWXcvNpY/s1600-h/deleteQuery-ConnectToDB.png"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 359px; height: 272px;" src="http://1.bp.blogspot.com/_44lV0kDjySE/SWfHDjE1MWI/AAAAAAAAAEE/IQXMWXcvNpY/s400/deleteQuery-ConnectToDB.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5289415151138976098" /&gt;&lt;/a&gt;&lt;/center&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The module above connects to the database via its base URI, so we could later replace it with some other kind of database with the same base URI. Just in case our Sesame DB would explode in size... Ok, by now we have reached the stage where we have verified that the provided ?uri is in fact a valid instance of spedia:QueryEntry in our database. Next, let's validate the password. Another sml:AssertTrue module is used for that purpose as shown below.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;center&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_44lV0kDjySE/SWfHSC4y_CI/AAAAAAAAAEM/zyvi47hpAdQ/s1600-h/deleteQuery-CheckPassword.png"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 345px; height: 364px;" src="http://4.bp.blogspot.com/_44lV0kDjySE/SWfHSC4y_CI/AAAAAAAAAEM/zyvi47hpAdQ/s400/deleteQuery-CheckPassword.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5289415400196602914" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/center&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;They key aspect of the &lt;span class="Apple-style-span" style="font-weight: bold;"&gt;Check password&lt;/span&gt; module is an ASK query that gets the spedia:User object that has submitted the query with the given ?uri and then checks whether this user has the provided ?password. It throws an error if the password in the database does not match. Once all those tests are passed, the script can go on with the actual delete. The &lt;span class="Apple-style-span" style="font-weight: bold;"&gt;Delete entry&lt;/span&gt; module is an instance of &lt;a href="http://sparqlmotion.org/sml.html#sml:PerformUpdate"&gt;sml:PerformUpdate&lt;/a&gt; that runs a SPARQL update call deleting all triples that have the given ?uri as their subject. Now that the query is gone the script forks, depending on how it was called. Assuming the script was called to return an HTML page, it continues with the right branch and the module &lt;span class="Apple-style-span" style="font-weight: bold;"&gt;Return delete query result&lt;/span&gt; will be ignored. The resulting HTML page will look like the following:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;center&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_44lV0kDjySE/SWe0NG_UquI/AAAAAAAAADk/uPW0Dhs_ViY/s1600-h/SPARQLpedia-DeleteQueryResultHTML.png"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 213px;" src="http://2.bp.blogspot.com/_44lV0kDjySE/SWe0NG_UquI/AAAAAAAAADk/uPW0Dhs_ViY/s400/SPARQLpedia-DeleteQueryResultHTML.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5289394424677444322" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/center&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;In order to produce this HTML page, the end result module uses a template string with the basic HTML outline. Only the URI string is different each time, the rest is static. The &lt;span class="Apple-style-span" style="font-weight: bold;"&gt;Return HTML&lt;/span&gt; module looks like the following.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;center&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_44lV0kDjySE/SWfHmj0R8_I/AAAAAAAAAEU/eElc0EZwS0c/s1600-h/deleteQuery-ReturnHTML.png"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 382px;" src="http://1.bp.blogspot.com/_44lV0kDjySE/SWfHmj0R8_I/AAAAAAAAAEU/eElc0EZwS0c/s400/deleteQuery-ReturnHTML.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5289415752633414642" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/center&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The HTML page itself is encoded as a template into which {?uriString} and {?footer} will be inserted at execution time. An alternative way of creating HTML pages from a template is via the &lt;a href="http://composing-the-semantic-web.blogspot.com/2007/11/creating-documents-with-sparql-and-jsp.html"&gt;Semantic JSP&lt;/a&gt; support in TopBraid and SPARQLMotion (not shown here).&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The outcome is then sent back to the client using text/html mime format. The footer is re-used in several HTML pages in our system, so we import it from a file:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;center&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_44lV0kDjySE/SWfIMcC_qoI/AAAAAAAAAEc/T4ropYCYLZU/s1600-h/deleteQuery-ImportFooter.png"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 340px; height: 317px;" src="http://2.bp.blogspot.com/_44lV0kDjySE/SWfIMcC_qoI/AAAAAAAAAEc/T4ropYCYLZU/s400/deleteQuery-ImportFooter.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5289416403382676098" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/center&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;To complete the script, a small detail is that we want to display the ?uri as a full string and therefore insert a string conversion module before we insert it into the template:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;center&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_44lV0kDjySE/SWfI2acIXuI/AAAAAAAAAEk/b4DSmhqPXQw/s1600-h/deleteQuery-GetURIString.png"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 371px; height: 323px;" src="http://3.bp.blogspot.com/_44lV0kDjySE/SWfI2acIXuI/AAAAAAAAAEk/b4DSmhqPXQw/s400/deleteQuery-GetURIString.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5289417124505738978" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/center&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;That's it! The script is now finished and ready to be used, assuming the deleteQuery.sms.n3 file has been uploaded to the TopBraid Liver server's workspace.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The other services are also implemented using SPARQLMotion scripts:&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;submitQuery&lt;/span&gt; takes a query string, comment, user name and password as arguments and uses SPARQL INSERT queries to insert those as QueryEntries into the database.&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;findQueries&lt;/span&gt; takes a namespace, resource URIs or a user name as arguments and then runs a SPARQL CONSTRUCT query to create an RDF response. This response is optionally rendered into a HTML table. To gain best performance, the SPARQL query string is assembled dynamically based on the input from various clause templates.&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;renderQuery&lt;/span&gt; takes a query URI and creates a pretty HTML page from it.&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;Summary&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;This example shows how the TopBraid Live platform and its SPARQLMotion support can be used to implement scalable public web services and HTML-based internet applications. SPARQLMotion can be used to define almost arbitrary REST-based web services. Deployment of those services together with the ontologies and triple stores they operate on is fairly simple. The scripts and the ontologies can be defined and tested using TopBraid Composer ME.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Please be aware that the approach shown here covers just one aspect of the TopBraid Live platform. Another approach for developing user interfaces is via &lt;a href="http://www.topquadrant.com/topbraid/ensemble"&gt;TopBraid Ensemble&lt;/a&gt;. Version 3.0 (coming soon) is a complete framework for building rich Flex-based interfaces from configurable components. More on this some other day...&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31416365-700686137382609877?l=composing-the-semantic-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://composing-the-semantic-web.blogspot.com/feeds/700686137382609877/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=31416365&amp;postID=700686137382609877' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/700686137382609877'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/700686137382609877'/><link rel='alternate' type='text/html' href='http://composing-the-semantic-web.blogspot.com/2009/01/sparqlpedia-as-example-sparqlmotion-web.html' title='SPARQLpedia as an Example SPARQLMotion Web Application'/><author><name>Holger Knublauch</name><uri>http://www.blogger.com/profile/13180242480924209321</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://www.knublauch.com/images/platypus.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_44lV0kDjySE/SWeQrSUGmPI/AAAAAAAAACE/YQfHaqHFqdI/s72-c/SPARQLpedia-SearchForm.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-31416365.post-5965587611905642250</id><published>2009-01-08T15:34:00.000-08:00</published><updated>2009-01-08T16:47:32.167-08:00</updated><title type='text'>Understanding SPIN Templates</title><content type='html'>The &lt;a href="http://spinrdf.org/spin.html"&gt;SPIN Modeling Vocabulary&lt;/a&gt; defines a mechanism to encapsulate SPARQL queries so that they can be reused in different contexts: &lt;a href="http://spinrdf.org/spin.html#spin-templates"&gt;SPIN Templates&lt;/a&gt;. A SPIN Template is basically a canned SPARQL query that is parameterized with arguments. In this blog entry, I will walk through an example SPIN template to explain how templates are defined and used. In the end of this article I will also boldly explain why I believe that SPIN is potentially one of the missing links in the Semantic Web puzzle, and a disruptive killer technology.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;If you haven't done so yet, please read the previous posting about &lt;a href="http://composing-the-semantic-web.blogspot.com/2009/01/understanding-spin-functions.html"&gt;Understanding SPIN Functions&lt;/a&gt;. SPIN Functions and Templates basically use the same mechanisms - the main difference is that templates are more general.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;We will again use the &lt;a href="http://topbraid.org/examples/kennedysSPIN"&gt;kennedysSPIN&lt;/a&gt; ontology that is shipped with &lt;a href="http://composing-the-semantic-web.blogspot.com/2008/12/topbraid-composer-30-goes-into-beta.html"&gt;TopBraid Composer 3.0&lt;/a&gt;. This example ontology defines various family relationships, including parent, grandFather and grandMother. The example uses a template called InferGrandParent to derive the values of the two grand parent properties from the values of parent and gender.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Let's first have a look at how these relationships could be inferred using plain SPARQL queries. In the following screenshots, we have attached two SPARQL CONSTRUCT queries as spin:rules to the class Person.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;center&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_44lV0kDjySE/SWaTj7N4wWI/AAAAAAAAABc/gT6YQaoWo90/s1600-h/InferGrandParent-TBC-Rules.png"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 329px; height: 400px;" src="http://4.bp.blogspot.com/_44lV0kDjySE/SWaTj7N4wWI/AAAAAAAAABc/gT6YQaoWo90/s400/InferGrandParent-TBC-Rules.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5289077057793868130" /&gt;&lt;/a&gt;&lt;/center&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The upper rule computes the values of grandFather while the lower rule infers the values of grandMother. We can see that both rules are almost identical: both queries walk up the parent relationship two steps and then check the gender of the grand parent. The only difference are the pairs grandFather/male and grandMother/female, but the basic structure of the queries is the same. SPIN templates can be used to generalize such query patterns so that they can be reused in a more maintainable way. In our example, we will introduce a template that allows us to replace the two individual SPARQL queries, so that the rules look will like in the following screenshot.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;center&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_44lV0kDjySE/SWaVYQASjlI/AAAAAAAAABs/SAswXhrACmg/s1600-h/InferGrandParent-TBC-TemplateCalls.png"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 240px;" src="http://4.bp.blogspot.com/_44lV0kDjySE/SWaVYQASjlI/AAAAAAAAABs/SAswXhrACmg/s400/InferGrandParent-TBC-TemplateCalls.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5289079056238808658" /&gt;&lt;/a&gt;&lt;/center&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;In order to get there, we first introduce a template called InferGrandParent, the definition of which is shown below.&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;center&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_44lV0kDjySE/SWaUok8HC3I/AAAAAAAAABk/K0UsoID3bDM/s1600-h/InferGrandParent-TBC.png"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 242px; height: 400px;" src="http://2.bp.blogspot.com/_44lV0kDjySE/SWaUok8HC3I/AAAAAAAAABk/K0UsoID3bDM/s400/InferGrandParent-TBC.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5289078237224700786" /&gt;&lt;/a&gt;&lt;/center&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;A SPIN template is a class that has the metaclass spin:Template as its type. I recommend creating a subclass of the system class spin:Templates to keep your templates organized in the class tree. A template should have a comment describing what the template does and can have any number of arguments. These arguments are similar to the arguments of SPIN Functions described earlier; the main difference is that the arguments of templates are unordered and can point to any property instead of being limited to sp:arg1, sp:arg2 etc.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;In our example template, we need two arguments:&lt;/div&gt;&lt;div&gt;&lt;ol&gt;&lt;li&gt;the gender that we are matching against (male or female)&lt;br /&gt;&lt;/li&gt;&lt;li&gt;the predicate that we want to infer (grandFather or grandMother)&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;&lt;div&gt;The values of those arguments will be inserted into the body query of the template at execution time. Let's take the rule to infer the grandFather relationship as an example. The instantiated template is an instance of the template class in which the values for gender and predicate are filled in:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;center&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_44lV0kDjySE/SWaXx3AnVSI/AAAAAAAAAB0/2Sf_Qf4Ehq4/s1600-h/InferGrandParent-TBC-grandFatherCall.png"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 200px;" src="http://3.bp.blogspot.com/_44lV0kDjySE/SWaXx3AnVSI/AAAAAAAAAB0/2Sf_Qf4Ehq4/s400/InferGrandParent-TBC-grandFatherCall.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5289081695229138210" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/center&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;When executed as a SPIN rule, the template call above will be substituted with the body of the template, so that we get:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;center&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_44lV0kDjySE/SWaY3-1Fz3I/AAAAAAAAAB8/T9n30AoGLcw/s1600-h/InferGrandParent-TBC-Instantiated.png"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 318px; height: 130px;" src="http://1.bp.blogspot.com/_44lV0kDjySE/SWaY3-1Fz3I/AAAAAAAAAB8/T9n30AoGLcw/s400/InferGrandParent-TBC-Instantiated.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5289082899919130482" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/center&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;So instantiating the template has the effect that the variables ?predicate and ?gender have been replaced with the arguments; in this case: grandFather and male. The same template can now be reused for the pair grandMother and female.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;To summarize, SPIN templates are a powerful mechanism to put SPARQL queries into a (black) box so that you or others can reuse a piece of behavior, even without having to worry about the specific details of the query. Instead, they can use a simple form-based interface to "fill in the blanks" and let the system do the low-level SPARQLing.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Taking this idea further, SPIN templates are a mechanism to create arbitrary new ontology modeling languages. For example, I have shown how you can create templates that encapsulate &lt;a href="http://composing-the-semantic-web.blogspot.com/2009/01/video-sparql-based-unit-conversion-with.html"&gt;unit conversion&lt;/a&gt; expert knowledge. Another example was the re-definition of &lt;a href="http://composing-the-semantic-web.blogspot.com/2009/01/owl-2-rl-in-sparql-using-spin.html"&gt;OWL 2 RL using SPARQL&lt;/a&gt;, although the latter did not really use template arguments because all rules were global. The &lt;a href="http://spinrdf.org/spl.html"&gt;SPIN Standard Modules Library&lt;/a&gt; is another example of very generic templates for tasks such as cardinality constraint checking. But these examples may be just the tip of the iceberg. There could be a marketplace for SPIN template libraries consisting of domain-specific modeling languages with executable semantics.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Instead of hard-coding a pre-defined collection of modeling constructs such as OWL with its system vocabulary owl:Restriction, owl:FunctionalProperty etc, SPIN is an extensible framework for building your own modeling language. There is no need for SPIN-aware tools to hard-code the semantics of any specific modeling language - all they need to understand is how to execute SPIN templates, and the rest is completely driven by whatever is encoded in the particular ontology. SPIN users are not restricted by the vocabulary that any particular W3C committee has selected for them. Instead the democracy of the Semantic Web user's community will select the ideal set of those constructs that are really needed in practice.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31416365-5965587611905642250?l=composing-the-semantic-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://composing-the-semantic-web.blogspot.com/feeds/5965587611905642250/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=31416365&amp;postID=5965587611905642250' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/5965587611905642250'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/5965587611905642250'/><link rel='alternate' type='text/html' href='http://composing-the-semantic-web.blogspot.com/2009/01/understanding-spin-templates.html' title='Understanding SPIN Templates'/><author><name>Holger Knublauch</name><uri>http://www.blogger.com/profile/13180242480924209321</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://www.knublauch.com/images/platypus.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_44lV0kDjySE/SWaTj7N4wWI/AAAAAAAAABc/gT6YQaoWo90/s72-c/InferGrandParent-TBC-Rules.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-31416365.post-4940298104397131253</id><published>2009-01-08T13:57:00.000-08:00</published><updated>2009-01-08T17:37:57.878-08:00</updated><title type='text'>Understanding SPIN Functions</title><content type='html'>We have recently &lt;a href="http://composing-the-semantic-web.blogspot.com/2009/01/introducing-spin-sparql-inferencing.html"&gt;introduced SPIN&lt;/a&gt;, a light-weight vocabulary that enables the use of SPARQL to define constraints and inference rules for semantic web models. One very powerful facet of SPIN is that it can be used to define new SPARQL FILTER and LET functions without writing a single line of programming code. The goal of this blog entry is to explain the mechanisms of &lt;a href="http://www.topquadrant.com/spin/spin.html#spin-functions"&gt;user-defined SPIN functions&lt;/a&gt; using an example from the &lt;a href="http://topbraid.org/examples/kennedysSPIN"&gt;kennedysSPIN&lt;/a&gt; ontology that is shipped with &lt;a href="http://composing-the-semantic-web.blogspot.com/2008/12/topbraid-composer-30-goes-into-beta.html"&gt;TopBraid Composer 3.0&lt;/a&gt;.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Let's look at an example function called getFather that returns the father of a given person:&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;center&gt;&lt;img style="cursor:pointer; cursor:hand;width: 293px; height: 400px;" src="http://2.bp.blogspot.com/_44lV0kDjySE/SWZ4aK112zI/AAAAAAAAAA0/nSoNi58cn_Q/s400/getFather-TBC.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5289047203375340338" /&gt;&lt;/center&gt;&lt;div&gt;&lt;br /&gt;Each SPIN function is an instance of the metaclass spin:Function. The best way to create a new function is to create a subclass of spin:Functions, a system class that groups together all available functions in the class hierarchy. The name of the function defines the URI under which is will be accessible from SPARQL queries. The function getFather is in a file with the default namespace, i.e. no prefix is needed to call it. The following example shows a function call of :getFather() in the LET assignment.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;center&gt;&lt;img src="http://www.topquadrant.com/topbraid/composer/images/SPIN-FunctionCall-getFather.png" /&gt;&lt;/center&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;You can see that the getFather function takes one argument. Each SPIN function must formally declare its arguments. For each argument, the function class must have a spin:constraint that points to an spl:Argument object. For each argument of the function, the spl:Argument specifies:&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;a comment describing the argument&lt;/li&gt;&lt;li&gt;the name and index (e.g., sp:arg1 for the first argument)&lt;/li&gt;&lt;li&gt;the value type (such as xsd:string)&lt;/li&gt;&lt;li&gt;whether it is optional or not&lt;/li&gt;&lt;li&gt;a default value in case it is optional&lt;/li&gt;&lt;/ul&gt;The easiest way of creating such an Argument definition in TopBraid is via drag and drop: locate sp:arg1 in the Properties View and then drag it over the spin:constraint label to instantiate a spl:Argument template. Here is the definition of the first (and only) argument of getFather in TopBraid:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;center&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_44lV0kDjySE/SWZ9ovbFO4I/AAAAAAAAAA8/RydkmemYY60/s1600-h/getFather-TBC-Argument.png"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 353px; height: 271px;" src="http://4.bp.blogspot.com/_44lV0kDjySE/SWZ9ovbFO4I/AAAAAAAAAA8/RydkmemYY60/s400/getFather-TBC-Argument.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5289052951271521154" /&gt;&lt;/a&gt;&lt;/center&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The fact that those arguments are attached using spin:constraint might be confusing at first. You can ignore this and simply treat it as a convention that SPIN uses to look up which arguments are defined for a function. A technical explanation is that function calls are instances of the function class, and that those instances must fulfill the value type constraint encoded in the spl:Argument. spl:Argument is a SPIN template that encodes this value type check by means of another SPARQL query. But again, you can ignore this aspect.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;But now let's have a look at the key aspect of a SPIN function definition: the function's body. The property spin:body links a function class with a SPARQL query. This is the query that will be executed whenever the function is called. The SPARQL query must be either an ASK query or a SELECT query.&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;If the body is an ASK query, then the function's result is true or false&lt;/li&gt;&lt;li&gt;If the body is a SELECT query, then the function's result is the first variable binding of the result variable in the SELECT clause. All other values will be ignored. Null will be returned if no binding exists.&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;In the getFather function, the body is a SELECT function, because we are interested in a specific instance of person, bound to the result variable ?father:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;center&gt;&lt;img style="cursor:pointer; cursor:hand;width: 353px; height: 159px;" src="http://4.bp.blogspot.com/_44lV0kDjySE/SWZ_-gGpAgI/AAAAAAAAABE/3-QN-uk_GYI/s400/getFather-TBC-Body.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5289055524139631106" /&gt;&lt;/center&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;As you can see in the screenshot above, the body query refers to the variable ?arg1 and TopBraid Composer displays those variables in bold face. At execution time, ?arg1 will already have a value pre-assigned to it, namely the function's argument. In the following function call, ?arg1 is bound to the instance kennedys:JohnKennedy.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;center&gt;&lt;img style="cursor:pointer; cursor:hand;width: 362px; height: 289px;" src="http://4.bp.blogspot.com/_44lV0kDjySE/SWaB1RnCopI/AAAAAAAAABM/rDGErl6L3WQ/s400/getFather-TBC-Call.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5289057564653429394" /&gt;&lt;/center&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Now, when the SPIN engine executes the getFather function, it will pre-bind the ?arg1 argument so that it becomes:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;center&gt;&lt;img style="cursor:pointer; cursor:hand;width: 327px; height: 82px;" src="http://4.bp.blogspot.com/_44lV0kDjySE/SWaDVS7Om_I/AAAAAAAAABU/RFY0GbFVrpA/s400/getFather-TBC-Instantiated.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5289059214273977330" /&gt;&lt;/center&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;So to summarize, SPIN functions are wrapped SPARQL queries that contain references to argument variables such as ?arg1 and ?arg2. These argument variables will be pre-assigned to the actual arguments at execution time.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Once you have defined your function, you can store them in a file ending with .spin., e.g. myFunctions.spin.n3 and you will be able to use them anywhere in TopBraid without even importing the function's file. This allows anyone to create and share libraries of functions, for example to do generic things such as &lt;a href="http://composing-the-semantic-web.blogspot.com/2009/01/video-sparql-based-unit-conversion-with.html"&gt;unit conversion&lt;/a&gt;.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;These very same mechanisms are also used to define &lt;a href="http://www.topquadrant.com/spin/spin.html#spin-templates"&gt;SPIN templates&lt;/a&gt;, but this is &lt;a href="http://composing-the-semantic-web.blogspot.com/2009/01/understanding-spin-templates.html"&gt;another topic...&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31416365-4940298104397131253?l=composing-the-semantic-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://composing-the-semantic-web.blogspot.com/feeds/4940298104397131253/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=31416365&amp;postID=4940298104397131253' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/4940298104397131253'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/4940298104397131253'/><link rel='alternate' type='text/html' href='http://composing-the-semantic-web.blogspot.com/2009/01/understanding-spin-functions.html' title='Understanding SPIN Functions'/><author><name>Holger Knublauch</name><uri>http://www.blogger.com/profile/13180242480924209321</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://www.knublauch.com/images/platypus.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_44lV0kDjySE/SWZ4aK112zI/AAAAAAAAAA0/nSoNi58cn_Q/s72-c/getFather-TBC.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-31416365.post-4800927695052731013</id><published>2009-01-07T13:11:00.000-08:00</published><updated>2009-01-07T14:04:14.072-08:00</updated><title type='text'>SPARQLpedia: Sharing Semantic Web queries on the Semantic Web</title><content type='html'>Together with the &lt;a href="http://composing-the-semantic-web.blogspot.com/2008/12/topbraid-composer-30-goes-into-beta.html"&gt;TopBraid Composer 3.0 beta&lt;/a&gt;, &lt;a href="http://www.topquadrant.com/"&gt;TopQuadrant&lt;/a&gt; is also launching a new web service called &lt;a href="http://sparqlpedia.org/"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;SPARQLpedia&lt;/span&gt;&lt;/a&gt;. This is a free, public service that hosts SPARQL queries in a searchable repository. Anyone can submit new SPARQL queries. Anyone can search the repository for queries that mention a given namespace, certain resource URIs or have been submitted by certain users. All submitted queries that mention a SPARQL endpoint (FROM clause) can be conveniently executed online with a Run Query button.&lt;div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The SPARQLpedia repository can be accessed in three ways:&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;as a (REST-based) &lt;a href="http://sparqlpedia.org/api.html"&gt;web service&lt;/a&gt; from any application&lt;/li&gt;&lt;li&gt;via an HTML web interface at &lt;a href="http://sparqlpedia.org/"&gt;http://sparqlpedia.org&lt;/a&gt;&lt;/li&gt;&lt;li&gt;using submit and query buttons in &lt;a href="http://www.topquadrant.com/topbraid/composer"&gt;TopBraid Composer&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;Here is a screenshot of the web interface displaying an example query from the repository:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;center&gt;&lt;a href="http://www.topquadrant.com/topbraid/composer/images/blog/SPARQLpedia-Query.png"&gt;&lt;img src="http://www.topquadrant.com/topbraid/composer/images/blog/SPARQLpedia-Query.300.png" /&gt;&lt;/a&gt;&lt;/center&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Here is a screenshot of the new SPARQLpedia search view of TopBraid Composer. It shows how users can conveniently store a library of their favorite queries and use the queries from this library with a few mouse clicks.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;center&gt;&lt;a href="http://www.topquadrant.com/topbraid/composer/images/blog/SPARQLpedia-in-TBC.png"&gt;&lt;img src="http://www.topquadrant.com/topbraid/composer/images/blog/SPARQLpedia-in-TBC.300.png" /&gt;&lt;/a&gt;&lt;/center&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;There are several motivations for us to implement this service. First, I believe that many SPARQL queries are reusable in one way or another - they may demonstrate design patterns or ask common questions. There is a lot of useful knowledge encoded in queries. In the spirit of modern web applications, SPARQLpedia provides a mechanism to share and reuse queries on a global scale.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Second, SPARQLpedia serves as an example application to demonstrate how our &lt;a href="http://www.topquadrant.com/topbraid/live"&gt;TopBraid Live&lt;/a&gt; platform and &lt;a href="http://sparqlmotion.org/"&gt;SPARQLMotion&lt;/a&gt; can be used to implement RDF-based services. I will provide details on the implementation of SPARQLpedia and its use of &lt;a href="http://spinrdf.org/"&gt;SPIN&lt;/a&gt; and SPARQLMotion in a follow up posting. Since SPARQLpedia is implemented using SPARQLMotion, any company with a TopBraid Live license can also host their local SPARQL repositories inside of their firewalls to share frequently used queries among team members.&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31416365-4800927695052731013?l=composing-the-semantic-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://composing-the-semantic-web.blogspot.com/feeds/4800927695052731013/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=31416365&amp;postID=4800927695052731013' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/4800927695052731013'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/4800927695052731013'/><link rel='alternate' type='text/html' href='http://composing-the-semantic-web.blogspot.com/2009/01/sparqlpedia-sharing-semantic-web.html' title='SPARQLpedia: Sharing Semantic Web queries on the Semantic Web'/><author><name>Holger Knublauch</name><uri>http://www.blogger.com/profile/13180242480924209321</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://www.knublauch.com/images/platypus.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-31416365.post-588895553046913421</id><published>2009-01-06T12:15:00.000-08:00</published><updated>2009-01-06T12:32:39.271-08:00</updated><title type='text'>SPIN Box: A SPARQL-based Computer Game Engine</title><content type='html'>Here is another example video (5 minutes) illustrating what you can do with &lt;a href="http://spinrdf.org/"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;SPIN&lt;/span&gt;&lt;/a&gt;. &lt;a href="http://composing-the-semantic-web.blogspot.com/2008/12/topbraid-composer-30-goes-into-beta.html"&gt;TopBraid Composer 3.0 beta&lt;/a&gt; comes with a SPARQL-based computer game engine called SPIN Box. This engine allows ontology developers to create new kinds of computer games without having to hard-code anything in a programming language like Java. Instead, the engine runs SPARQL CONSTRUCT rules (using SPIN) to determine the behavior of each field in the game.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;center&gt;&lt;a href="http://www.topquadrant.com/topbraid/composer/videos/2009-01-05-SPIN-Box.html"&gt;&lt;img src="http://www.topquadrant.com/topbraid/composer/videos/2009-01-05-SPIN-Box.png" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/center&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The game may appear silly but the underlying message is a powerful one: the game demonstrates how Semantic Web standards and tools can be used for model-driven application development. The SPIN framework can be used to create domain models that have executable behavior attached to them. Being based on RDF and SPARQL, SPIN files can be shared online and re-purposed for different use cases. For example, anyone can extend the behavior of a computer game by introducing new types of objects. Theoretically such applications can even use other (Semantic) Web resources or background knowledge to drive their behavior.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;While traditional applications operate on closed worlds, the Semantic Web has been designed to be open and linkable. Frameworks such as SPIN open an application's architecture and can provide an unprecedented level of dynamic behavior and flexibility. The box is now open.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31416365-588895553046913421?l=composing-the-semantic-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://composing-the-semantic-web.blogspot.com/feeds/588895553046913421/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=31416365&amp;postID=588895553046913421' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/588895553046913421'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/588895553046913421'/><link rel='alternate' type='text/html' href='http://composing-the-semantic-web.blogspot.com/2009/01/spin-box-sparql-based-computer-game.html' title='SPIN Box: A SPARQL-based Computer Game Engine'/><author><name>Holger Knublauch</name><uri>http://www.blogger.com/profile/13180242480924209321</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://www.knublauch.com/images/platypus.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-31416365.post-7500891758400593021</id><published>2009-01-05T17:32:00.001-08:00</published><updated>2009-01-05T17:55:23.505-08:00</updated><title type='text'>Video: SPARQL-based Unit Conversion with SPIN</title><content type='html'>Here is a video on another example application of &lt;a href="http://spinrdf.org/"&gt;SPIN&lt;/a&gt;. This time we are using SPARQL rules to convert values between units of measurement. In the example we convert from centimeters to feet and cubic meters to cubic feet. Two solutions are presented: The first is using SPARQL CONSTRUCTs that have the conversion factors encoded as part of the spin:rules. The second solution is much more generic and uses a NASA units ontology (developed by TopQuadrant) to dynamically find the appropriate conversion factors. For this second solution, the video also shows how to &lt;a href="http://spinrdf.org/spin.html#spin-functions"&gt;define new SPARQL functions using SPIN&lt;/a&gt;, and how to use &lt;a href="http://spinrdf.org/spin.html#spin-templates"&gt;SPIN templates&lt;/a&gt; to encapsulate reusable queries. The video is a step-by-step tutorial and takes about 16 minutes to complete. If you haven't done so yet, you should have a look at the &lt;a href="http://www.topquadrant.com/topbraid/composer/spin.html"&gt;TopBraid Composer SPIN page&lt;/a&gt; to get some background and screenshots about SPIN functions and templates.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;center&gt;&lt;a href="http://www.topquadrant.com/topbraid/composer/videos/2009-01-04-SPIN-UnitConversion.html"&gt;&lt;img src="http://www.topquadrant.com/topbraid/composer/videos/2009-01-04-SPIN-UnitConversion.png" /&gt;&lt;/a&gt;&lt;/center&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I believe this is a fine example of what can be achieved if Semantic Web technology is applied the way that it should: to share data models and knowledge together with executable semantics. SPIN might be a missing link in the Semantic Web stack, because it allows users to create and share domain-specific modeling languages that encapsulate all the background needed to build useful applications out of them.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31416365-7500891758400593021?l=composing-the-semantic-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://composing-the-semantic-web.blogspot.com/feeds/7500891758400593021/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=31416365&amp;postID=7500891758400593021' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/7500891758400593021'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/7500891758400593021'/><link rel='alternate' type='text/html' href='http://composing-the-semantic-web.blogspot.com/2009/01/video-sparql-based-unit-conversion-with.html' title='Video: SPARQL-based Unit Conversion with SPIN'/><author><name>Holger Knublauch</name><uri>http://www.blogger.com/profile/13180242480924209321</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://www.knublauch.com/images/platypus.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-31416365.post-2135121302249807970</id><published>2009-01-05T15:43:00.000-08:00</published><updated>2009-07-03T12:04:21.262-07:00</updated><title type='text'>OWL 2 RL in SPARQL using SPIN</title><content type='html'>The evolving OWL 2 standard comes with a profile called OWL RL. According to the &lt;a href="http://www.w3.org/TR/owl2-profiles/#OWL_2_RL"&gt;OWL 2 RL W3C page&lt;/a&gt; "the OWL 2 RL profile is aimed at applications that require scalable reasoning without sacrificing too much expressive power. It is designed to accommodate both OWL 2 applications that can trade the full expressivity of the language for efficiency, and RDF(S) applications that need some added expressivity from OWL 2. This is achieved by defining a syntactic subset of OWL 2 which is amenable to implementation using rule-based technologies".&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;This means that there will soon be a well-defined specification that expresses the semantics of a good subset of OWL in a format that can be handled by rule engines. Many OWL implementations (such as &lt;a href="http://www.ontotext.com/owlim/"&gt;OWLIM&lt;/a&gt; or &lt;a href="http://jena.sourceforge.net/"&gt;Jena&lt;/a&gt;) have already used such a rule-based approach for ages and in many cases their performance is much better than with tableaux-based OWL implementations.&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Based on its CONSTRUCT keyword, SPARQL can also be considered to be a rule language. &lt;a href="http://spinrdf.org/"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;SPIN&lt;/span&gt;&lt;/a&gt; is a new SPARQL-based vocabulary that we have &lt;a href="http://composing-the-semantic-web.blogspot.com/2009/01/introducing-spin-sparql-inferencing.html"&gt;recently introduced&lt;/a&gt; with &lt;a href="http://composing-the-semantic-web.blogspot.com/2008/12/topbraid-composer-30-goes-into-beta.html"&gt;TopBraid Composer 3.0 beta&lt;/a&gt;. SPIN can be used to encapsulate reusable SPARQL queries as &lt;a href="http://www.topquadrant.com/spin/spin.html#spin-templates"&gt;templates&lt;/a&gt;. These templates can then be instantiated in any RDF or OWL ontology to add inference rules and constraint checks.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Mostly as an exercise and a proof-of-concept, I have converted the &lt;a href="http://www.w3.org/TR/owl2-profiles/#Reasoning_in_OWL_2_RL_and_RDF_Graphs_using_Rules"&gt;OWL RL rules&lt;/a&gt; into SPIN templates. The SPIN library at &lt;a href="http://topbraid.org/spin/owlrl"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;http://topbraid.org/spin/owlrl&lt;/span&gt;&lt;/a&gt; now contains the complete OWL 2 RL specification in executable form, formalized in SPARQL CONSTRUCT rules.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The following screen shows the example OWL RL rule &lt;a href="http://www.w3.org/TR/owl2-profiles/#cax-eqc2"&gt;cax-eq2&lt;/a&gt; encoded as a SPIN template:&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_44lV0kDjySE/SWKg_WOwHNI/AAAAAAAAAAc/rB_1z1jGZP8/s1600-h/OWLRL-cax-eqc2.png"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 308px; height: 400px;" src="http://2.bp.blogspot.com/_44lV0kDjySE/SWKg_WOwHNI/AAAAAAAAAAc/rB_1z1jGZP8/s400/OWLRL-cax-eqc2.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5287965922646039762" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_44lV0kDjySE/SWKg_WOwHNI/AAAAAAAAAAc/rB_1z1jGZP8/s1600-h/OWLRL-cax-eqc2.png"&gt;&lt;br /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The example above implements the rule that if c1 has been declared to be owl:equivalentClass of c2 and x is an instance of c2, then x is also an instance of c1. In order to activate this type of inferencing in your model, you just need to instantiate this template as a spin:rule at owl:Thing. Or simply import the file &lt;a href="http://topbraid.org/spin/owlrl-all"&gt;http://topbraid.org/spin/owlrl-all&lt;/a&gt;, which activates all rules for all instances of owl:Thing.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;This mechanism can not only be used to fine-tune the inferences for a specific model, but also to enhance the expressivity of other inference engines. TopBraid Composer allows users to combine inference engines, e.g. to run SPARQL rules on top of Jena inferencing. By activating a couple of rules from the OWL RL library, you can use some new OWL 2 keywords such as owl:key or owl:propertyChain in your model. And you can do all this yourself - just write your own SPIN rules to implement your own domain-specific modeling language and then share them with the others on the Semantic Web!&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Note: the OWL RL SPIN library above is basically untested but I would appreciate bug reports or other suggestions on how to improve it. The conversion of most rules was straight-forward, but there were a handful of rules that were tricky to convert to SPARQL, especially those with "for-all" semantics. In one case (owl:key) I had to introduce a user-defined SPIN function to negate a list traversal. In some other cases I had to rely on built-in Jena functions such as list:member. For property chains, I only implemented chains with the length of two, e.g. the infamous "uncle" relationship. However, other lengths can easily be added if they ever become relevant in practice.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The following example uses the OWL RL property chain rule to infer the uncle relationship between two instances. The source code of the corresponding OWL file (in N3 is below, updated for the latest OWL 2 version from June 11, 2009).&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_44lV0kDjySE/SWKlMvnpJhI/AAAAAAAAAAs/sgQfpNfdmPw/s1600-h/OWLRL-Inferences.png"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 125px;" src="http://4.bp.blogspot.com/_44lV0kDjySE/SWKlMvnpJhI/AAAAAAAAAAs/sgQfpNfdmPw/s400/OWLRL-Inferences.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5287970550846137874" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;pre&gt;&lt;br /&gt;@prefix spin:    &amp;lt;http://spinrdf.org/spin#&amp;gt; .&lt;br /&gt;@prefix xsd:     &amp;lt;http://www.w3.org/2001/xmlschema#&amp;gt; .&lt;br /&gt;@prefix owlrl:   &amp;lt;http://topbraid.org/spin/owlrl#&amp;gt; .&lt;br /&gt;@prefix rdfs:    &amp;lt;http://www.w3.org/2000/01/rdf-schema#&amp;gt; .&lt;br /&gt;@prefix rdf:     &amp;lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&amp;gt; .&lt;br /&gt;@prefix owl:     &amp;lt;http://www.w3.org/2002/07/owl#&amp;gt; .&lt;br /&gt;@prefix :        &amp;lt;http://topbraid.org/spin/owlrl-test#&amp;gt; .&lt;br /&gt;&lt;br /&gt;&amp;lt;http://topbraid.org/spin/owlrl-test&amp;gt;&lt;br /&gt; a       owl:Ontology ;&lt;br /&gt; owl:imports &lt;http://topbraid.org/spin/owlrl&gt; ;&lt;br /&gt; owl:versionInfo "Created with TopBraid Composer"^^xsd:string .&lt;br /&gt;&lt;br /&gt;# Instantiate SPIN template with property chain semantics&lt;br /&gt;owl:Thing&lt;br /&gt; spin:rule&lt;br /&gt;         [ a       owlrl:prp-spo2-2&lt;br /&gt;         ] .&lt;br /&gt;&lt;br /&gt;:Person&lt;br /&gt; a       owl:Class ;&lt;br /&gt; rdfs:subClassOf owl:Thing .&lt;br /&gt;&lt;br /&gt;:Darwin&lt;br /&gt; a       :Person ;&lt;br /&gt; :parent :Holger .&lt;br /&gt;&lt;br /&gt;:Holger&lt;br /&gt; a       :Person ;&lt;br /&gt; :brother :Thorsten .&lt;br /&gt;&lt;br /&gt;:Thorsten&lt;br /&gt; a       :Person .&lt;br /&gt;&lt;br /&gt;:brother&lt;br /&gt; a       owl:ObjectProperty .&lt;br /&gt;&lt;br /&gt;:parent&lt;br /&gt; a       owl:ObjectProperty .&lt;br /&gt;&lt;br /&gt;:uncle&lt;br /&gt; a       owl:ObjectProperty ;&lt;br /&gt; owl:propertyChainAxiom (:parent :brother) .&lt;br /&gt;&lt;br /&gt;# defines the new OWL 2 property if needed&lt;br /&gt;owl:propertyChainAxiom&lt;br /&gt; a       rdf:Property ;&lt;br /&gt; rdfs:label "property chain axiom"^^xsd:string ;&lt;br /&gt; rdfs:range rdf:List .&lt;br /&gt;&lt;/http://topbraid.org/spin/owlrl&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31416365-2135121302249807970?l=composing-the-semantic-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://composing-the-semantic-web.blogspot.com/feeds/2135121302249807970/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=31416365&amp;postID=2135121302249807970' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/2135121302249807970'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/2135121302249807970'/><link rel='alternate' type='text/html' href='http://composing-the-semantic-web.blogspot.com/2009/01/owl-2-rl-in-sparql-using-spin.html' title='OWL 2 RL in SPARQL using SPIN'/><author><name>Holger Knublauch</name><uri>http://www.blogger.com/profile/13180242480924209321</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://www.knublauch.com/images/platypus.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_44lV0kDjySE/SWKg_WOwHNI/AAAAAAAAAAc/rB_1z1jGZP8/s72-c/OWLRL-cax-eqc2.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-31416365.post-2145768805851095194</id><published>2009-01-02T17:09:00.000-08:00</published><updated>2009-01-02T17:49:21.606-08:00</updated><title type='text'>Video: SPARQL-based inferencing and constraint checking with SPIN</title><content type='html'>&lt;div&gt;Here is a short and sweet 3 minutes video demonstrating how to use &lt;a href="http://spinrdf.org/"&gt;SPIN&lt;/a&gt; to execute inferences and to do constraint checking on the Kennedy example ontology. The content of the video is similar to what is explained (with screenshots) on the &lt;a href="http://www.topquadrant.com/topbraid/composer/spin.html"&gt;TopBraid SPIN page&lt;/a&gt;. The example files are part of the TopBraid Composer 3.0 download, i.e. you can replay the scenario on your own machine.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;a href="http://www.topquadrant.com/topbraid/composer/videos/2009-01-02-SPIN-Kennedys.html"&gt;&lt;img border="1" src="http://4.bp.blogspot.com/_44lV0kDjySE/SV7DOqfNm1I/AAAAAAAAAAM/IHQBUXjNjT0/s320/SPINKennedyDemoVideo.png" alt="" id="BLOGGER_PHOTO_ID_5286877669270330194" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31416365-2145768805851095194?l=composing-the-semantic-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://composing-the-semantic-web.blogspot.com/feeds/2145768805851095194/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=31416365&amp;postID=2145768805851095194' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/2145768805851095194'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/2145768805851095194'/><link rel='alternate' type='text/html' href='http://composing-the-semantic-web.blogspot.com/2009/01/video-sparql-based-inferencing-and.html' title='Video: SPARQL-based inferencing and constraint checking with SPIN'/><author><name>Holger Knublauch</name><uri>http://www.blogger.com/profile/13180242480924209321</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://www.knublauch.com/images/platypus.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_44lV0kDjySE/SV7DOqfNm1I/AAAAAAAAAAM/IHQBUXjNjT0/s72-c/SPINKennedyDemoVideo.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-31416365.post-8980855500809771418</id><published>2009-01-02T09:06:00.000-08:00</published><updated>2009-01-02T11:13:31.498-08:00</updated><title type='text'>Introducing SPIN: the SPARQL Inferencing Notation</title><content type='html'>With this week's release of &lt;a href="http://composing-the-semantic-web.blogspot.com/2008/12/topbraid-composer-30-goes-into-beta.html"&gt;TopBraid Composer 3.0 beta1&lt;/a&gt;, &lt;a href="http://www.topquadrant.com/"&gt;TopQuadrant&lt;/a&gt; is adding new lego bricks to the Semantic Web stack. &lt;a href="http://spinrdf.org/"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;SPIN&lt;/span&gt;&lt;/a&gt; is a collection of RDF vocabularies enabling the use of SPARQL to define constraints and inference rules on Semantic Web models. Let me give you some (technical) background on why I believe SPIN will be useful. Future postings will elaborate on use cases and example applications.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;One of the main selling points of Semantic Web technology is the ability to publish domain models with executable semantics. Most Semantic Web models contain class and property definitions together with definitions of ranges, domains, OWL restrictions, OWL property types, SWRL rules etc. These formal definitions can be used by any tool that implements the underlying languages to operate on the model even if the tool does not have any hard-coded knowledge about the domain. So if I publish a Semantic Web model stating that all instances of Person can have string values for firstName then Semantic Web tools can build suitable input forms to collect instances. Or, if I include a rule that states that the age of a Person is the current date minus his or her birth day, then any Semantic Web tool can automatically compute the value of age just by executing the rules. Again, nothing needs to be hard-coded and the tool can dynamically discover what a given model is all about. This is also the foundation for various data integration and information discovery tasks.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;RDF and RDF Schema only provide very limited expressivity for such definitions, and it has been (intentionally) left to higher-level languages such as OWL to provide richer modeling constructs. However, people quickly recognized that in practice OWL does not meet all requirements and use cases, so that additional languages like SWRL (and recently RIF) have been proposed. These are rule-based languages that contain constructs for IF-THEN conditions which infer new triples when a pre-condition is met in the current state of the model. These rule languages cover very important use cases and many practitioners find them quite natural to use.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Now let's get back to the use cases of rich Semantic Web languages. Typically, people use them for two different purposes:&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;constraint checking: test whether the model is in a consistent/expected state&lt;/li&gt;&lt;li&gt;deriving new values: compute implicit property values from what's stated in a model&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div&gt;The focus of OWL is on the latter aspect although many people seem to misunderstand its semantics or intentionally simply ignore the open-world assumption and the lack of unique name assumption to use it for constraint checking as well. But this is actually incorrect, and this misuse of OWL for these tasks indicates that other languages are required to fill in this gap.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;But the quest for good modeling languages does not have to stop at OWL or SWRL - there is another well-known language in the Semantic Web space that can be used to formalize semantics: &lt;a href="http://www.w3.org/TR/rdf-sparql-query/"&gt;SPARQL&lt;/a&gt;. SPARQL is a firmly established W3C standard query language and implemented by all major Semantic Web stores on the market. SPARQL is very expressive as it provides means to define matches against almost arbitrary RDF graph patterns in the WHERE clauses. Also, many Semantic Web practitioners are already familiar with SPARQL and various query editing tools exist. Furthermore, SPARQL seems to meet the users' expectations very well with regards to things like the open-world assumption: SPARQL queries only operate on the triples mentioned in the WHERE clause - no other implicit assumptions are used at query execution time. You get what you see.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Most people know that SPARQL has the &lt;a href="http://www.w3.org/TR/rdf-sparql-query/#select"&gt;SELECT&lt;/a&gt; query form, but there is also the extremely useful &lt;a href="http://www.w3.org/TR/rdf-sparql-query/#construct"&gt;CONSTRUCT&lt;/a&gt; keyword and the simple &lt;a href="http://www.w3.org/TR/rdf-sparql-query/#ask"&gt;ASK&lt;/a&gt; keyword. The &lt;a href="http://spinrdf.org/spin.html"&gt;SPIN Modeling Vocabulary&lt;/a&gt; makes heavy use of the latter two keywords. To simplify a bit, SPIN suggests to use&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;ASK for constraint checking, and&lt;br /&gt;&lt;/li&gt;&lt;li&gt;CONSTRUCT for deriving new values&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;So, a SPIN-based ontology is a collection of classes and properties plus ASK and CONSTRUCT queries. The question then is: how can we connect those queries to the domain models? How can we store the queries together with the model in a seamless way?&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;In previous incarnations of SPIN (when it was not called SPIN yet), TopBraid had simply stored the SPARQL queries as strings as part of the domain model. We had used a dedicated property called sparql:query that would point from any RDF resource to a SPARQL string. This approach was of course fairly weak. Relying on a purely textual representation is error-prone, for example when someone renamed a resource the change must also be made to the query string. Also, what about the namespace prefixes used in SPARQL queries.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;In order to provide a maintainable representation of SPARQL queries, &lt;a href="http://spinrdf.org/sp.html"&gt;SPIN defines an RDF vocabulary for storing SPARQL queries&lt;/a&gt;. Instead of storing an ASK query as a string, SPIN stores it as an instance of a dedicated RDF class sp:Ask etc. For example, the SPARQL query&lt;/div&gt;&lt;div&gt;&lt;pre&gt;    ASK WHERE {&lt;br /&gt;   ?this my:age ?age .&lt;br /&gt;   FILTER (?age &lt; 18) .&lt;br /&gt;  }&lt;/pre&gt;can be represented in SPIN RDF syntax in N3 format as&lt;/div&gt;&lt;div&gt;&lt;pre&gt;    [ a       sp:Ask ;&lt;br /&gt;               sp:where ([ sp:object sp:_age ;&lt;br /&gt;                           sp:predicate my:age ;&lt;br /&gt;                           sp:subject spin:_this&lt;br /&gt;                         ] [ a       sp:Filter ;&lt;br /&gt;                           sp:expression&lt;br /&gt;                                   [ sp:arg1 sp:_age ;&lt;br /&gt;                                     sp:arg2 18 ;&lt;br /&gt;                                     a sp:lt&lt;br /&gt;                                   ]&lt;br /&gt;                         ])&lt;br /&gt;             ]&lt;/pre&gt;This may remind some of you of SWRL, where Semantic Web rules are also triplified or OWL class expressions that look similarly complex in the RDF. The RDF syntax is not necessarily pretty but it's intended to be used by software, not humans. In the case of SPIN, editing tools like TopBraid display these constructs in human-readable SPARQL syntax on the screen. Furthermore, there is a &lt;a href="http://sparqlpedia.org/spinrdfconverter.html"&gt;free public web service&lt;/a&gt; for converting between the two SPARQL syntaxes.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;But the main achievement here is that we are now able to store SPARQL expressions as part of our Semantic Web models, and use SPARQL's rich expressivity to describe the concepts from our domain. The next question is: where do we put those SPARQL expressions? In SWRL, the inference rules have global scope that are simply placed anywhere in the model (as instances of swrl:Imp). In OWL, a frame-based approach is used where logical descriptions are attached to classes using rdfs:subClassOf or owl:equivalentClass. The latter has the advantage of providing some context and scope to the rules, i.e. the ontology designer consciously attaches the pieces of domain knowledge to the classes or properties where they belong to. Inheritance similar to that from object-oriented modeling is used to re-use and specialize those definitions.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;SPIN supports both approaches, i.e. rules and constraints can be either global or scoped in the context of a given class. The recommended approach is to attach SPIN declarations to classes, following object-oriented design. Similar to object-oriented languages like Java, there is a special variable called ?this which refers to the current instance. For example, assume you attach a rule that computes the age of a person from its birth day to the class my:Person. If my:Parent is a subclass of my:Person, then the rule will also be applied to all instances of my:Parent. At execution time, the variable ?this will be bound to the current instance (of either my:Person or my:Parent). Global rules are simply attached to the root classes rdfs:Resource or owl:Thing and do not mention ?this.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The result of this mechanism is that SPIN users can exploit the whole range of SPARQL features to make their domain models executable, even on the scale of the Semantic Web. The following postings will provide some examples on how to use SPIN as a rule and constraint language. To summarize where we are so far, SPIN is a very light-weight mechanism that leverages SPARQL for new application areas that go far beyond querying. But there are additional capabilities in SPIN, for user-defined functions and query templates which I will introduce in future postings as well. Please stay tuned...&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31416365-8980855500809771418?l=composing-the-semantic-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://composing-the-semantic-web.blogspot.com/feeds/8980855500809771418/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=31416365&amp;postID=8980855500809771418' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/8980855500809771418'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/8980855500809771418'/><link rel='alternate' type='text/html' href='http://composing-the-semantic-web.blogspot.com/2009/01/introducing-spin-sparql-inferencing.html' title='Introducing SPIN: the SPARQL Inferencing Notation'/><author><name>Holger Knublauch</name><uri>http://www.blogger.com/profile/13180242480924209321</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://www.knublauch.com/images/platypus.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-31416365.post-8301755020277300345</id><published>2008-12-31T13:57:00.000-08:00</published><updated>2008-12-31T14:42:54.648-08:00</updated><title type='text'>TopBraid Composer 3.0 goes into beta</title><content type='html'>While this blog has been dormant for a couple of months, we have not been idle! This final day of the year marks the first beta release of &lt;a href="http://www.topquadrant.com/topbraid/composer/tbc-3.0.0.html"&gt;TopBraid Composer 3.0&lt;/a&gt;. This release comes packed with numerous new capabilities and improvements or bug fixes to existing features.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;One of the reasons for the long delay between the releases (2.6.2 came out in August 2008) is the fact that we have reorganized the development team. We have hired some more developers and in order to give each of the products of the TopBraid Suite sufficient attention, I am now sharing the team leadership with Jeremy Carroll. Jeremy, who is well-known as one of the original creators of HP Lab's Jena API, is spearheading a major redesign of our &lt;a href="http://www.topquadrant.com/topbraid/live"&gt;TopBraid Live&lt;/a&gt; platform and TopBraid Ensemble, and the outcome of these changes will be particularly visible in the second beta of TBC. Another side effect of having Jeremy on board is that I can focus on creating new features again.&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;One of the major new features in 3.0 is support for the &lt;a href="http://spinrdf.org"&gt;SPARQL Inferencing Notation (SPIN)&lt;/a&gt;. We have been working on SPIN for many months now and it is already in routine use in several of our own projects. The beta release is the first opportunity for me to expose this to the public. In my on humble opinion, SPIN is a potentially very significant addition to the Semantic Web stack. I will write more about it in follow-up blog entries in the next couple of days.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The work on SPIN also allowed me to revisit the core of the &lt;a href="http://sparqlmotion.org"&gt;SPARQLMotion&lt;/a&gt; engine, and numerous improvements have been included, in particular for the development of Web Services using SPARQLMotion. It's now easier than ever to build complete web applications using SPARQLMotion. TopQuadrant's new online service &lt;a href="http://sparqlpedia.org"&gt;SPARQLpedia&lt;/a&gt; is an example application that is hosted on a public TopBraid Live server that uses SPARQLMotion scripts to manage a repository of SPARQL queries on a Sesame database. I will write more about this in the next few days as well.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;There are many other changes and new features in the TopBraid Composer 3.0 beta. Please download it and let us know what you think!&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31416365-8301755020277300345?l=composing-the-semantic-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://composing-the-semantic-web.blogspot.com/feeds/8301755020277300345/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=31416365&amp;postID=8301755020277300345' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/8301755020277300345'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/8301755020277300345'/><link rel='alternate' type='text/html' href='http://composing-the-semantic-web.blogspot.com/2008/12/topbraid-composer-30-goes-into-beta.html' title='TopBraid Composer 3.0 goes into beta'/><author><name>Holger Knublauch</name><uri>http://www.blogger.com/profile/13180242480924209321</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://www.knublauch.com/images/platypus.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-31416365.post-1700538985185845256</id><published>2008-06-27T09:22:00.000-07:00</published><updated>2008-06-27T11:18:35.881-07:00</updated><title type='text'>SPARQL Functions in Motion</title><content type='html'>SPARQL is well established as the standard query language for the Semantic Web. Comparable to SQL, SPARQL provides the SELECT keyword to extract information out of an RDF/OWL repository. SPARQL also provides the CONSTRUCT keyword to construct new triples from existing ones, making SPARQL an attractive solution to defining ontology mappings or rule bases.&lt;br /&gt;&lt;br /&gt;As so often with W3C standards, the official specifications take you 80% to where you really want to be, while the remaining 20% are often non-standard extensions that make the technology really useful in real-world applications. In the case of SPARQL, many implementations already support some form of SPARQL Update Language with keywords such as INSERT and DELETE, leading to de-facto standards that will hopefully be officially folded into the standard in the next iterations. Another extremely useful extension has recently been implemented by Andy Seaborne in the Jena ARQ SPARQL engine: &lt;a href="http://seaborne.blogspot.com/2008/03/two-more-arq-extensions.html"&gt;LET Assignments&lt;/a&gt;. Here is an example derived from Andy's blog:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;SELECT ?area &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;WHERE {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;?x rdf:type :Rectangle ; &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;:height ?h ; &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;:width ?w . &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;LET (?area := ?h * ?w) .&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The LET command can be used to create new values out of existing values. The syntax of the right hand side of the assignment provides the same expressivity as FILTER expressions, which are well covered by the standard. What makes this LET command so attractive is that it greatly extends the expressiveness of SPARQL, especially when using the CONSTRUCT or INSERT keywords. We can slightly modify the example above to define a rule that automatically infers an area triple from height and width:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;CONSTRUCT {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;?x :area ?area .&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;}&lt;br /&gt;WHERE {&lt;br /&gt;?x rdf:type :Rectangle ;&lt;br /&gt;:height ?h ;&lt;br /&gt;:width ?w .&lt;br /&gt;LET (?area := ?h * ?w) .&lt;br /&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;In addition to simple arithmetical expressions such as above, SPARQL also defines a collection of &lt;a href="http://www.w3.org/TR/rdf-sparql-query/#SparqlOps"&gt;built-in functions&lt;/a&gt; such as bound, isBlank, lang, and str. The &lt;a href="http://jena.sourceforge.net/ARQ/library-function.html"&gt;Jena ARQ library&lt;/a&gt; adds many more, including string functions.&lt;br /&gt;&lt;br /&gt;As of version 2.6.0, our RDF/OWL development platform &lt;a href="http://www.topquadrant.com/topbraid/index.html"&gt;TopBraid Suite&lt;/a&gt;, which is based on Jena, includes support for LET assignments and greatly extends this mechanism. We have added a comprehensive library of more SPARQL Functions - the &lt;a href="http://www.topquadrant.com/sparqlmotion/smf.html"&gt;SPARQLMotion Functions&lt;/a&gt;. Among others, these functions can be used to build URIs from other names, cast values between datatypes, analyze the class structure, extract sub-strings and convert resources into human-readable names. Many more such functions will be added in future versions, in response to the use cases that we encounter in practice. TopBraid Composer provides a convenient auto-complete and context help feature to use these functions as shown in the next screenshot.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://www.topquadrant.com/topbraid/composer/images/blog/SMF-AutoComplete.png" /&gt;&lt;/center&gt;&lt;br /&gt;Java programmers can use the Jena API to add new functions if the provided functions are insufficient. TopBraid Composer users can also use &lt;a href="http://www.sparqlmotion.org/"&gt;SPARQLMotion&lt;/a&gt; to define new functions and make them available to any SPARQL query. I have recently uploaded an &lt;a href="http://www.topquadrant.com/sparqlmotion/guide/exampleUserDefinedFunction.html"&gt;example SPARQLMotion function definition&lt;/a&gt;. The following screenshot, taken from this example, shows that the new function takes some input string and extracts the text in parantheses:&lt;br /&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://www.topquadrant.com/topbraid/composer/images/blog/UserDefinedFunction.png" /&gt;&lt;/center&gt;&lt;br /&gt;Using the declarative visual scripting language SPARQLMotion, average RDF/OWL experts can custom-tailor SPARQL to their individual needs without having to work with Java.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31416365-1700538985185845256?l=composing-the-semantic-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://composing-the-semantic-web.blogspot.com/feeds/1700538985185845256/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=31416365&amp;postID=1700538985185845256' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/1700538985185845256'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/1700538985185845256'/><link rel='alternate' type='text/html' href='http://composing-the-semantic-web.blogspot.com/2008/06/sparql-functions-in-motion.html' title='SPARQL Functions in Motion'/><author><name>Holger Knublauch</name><uri>http://www.blogger.com/profile/13180242480924209321</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://www.knublauch.com/images/platypus.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-31416365.post-4102710850961769327</id><published>2008-04-14T22:42:00.000-07:00</published><updated>2009-06-29T10:45:00.229-07:00</updated><title type='text'>Linking to DBpedia with TopBraid</title><content type='html'>The semantic Web is coming. After at least a decade of preparation in its research community, the technology around RDF seems to be finally taking off. Re-branded as a web of &lt;a href="http://esw.w3.org/topic/LinkedData"&gt;linked data&lt;/a&gt;, the semantic Web is bootstrapping itself around a growing network of online databases, ontologies, SPARQL end-points, RDFa files and RDF-compliant web services.&lt;br /&gt;&lt;br /&gt;A promising central hub in this linked data network is &lt;a href="http://dbpedia.org/"&gt;DBpedia&lt;/a&gt;, an RDF repository based on &lt;a href="http://www.wikipedia.org/"&gt;Wikipedia&lt;/a&gt;. DBpedia provides machine-readable RDF data for each of the pages in Wikipedia. Each Wikipedia page is represented by a corresponding RDF resource, and these resources are associated with RDF property values to provide descriptions, images, cross-references and tons of useful background knowledge. For example, the DBpedia pages for cities (e.g., &lt;a href="http://dbpedia.org/page/Canberra"&gt;Canberra&lt;/a&gt;) contain geographical information, the number of inhabitants, population density, links to famous inhabitants and average temperatures, all in machine-processable form. While these property values may not be totally stable and reliable, they are at least a good start.&lt;br /&gt;&lt;br /&gt;However, the main benefit of DBpedia is that it provides relatively stable URIs for all relevant real-world concepts. This makes it a natural place to connect specific domain models with each other. If I publish my RDF files with links to DBpedia and you do the same, then we can automatically find cross-references and might more easily find mappings between our domain models. All I need to do is to add links such as { my:Canberra owl:sameAs dbpedia:Canberra }.&lt;br /&gt;&lt;br /&gt;In order to support linking domain models with DBpedia and to encourage our users to link their domain models into the semantic Web, &lt;a href="http://www.topquadrant.com/topbraid/composer"&gt;TopBraid Composer&lt;/a&gt; 2.5.3 contains some new features that semi-automatically suggest missing links. We have integrated a Wikipedia web service that takes a string (here, an rdfs:label or a local resource name) and tries to find a matching Wikipedia page for it. From the resulting page, TopBraid can derive the DBpedia page and display it in a Wizard as shown below. The wizard can then be used to preview and assign DBpedia links to one or more domain resources.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;center&gt;&lt;a href="http://www.topquadrant.com/topbraid/composer/images/blog/TBC-DBpedia.png"&gt;&lt;img src="http://www.topquadrant.com/topbraid/composer/images/blog/TBC-DBpedia.380.png" /&gt;&lt;/a&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;I have made a &lt;strong&gt;&lt;a href="http://www.topquadrant.com/docs/videos/DBpedia.wmv"&gt;short video&lt;/a&gt;&lt;/strong&gt; about all this.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31416365-4102710850961769327?l=composing-the-semantic-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://composing-the-semantic-web.blogspot.com/feeds/4102710850961769327/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=31416365&amp;postID=4102710850961769327' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/4102710850961769327'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/4102710850961769327'/><link rel='alternate' type='text/html' href='http://composing-the-semantic-web.blogspot.com/2008/04/linking-to-dbpedia-with-topbraid.html' title='Linking to DBpedia with TopBraid'/><author><name>Holger Knublauch</name><uri>http://www.blogger.com/profile/13180242480924209321</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://www.knublauch.com/images/platypus.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-31416365.post-9022639939106264314</id><published>2008-03-15T09:51:00.001-07:00</published><updated>2008-03-15T10:24:55.529-07:00</updated><title type='text'>Extending your tools with SPARQLMotion</title><content type='html'>A few days ago I wrote about &lt;a href="http://composing-the-semantic-web.blogspot.com/2008/03/creating-web-services-with-sparqlmotion.html"&gt;how to create Web Services with SPARQLMotion&lt;/a&gt;. The basic idea is that SPARQLMotion scripts can take parameters as external input and then process these parameters in SPARQL queries etc. With today's release of &lt;a href="http://www.topquadrant.com/topbraid/composer/tbc-2.5.2.html"&gt;TopBraid Composer Maestro 2.5.2&lt;/a&gt;, we have applied this idea to create a new mechanism that can be used to extend the tool itself.&lt;br /&gt;&lt;br /&gt;Here is an example. This simple SPARQLMotion script (&lt;a href="http://www.sparqlmotion.org/guide/scripts/SetCreatorService.sms.n3"&gt;SetCreatorService.sms.n3&lt;/a&gt;) takes the currently selected resource as input and adds the triple ?resource dc:creator "John Doe" using a SPARQL Update language call.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://www.sparqlmotion.org/guide/images/SPARQLMotion-Example-SetCreatorService.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;From top to bottom the steps are:&lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Take the selected resource as input and bind it to the variable ?resource.&lt;/li&gt;&lt;li&gt;Run the SPARQL call INSERT { ?resource dc:creator "John Doe" }&lt;/li&gt;&lt;li&gt;Done&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;Download the script and put it into your TopBraid workspace, then open the context menu (Resource menu) of any resource. This will insert a new menu item "Set creator" to execute the script on the selected resource:&lt;br /&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://www.sparqlmotion.org/guide/images/SPARQLMotion-Example-SetCreatorService-Menu.png" /&gt;&lt;/center&gt;&lt;br /&gt;When executed, the selected resource will be edited automatically, by the SPARQLMotion script. Needless to say, more complex SPARQLMotion services could be run as well.&lt;br /&gt;&lt;br /&gt;The trick is that TopBraid is scanning your workspace for all files ending with .sms.xyz (where xyz might be n3). If these files contain a service that takes the selected resource as input (&lt;a href="http://www.topquadrant.com/sparqlmotion/lib.html#sml:BindWithSelectedResource"&gt;sml:BindWithSelectedResource&lt;/a&gt;), then TopBraid will add a menu item for the corresponding sml:ReturnXYZ module.&lt;br /&gt;&lt;br /&gt;Here is another example, that is also explained in depth on our web site (click on the image for details).&lt;br /&gt;&lt;br /&gt;&lt;center&gt;&lt;a href="http://www.topquadrant.com/sparqlmotion/guide/exampleSendEmailService.html"&gt;&lt;img src="http://www.sparqlmotion.org/guide/images/SPARQLMotion-Example-SendEmailService.380.png" /&gt;&lt;/a&gt;&lt;/center&gt;&lt;br /&gt;This service can actually be used to send an email from TopBraid Composer. It demonstrates that these services can also be supplied with a pre-condition, so that the menu item only shows up for certain resources. This is implemented by means of an ASK query in the sml:BindWithSelectedResource module.&lt;br /&gt;&lt;br /&gt;It is easy to see that this feature is potentially yet another disruptive move in the direction of model-driven applications. SPARQLMotion can be used to extend the TopBraid Composer tool itself to provide convenient short-cuts to frequently needed activities. Instead of having to rely on your IT department to write plug-ins in a programming language like Java, users of the tool can now do such things themselves. No more need to learn complex APIs, fiddle with the extension mechanisms, just plain modeling. The tricky parts of connecting the dots are already solved by the SPARQLMotion engine.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31416365-9022639939106264314?l=composing-the-semantic-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://composing-the-semantic-web.blogspot.com/feeds/9022639939106264314/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=31416365&amp;postID=9022639939106264314' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/9022639939106264314'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/9022639939106264314'/><link rel='alternate' type='text/html' href='http://composing-the-semantic-web.blogspot.com/2008/03/extending-your-tools-with-sparqlmotion.html' title='Extending your tools with SPARQLMotion'/><author><name>Holger Knublauch</name><uri>http://www.blogger.com/profile/13180242480924209321</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://www.knublauch.com/images/platypus.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-31416365.post-6778565008166864578</id><published>2008-03-11T21:17:00.000-07:00</published><updated>2008-03-11T22:01:56.391-07:00</updated><title type='text'>Creating Web Services with SPARQLMotion</title><content type='html'>A week ago we have officially launched &lt;a href="http://www.sparqlmotion.org/"&gt;SPARQLMotion&lt;/a&gt; 1.0 as part of the latest TopBraid Suite release. SPARQLMotion is a visual scripting language based on Semantic Web standards. The language is particularly useful to automate all kinds of data integration tasks because SPARQLMotion has built-in facilities to merge, map and transform data from various sources and formats. Furthermore, being a visual language, little programming skills beyond SPARQL are required to use SPARQLMotion and its tools.&lt;br /&gt;&lt;br /&gt;One of the new features of SPARQLMotion 1.0 is that it can be used to create customized Web Services. TopBraid users can visually define REST-style web services and execute them within &lt;a href="http://www.topquadrant.com/topbraid/composer/tbc-me.html"&gt;Maestro&lt;/a&gt; or the &lt;a href="http://www.topquadrant.com/topbraid/live"&gt;TopBraid Live&lt;/a&gt; server. I am describing a small &lt;a href="http://www.topquadrant.com/sparqlmotion/guide/exampleDBPediaCallingCodes.html"&gt;example SPARQLMotion web service&lt;/a&gt; on our web page, but here is a screenshot of the script for your convenience.&lt;br /&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://www.topquadrant.com/sparqlmotion/guide/images/SPARQLMotion-Example-DBPediaCallingCodes.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;This small SPARQLMotion script takes a calling code such as "61" as input, sends it in a SELECT query to the &lt;a href="http://dbpedia.org/"&gt;DBPedia&lt;/a&gt; &lt;a href="http://dbpedia.org/sparql"&gt;SPARQL end point&lt;/a&gt;, and then sends a string response such as "61 is the calling code of Australia." back to the client. (Thanks to &lt;a href="http://blogs.sun.com/bblfish/entry/sparqling_calling_codes"&gt;Henry Story&lt;/a&gt; for a variation of this scenario!)&lt;br /&gt;&lt;br /&gt;This particular example only highlights one aspect of the possibilities of SPARQLMotion, namely the ability to create wrappers of arbitrary SPARQL calls. However, imagine that you can also define any sequence of processing steps in the middle (between the green start and the red end module). You could mash up data from multiple newsfeeds, databases, spreadsheets or XML sources, include data from external web services, construct new triples, define iterations and if-then-else branches, apply inference engines, send emails, construct complex web pages using JSPs or other templates, etc. With SPARQLMotion, defining useful Web Services becomes a matter of drag and drop - at least that's our goal at TopQuadrant.&lt;br /&gt;&lt;br /&gt;There are many other SPARQLMotion improvements in the latest TopBraid Composer release, and we are incrementally adding examples and documentation - finally also including a &lt;a href="http://www.topquadrant.com/sparqlmotion/guide/"&gt;user's guide&lt;/a&gt;. The tool now also provides a visual script debugger. Realistically there are still some rough edges that demand for improvements, but there are also quite a lot of opportunities to discover in this new semantic programming paradigm. Just make a mark and see where it takes you.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31416365-6778565008166864578?l=composing-the-semantic-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://composing-the-semantic-web.blogspot.com/feeds/6778565008166864578/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=31416365&amp;postID=6778565008166864578' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/6778565008166864578'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/6778565008166864578'/><link rel='alternate' type='text/html' href='http://composing-the-semantic-web.blogspot.com/2008/03/creating-web-services-with-sparqlmotion.html' title='Creating Web Services with SPARQLMotion'/><author><name>Holger Knublauch</name><uri>http://www.blogger.com/profile/13180242480924209321</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://www.knublauch.com/images/platypus.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-31416365.post-8106702201312608471</id><published>2008-03-03T12:15:00.000-08:00</published><updated>2008-03-06T08:45:04.861-08:00</updated><title type='text'>Editing Oracle 11g RDF Rules in TopBraid</title><content type='html'>Oracle has been supporting native RDF/OWL support since version 10g of their database. Now in its second release as &lt;a href="http://www.oracle.com/technology/tech/semantic_technologies/index.html"&gt;11g&lt;/a&gt;, Oracle has become a very serious option for projects that operate on large amounts of data. Many of our own customers already have Oracle installed in their enterprise and trust the infrastructure that Oracle provides. However, Oracle does not yet offer complete solutions that would also involve ontology editors, rule editors, semantic data browsers, semantic information integration tools, etc. This is where &lt;a href="http://www.topquadrant.com/topbraid"&gt;TopBraid Suite&lt;/a&gt; is well established, so that using TopBraid on top of Oracle is an attractive option. In fact, in the last couple of months, the majority of our customers has explicitly asked for this combination.&lt;br /&gt;&lt;br /&gt;In response to this increasing interest in using Oracle in conjunction with TopBraid, we have added some native Oracle capabilities to our platform, based on the &lt;a href="http://www.oracle.com/technology/software/tech/semantic_technologies/index.html"&gt;Oracle Jena API&lt;/a&gt; for the connection. In particular, &lt;a href="http://www.topquadrant.com/topbraid/composer"&gt;TopBraid Composer&lt;/a&gt; 2.5.1 includes a feature to edit user-defined native Oracle rules, and to run server-side inferences. The following screenshot shows TopBraid's basic Oracle rules editor.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://www.topquadrant.com/topbraid/composer/images/blog/OracleRuleDialog.png" /&gt;&lt;/center&gt;&lt;br /&gt;With this rule editing support, TopBraid users can select one or more user-defined rule bases and also combine them with the pre-defined Oracle rule sets RDFS, RDFS++, OWLSIF and OWLPRIME. The rule language supported by Oracle includes triple patterns. This is enough for the most common needs like the infamous "uncle" relationship which goes beyond the expressivity of OWL.&lt;br /&gt;&lt;br /&gt;The major difference between using Oracle's native rule support and any of the other inference engines built into TopBraid is that Oracle rules are executed server-side. This makes execution significantly faster than executing them inside a TopBraid client. This is because if the rules were executed in TopBraid, then the rule engine would need to fetch lots of query results from the database, process the results and then continue with the next loop. Native Oracle avoids this communication overhead. Furthermore, Oracle rules are executed incrementally on each database commit, making it easier to maintain up-to-date inferences. There are several disadvantages though as well: TopBraid cannot distinguish inferred triples from asserted triples (at least not yet), making it for example unclear which triples can be deleted or not. A more critical limitation though is that the rules operating on Oracle would not "see" any imported triples, or triples that were inferred in other ways. This favors scenarios in which all RDF data can reside in a single Oracle model.&lt;br /&gt;&lt;br /&gt;By the way, TopBraid Composer now also has features to execute arbitrary SQL commands and SELECT queries directly on the Oracle database, displaying the results in a console together with other status reports. With these capabilities, TopBraid Composer can be used to set up and maintain Oracle databases including rule bases, so that the Oracle database can be accessed in the desired way by end-user applications (such as TopBraid Live or Ensemble). In a sense, in addition to all its other Semantic Web features, TopBraid is becoming an admin tool for Oracle RDF...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31416365-8106702201312608471?l=composing-the-semantic-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://composing-the-semantic-web.blogspot.com/feeds/8106702201312608471/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=31416365&amp;postID=8106702201312608471' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/8106702201312608471'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/8106702201312608471'/><link rel='alternate' type='text/html' href='http://composing-the-semantic-web.blogspot.com/2008/03/editing-oracle-11g-rdf-rules-in.html' title='Editing Oracle 11g RDF Rules in TopBraid'/><author><name>Holger Knublauch</name><uri>http://www.blogger.com/profile/13180242480924209321</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://www.knublauch.com/images/platypus.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-31416365.post-44841040084814225</id><published>2008-02-08T14:06:00.000-08:00</published><updated>2008-02-09T09:06:51.198-08:00</updated><title type='text'>Text Analysis with OpenCalais in TopBraid</title><content type='html'>&lt;a href="http://opencalais.com/"&gt;OpenCalais&lt;/a&gt; is an amazing Web Service that was recently made publicly available by Reuters. In a nutshell, OpenCalais takes arbitrary text or HTML documents as input and tries to extract semantic web entities from it. For example it can identify persons, companies and countries and returns them as machine-readable RDF data structures. Needless to say this extraction does not work perfectly well because understanding human languages requires (artificial) intelligence and a lot of implicit background knowledge. In any case it can create astonishing results. We ran it over the TopQuadrant &lt;a href="http://www.topquadrant.com/management.html"&gt;management web site&lt;/a&gt; and it correctly identified all five people, their respective roles as well as parts of their former companies.&lt;br /&gt;&lt;br /&gt;Such text-entity-extraction services have in the past been (very expensive) niche products. The recent announcement by Reuters (who have acquired the text mining company ClearForest last year) to make OpenCalais available for free came as a great surprise. After all, many customers of ours have requested features to import text into their ontologies in the past. Given all this, it was an obvious next step for us to include OpenCalais into TopBraid. &lt;a href="http://www.topquadrant.com/topbraid/composer"&gt;TopBraid Composer&lt;/a&gt; 2.5 now includes several features that seamlessly integrate the Calais web service into data processing tasks. For example, you can extract RDF from arbitrary HTML files from the web and save the results into files. Or you can put .txt files into your workspace and directly import them into some other RDF/OWL project - Calais will be called automatically.&lt;br /&gt;&lt;br /&gt;However, the real power of OpenCalais is exposed when used in data processing pipelines such as &lt;a href="http://www.sparqlmotion.org/"&gt;SPARQLMotion&lt;/a&gt; scripts. The following TopBraid screenshot shows a SPARQLMotion script that&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;loads the latest business news from a New York Times RSS feed&lt;/li&gt;&lt;li&gt;sends the text of the news items to OpenCalais (OpenCalais will identify all countries mentioned in the news)&lt;/li&gt;&lt;li&gt;iterates over all countries to request their geo coordinates from the geonames web service&lt;/li&gt;&lt;li&gt;displays all countries on a Google Map &lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;center&gt;&lt;a href="http://www.topquadrant.com/topbraid/composer/images/blog/Calais-SPARQLMotion-TopBraidComposer.png"&gt;&lt;img src="http://www.topquadrant.com/topbraid/composer/images/blog/Calais-SPARQLMotion-TopBraidComposer.380.png" /&gt;&lt;/a&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;This script is of course just one possibility of using information delivered by Calais. A more comprehensive solution would probably include a countries ontology that already has background information (including coordinates, capitals, financial details) about each country. Then SPARQLMotion could be used to create an intelligent agent that analyzes newsfeeds (or any other textual data source) against semantic query patterns such as "Alert me if there are any news about a company merger located in an oil-exporting country". If you want to play with all this, please download TopBraid Composer Maestro 2.5.0 but keep in mind that SPARQLMotion is work in progress and not complete (Matt Fischer recently wrote an independent &lt;a href="http://www.semanticreport.com/index.php?option=com_content&amp;amp;task=view&amp;amp;id=81&amp;amp;Itemid=1"&gt;review&lt;/a&gt; of an even older version of SPARQLMotion that illustrates some of the open issues).&lt;br /&gt;&lt;p&gt;Note that OpenCalais seems to be part of a larger &lt;a href="http://www.opencalais.com/page/roadmap"&gt;roadmap&lt;/a&gt; at Reuters aiming at making "all the world's content more accessible and valuable". It is great to see a world-leading information company embrace the Semantic Web vision so directly! As a comprehensive information integration and ontology design tool, TopBraid Composer and its SPARQLMotion language seem to be ideal platforms to process, analyze and visualize the information that OpenCalais delivers.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31416365-44841040084814225?l=composing-the-semantic-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://composing-the-semantic-web.blogspot.com/feeds/44841040084814225/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=31416365&amp;postID=44841040084814225' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/44841040084814225'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/44841040084814225'/><link rel='alternate' type='text/html' href='http://composing-the-semantic-web.blogspot.com/2008/02/text-analysis-with-opencalais-in.html' title='Text Analysis with OpenCalais in TopBraid'/><author><name>Holger Knublauch</name><uri>http://www.blogger.com/profile/13180242480924209321</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://www.knublauch.com/images/platypus.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-31416365.post-2704188148988409867</id><published>2008-02-08T10:02:00.000-08:00</published><updated>2008-02-08T11:18:57.233-08:00</updated><title type='text'>Beyond Social Networking with FOAF and TopBraid</title><content type='html'>The recent &lt;a href="http://dannyayers.com/2008/02/01/google-gets-foaf"&gt;announcement&lt;/a&gt; that Google is now systematically scanning &lt;a href="http://www.foaf-project.org/"&gt;FOAF&lt;/a&gt; files is potentially a large leap toward building the Semantic Web as a linked network of distributed data sources. FOAF files contain personal and work-related information such as name, acquaintances, publications, projects and contact information in RDF/OWL format. In contrast to most of the well-known commercial social networking services, FOAF files are maintained in a decentralized network, in which each user can publish and edit his or her own profile without being locked into any vendor's private database.&lt;br /&gt;&lt;br /&gt;I personally haven't followed the FOAF project well in the past, but Google's announcement triggered me to have a second look. While there are certainly several historical and questionable design decisions in the current FOAF ontology version, it is nevertheless a very important domain model because it is widely used. In my opinion, the best thing about FOAF is that it defines stable URIs for concepts such as Person, name, mbox and img. Even if we don't like all aspects of FOAF (e.g. the redundant and inconsistent naming of properties like surname/family_name and firstName/givenname), FOAF at least provides shared URIs that ensure that users to talk about the same things.&lt;br /&gt;&lt;br /&gt;Semantic Web technology users can reuse those shared URIs for their own purpose. For example, we can import the FOAF namespace into a project management ontology so that we can reuse and leverage the facts from FOAF files for all team members. For that purpose we may only select to use certain FOAF properties, and we are not forced to use the official specification ontology in all its details.&lt;br /&gt;&lt;br /&gt;In our case, I wanted to see how FOAF files look in &lt;a href="http://www.topquadrant.com/topbraid/composer"&gt;TopBraid Composer&lt;/a&gt;, so that I could update &lt;a href="http://www.knublauch.com/foaf.rdf"&gt;my own FOAF profile&lt;/a&gt; that was sitting neglected on the web. I did a few adjustments to the original FOAF spec so that it is less confusing to average users. In particular, I removed a couple of subclass relationships that pointed to other namespaces, removed redundant rdf:types of many properties, and removed redundant domains and ranges that would otherwise clutter up forms with unhelpful widgets. The result is an &lt;a href="http://www.topbraidcomposer.com/owl/library/foaf.owl"&gt;editor-friendly FOAF&lt;/a&gt; which has been made part of TopBraid's standard ontology library as of TopBraid Composer version 2.5.0.&lt;br /&gt;&lt;br /&gt;I also did a couple of extensions for TopBraid to better support typical usage patterns of FOAF files. In particular I added a "follow-your-nose" feature that allows users to dynamically import a namespace that is mentioned in a URI. This is needed to explore details of FOAF profiles that are linked via the foaf:knows property. I also added imaging support to the graph editor so that from now on any value of foaf:depiction (and its sub-properties) will be rendered as images. See the TopBraid Composer 2.5 screenshot below.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;center&gt;&lt;a href="http://www.topquadrant.com/topbraid/composer/images/blog/TopBraid-FOAF.png"&gt;&lt;img src="http://www.topquadrant.com/topbraid/composer/images/blog/TopBraid-FOAF.380.png" /&gt;&lt;/a&gt;&lt;/center&gt;&lt;br /&gt;So in principle you can now use TopBraid to edit your personal profile. This of course isn't cool by itself, but your personal profile alone isn't cool by itself either. The added value is that TopBraid (or similar ontology editors) are generic and this means you can use the full range of components like graphs, forms, maps and query builders as well as the various inference and data processing engines (e.g. &lt;a href="http://www.sparqlmotion.org/"&gt;SPARQLMotion&lt;/a&gt;) on your model. Even more importantly, you can make FOAF models part of other domain models and do things that cross the borders of what could be done with a traditional social networking service. For example, I could link my FOAF profile with a music ontology that contains background knowledge about the style of music that I prefer to listen to.&lt;br /&gt;&lt;br /&gt;If Google would notice that a growing number of FOAF files out there also reference related namespaces, then it may want to scan those other namespaces as well. Google may soon find out that instead of maintaining a dedicated internal social networking data structure and providing a specific social networking web service, it will be easier for them to store the original data in a flexible and self-describing format such as RDF/OWL and simply publish a SPARQL endpoint to their API users. FOAF files could therefore be the start of a long friendship...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31416365-2704188148988409867?l=composing-the-semantic-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://composing-the-semantic-web.blogspot.com/feeds/2704188148988409867/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=31416365&amp;postID=2704188148988409867' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/2704188148988409867'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/2704188148988409867'/><link rel='alternate' type='text/html' href='http://composing-the-semantic-web.blogspot.com/2008/02/beyond-social-networking-with-foaf-and.html' title='Beyond Social Networking with FOAF and TopBraid'/><author><name>Holger Knublauch</name><uri>http://www.blogger.com/profile/13180242480924209321</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://www.knublauch.com/images/platypus.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-31416365.post-3837121961424113160</id><published>2007-11-15T10:55:00.000-08:00</published><updated>2007-11-16T12:38:37.372-08:00</updated><title type='text'>SparqlMotion: A visual semantic web scripting language</title><content type='html'>The open architecture of semantic web languages like RDF, OWL and SPARQL make them an excellent choice for data integration problems, aka mash-ups. Semantic technology tools can be used to bring together heterogeneous data sources, to post-process and filter them, and to query the resulting aggregated data models. One of those tools, &lt;a href="http://www.topbraidcomposer.com/"&gt;TopBraid Composer&lt;/a&gt;, provides import capabilities for legacy data in XML, UML, relational databases, spreadsheets, news feeds, HTML pages etc. Users can edit ontologies to bridge the various data items, and run inference or query engines to get information out. However, going through these steps is typically a manual process that needs to be repeated for each new data source.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.sparqlmotion.org/"&gt;&lt;strong&gt;SparqlMotion&lt;/strong&gt;&lt;/a&gt; is a new visual language that enables average users to define scripts to import, post-process, query and visualize data using semantic web technology. Users can define and share those scripts as OWL models, based on a dedicated &lt;a href="http://topbraid.org/sparqlmotion"&gt;SparqlMotion ontology&lt;/a&gt; and &lt;a href="http://topbraid.org/sparqlmotionlib"&gt;module library&lt;/a&gt;. The graph editor of Composer's Maestro Edition (or any other OWL editor) can be used to define the data and execution flow of these scripts using drag and drop:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;center&gt;&lt;a href="http://www.topbraidcomposer.com/videos/tutorials/sparqlmotion/2007-11-14-SparqlMotion.wmv"&gt;&lt;img src="http://www.topbraidcomposer.com/images/SparqlMotion-SimpleScript.png" /&gt;&lt;/a&gt;&lt;/center&gt;&lt;div align="left"&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Here is a &lt;strong&gt;&lt;a href="http://www.topbraidcomposer.com/videos/tutorials/sparqlmotion/2007-11-14-SparqlMotion.wmv"&gt;screencam video&lt;/a&gt;&lt;/strong&gt; (15 minutes) that shows how to create the above SparqlMotion script with TopBraid Composer. Here is the &lt;a href="http://www.topbraidcomposer.com/examples/sparqlmotion/newsfeedDemo.n3"&gt;example script in N3&lt;/a&gt; notation. The script loads data from a news feed, post-processes the resulting triples, ask the user to enter a keyword, and then displays all events that contain the keyword in a calendar. The output of the script could also be another file, a spreadsheet, a database or a dynamic model that can be imported into other ontologies.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Each of the nodes in the above diagram represents a data processing step, which must be an instance of a SparqlMotion module class such as sml:LoadNewsFeed. The sm:next relationship specifies the information flow between two modules. For example, the resulting output of the newsfeed loader (RDF triples) is used as input for the data type conversion module below it. The latter module can process/filter the RDF input and pass it on to the next node etc. Scripts can branch their data flow and merge RDF input of multiple modules into a single node at any time.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Two information formats are currently supported: RDF and XML. We provide translation modules based on our &lt;a href="http://composing-the-semantic-web.blogspot.com/2007/11/xmap-mapping-arbitrary-xml-documents-to.html"&gt;Semantic XML algorithm&lt;/a&gt; that can convert between RDF and XML at any time. In addition to these formats, modules can bind variables. For example, a user input module such as "Enter keyword" above can prompt the user to enter a string and then pass that string literal to the following modules in a variable such as "keyword". Succeeding modules can reference this variable, for example, in SPARQL queries.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;SPARQL is the central language of SparqlMotion. Many modules (such as those that display data on a calendar or a Google map) use a SPARQL query to select which resources to display. There is also an iteration module that repeats other modules for each result row of a SPARQL select clause. Finally, &lt;a href="http://composing-the-semantic-web.blogspot.com/2006/09/ontology-mapping-with-sparql-construct.html"&gt;SPARQL's CONSTRUCT&lt;/a&gt; keyword is used heavily to transform and filter RDF data.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;The SparqlMotion modules library is growing rapidly since we started using it in customer projects. We are also working on a web-based graph editor in Flex based on &lt;a href="http://composing-the-semantic-web.blogspot.com/2007/08/topbraid-live-rich-semantic-internet_31.html"&gt;TopBraid Ensemble&lt;/a&gt;'s graphing capabilities. This will remind some people of &lt;a href="http://pipes.yahoo.com/pipes/"&gt;Yahoo Pipes&lt;/a&gt;. The current version included in TopBraid Composer Maestro is rather alpha software as we better understand SparqlMotion design patterns and add support for best practices. We expect to incrementally roll out many more features over the next few months. In any case, the system is available for download if you want to give it a try. Make sure to watch the &lt;a href="http://www.topbraidcomposer.com/videos/tutorials/sparqlmotion/2007-11-14-SparqlMotion.wmv"&gt;video&lt;/a&gt; before exploring this exciting space.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31416365-3837121961424113160?l=composing-the-semantic-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://composing-the-semantic-web.blogspot.com/feeds/3837121961424113160/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=31416365&amp;postID=3837121961424113160' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/3837121961424113160'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/3837121961424113160'/><link rel='alternate' type='text/html' href='http://composing-the-semantic-web.blogspot.com/2007/11/sparqlmotion-visual-semantic-web.html' title='SparqlMotion: A visual semantic web scripting language'/><author><name>Holger Knublauch</name><uri>http://www.blogger.com/profile/13180242480924209321</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://www.knublauch.com/images/platypus.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-31416365.post-2749708119747900927</id><published>2007-11-14T16:51:00.000-08:00</published><updated>2007-11-14T17:28:49.219-08:00</updated><title type='text'>Creating documents with SPARQL and JSP</title><content type='html'>My co-workers at TopQuadrant recently had a deadline to create some deliverables for a large customer project (for a national space agency :) ). A large fraction of the work in this project is actually ontology design, and the deliverables were Word documents that described and explained these ontologies. Tired of endless hours of manual work, my manager wished he had a "generate-document-from-ontology" button.&lt;br /&gt;&lt;br /&gt;On that same day we implemented a prototypical document generator that allows users to embed SPARQL queries into HTML templates, and then let the system insert the resulting variable bindings into certain spots in the templates. The basic idea is that certain blocks of text (such as a row in an HTML table) are repeated for each result row of the SPARQL query. Furthermore, loops over SPARQL queries can be nested so that you can reference variables from the outside in an inner loop.&lt;br /&gt;&lt;br /&gt;This turned out to be a really useful feature, so I generalized this to a new tool feature based on a generic document generation framework, Java Server Pages (JSP). Since I had never implemented anything on top of JSP, I did a quick search on the web, revealing &lt;a href="http://djpowell.net/sparqltag/"&gt;David Powell's SPARQL JSP taglib&lt;/a&gt;. This small but fine open-source project turned out to be a very helpful starting point for the implementation of TopBraid Composer's new document generation facility. Since &lt;a href="http://www.topbraidcomposer.com/tbc-me.html"&gt;TBC's Maestro Edition&lt;/a&gt; comes with its own integrated Java web server, we can now execute Java Server Pages within the development tool.&lt;br /&gt;&lt;br /&gt;In a nutshell, this feature can be used to create arbitrary text documents (such as HTML or XML files) from the RDF model that is currently open in Composer. The user selects a JSP page (which can be edited with Eclipse/TBC or tools such as DreamWeaver) and then the output file. The system compiles the JSP page internally into a Servlet and then runs it, writing the result into a new file in the Eclipse workspace. With the &lt;a href="http://composing-the-semantic-web.blogspot.com/2007/08/topbraid-live-rich-semantic-internet_31.html"&gt;TopBraid Live&lt;/a&gt; server, these pages can also be put online to produce dynamic web pages.&lt;br /&gt;&lt;br /&gt;Here is an &lt;a href="http://www.topbraidcomposer.com/examples/jsp/SparqlMotionDocTemplate.jsp.txt"&gt;example JSP document&lt;/a&gt; with embedded SPARQL code. When executed over &lt;a href="http://topbraid.org/sparqlmotionlib"&gt;this ontology&lt;/a&gt;, you get &lt;a href="http://www.topbraidcomposer.com/examples/jsp/SparqlMotionDocOutput.html"&gt;this output&lt;/a&gt;. &lt;c:foreach var="classRow" items="${classes.rows}"&gt;&lt;sparql:label resource="${classRow.cls}"&gt;&lt;br /&gt;&lt;/sparql:label&gt;&lt;/c:foreach&gt;&lt;?xml:namespace prefix = c /&gt;&lt;c:foreach var="classRow" items="${classes.rows}"&gt;&lt;?xml:namespace prefix = sparql /&gt;&lt;sparql:label resource="${classRow.cls}"&gt;&lt;/sparql:label&gt;&lt;/c:foreach&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31416365-2749708119747900927?l=composing-the-semantic-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://composing-the-semantic-web.blogspot.com/feeds/2749708119747900927/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=31416365&amp;postID=2749708119747900927' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/2749708119747900927'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/2749708119747900927'/><link rel='alternate' type='text/html' href='http://composing-the-semantic-web.blogspot.com/2007/11/creating-documents-with-sparql-and-jsp.html' title='Creating documents with SPARQL and JSP'/><author><name>Holger Knublauch</name><uri>http://www.blogger.com/profile/13180242480924209321</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://www.knublauch.com/images/platypus.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-31416365.post-6552099730703067209</id><published>2007-11-12T12:23:00.000-08:00</published><updated>2007-11-14T08:54:30.880-08:00</updated><title type='text'>BIRT: Creating SPARQL-based charts and reports</title><content type='html'>Being based on the &lt;a href="http://www.eclipse.org/"&gt;Eclipse&lt;/a&gt; platform, &lt;a href="http://www.topbraidcomposer.com/"&gt;TopBraid Composer&lt;/a&gt; can seamlessly integrate with other Eclipse-based tools and services. One of the most complex Eclipse plug-ins is &lt;a href="http://www.eclipse.org/birt/phoenix/"&gt;BIRT&lt;/a&gt;, an open source Eclipse-based reporting system that can be used to generate charts and other reports from input data. BIRT is typically used to take its input from relational databases or spreadsheets, but it provides an open architecture that allows programmers to plug in arbitrary tabular data sources.&lt;br /&gt;&lt;br /&gt;A simple way of generating tabular data from an OWL/RDF data model is via &lt;a href="http://www.w3.org/TR/rdf-sparql-query/"&gt;SPARQL&lt;/a&gt; Select queries, which deliver result sets in rows with one or multiple columns. TopBraid Composer's &lt;a href="http://www.topbraidcomposer.com/tbc-me.html"&gt;Maestro Edition&lt;/a&gt; now provides a powerful interface between any OWL/RDF data source and BIRT. The following screenshot illustrates the kind of output that BIRT can create.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://www.topbraidcomposer.com/images/BIRTMissionsGeneral.380.png" /&gt;&lt;/center&gt;&lt;div align="left"&gt;&lt;/div&gt;&lt;div align="left"&gt; &lt;/div&gt;&lt;div align="left"&gt;Details on how to use BIRT are available in TopBraid's help pages. I also made a quick &lt;strong&gt;&lt;a href="http://www.topbraidcomposer.com/videos/tutorials/birt/2007-11-12-BIRT.wmv"&gt;screencam demo (3 minutes) showing BIRT&lt;/a&gt;&lt;/strong&gt;.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31416365-6552099730703067209?l=composing-the-semantic-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://composing-the-semantic-web.blogspot.com/feeds/6552099730703067209/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=31416365&amp;postID=6552099730703067209' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/6552099730703067209'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/6552099730703067209'/><link rel='alternate' type='text/html' href='http://composing-the-semantic-web.blogspot.com/2007/11/birt-creating-sparql-based-charts-and.html' title='BIRT: Creating SPARQL-based charts and reports'/><author><name>Holger Knublauch</name><uri>http://www.blogger.com/profile/13180242480924209321</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://www.knublauch.com/images/platypus.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-31416365.post-2715778288744600577</id><published>2007-11-10T13:37:00.001-08:00</published><updated>2007-11-16T12:33:32.832-08:00</updated><title type='text'>Semantic XML: Mapping arbitrary XML documents to OWL</title><content type='html'>XML is everywhere. Many XML documents contain valuable information that should be lifted into Semantic Web technology. Furthermore, we often encounter situations in which we want to generate XML output from data stored in our ontologies, for example to interoperate with external tools and web services. The new &lt;a href="http://www.topbraidcomposer.com/tbc-me.html"&gt;Maestro Edition&lt;/a&gt; of TopBraid Composer introduces a new XML-to-OWL/RDF mapping capability, called Semantic XML.&lt;br /&gt;&lt;br /&gt;I made a small screencam &lt;a href="http://www.topbraidcomposer.com/videos/tutorials/xmap/XMap-TopBraid.wmv"&gt;&lt;strong&gt;video&lt;/strong&gt;&lt;/a&gt; (10 minutes) to illustrate some of Semantic XML's capabilities. In the video I am taking an XML document, load it into TopBraid and run a SPARQL query over it. Then I am fine-tuning the generated ontology and show how other files can map into the resulting OWL model. Finally I show how to load arbitrary HTML documents into a Semantic XML-based XHTML ontology.&lt;br /&gt;&lt;br /&gt;Here is also a screenshot of what Semantic XML does (click on the image for a larger view):&lt;br /&gt;&lt;br /&gt;&lt;center&gt;&lt;a href="http://www.topbraidcomposer.com/images/XMap-Example.png"&gt;&lt;img src="http://www.topbraidcomposer.com/images/blog/XMap-Example.380.png" /&gt;&lt;/a&gt;&lt;/center&gt;&lt;center&gt;&lt;/center&gt;&lt;div align="left"&gt; &lt;/div&gt;&lt;div align="left"&gt;TopBraid can automatically generate an OWL/RDF ontology from any XML file. Each distinct XML element name is mapped into a class, and the elements themselves become instances of those classes. A datatype property is generated for each attribute. The nesting of the XML elements is stored by means of the composite:child property described in a &lt;a href="http://composing-the-semantic-web.blogspot.com/2007/07/composite-design-pattern-in-rdfowl.html"&gt;recent blog entry&lt;/a&gt;.&lt;/div&gt;&lt;div align="left"&gt; &lt;/div&gt;&lt;div align="left"&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;/div&gt;&lt;div align="left"&gt;The key idea of Semantic XML is that each of the generated OWL classes and datatype properties is annotated with an annotation property (xmap:element and xmap:attribute, resp.) that points from the OWL concept to the XML serialization. These annotations are also used if an OWL model needs to be serialized back to XML format.&lt;/div&gt;&lt;div align="left"&gt; &lt;/div&gt;&lt;div align="left"&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;/div&gt;&lt;div align="left"&gt;If you import an XML file into an ontology that already contains classes and properties with Semantic XML annotations, then the loader will reuse those. For example, we have defined an &lt;a href="http://topbraid.org/xhtml"&gt;XHTML ontology&lt;/a&gt; that is automatically loaded when a user opens an HTML file with TopBraid Composer. We plan to provide further standard mapping ontologies for other popular formats such as SVG in the near future.&lt;/div&gt;&lt;div align="left"&gt; &lt;/div&gt;&lt;div align="left"&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;/div&gt;&lt;div align="left"&gt;To summarize, TopBraid can be used to import arbitrary XML documents into OWL so that they can be queried and processed with semantic web tools. The mapping is bi-directional and lossless so that files can be loaded, manipulated and saved without losing structural information.&lt;/div&gt;&lt;div align="left"&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;/div&gt;&lt;div align="left"&gt;Note that this mapping approach is very generic, but may not provide the best possible mapping for every XML-based language. In some cases, if starting with an XML Schema file is possible, the XML Schema importer of TopBraid may be more appropriate. On the other hand, TopBraid's round-tripping capability makes it a better option when bidirectional interoperability with existing XML-based tools is needed.&lt;/div&gt;&lt;div align="left"&gt; &lt;/div&gt;&lt;div align="left"&gt;&lt;em&gt;Edited (2007-11-17): Note that earlier versions of this blog entry referred to this technology under the name xmap which is trademarked by another company, so we have changed to Semantic XML.&lt;/em&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31416365-2715778288744600577?l=composing-the-semantic-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://composing-the-semantic-web.blogspot.com/feeds/2715778288744600577/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=31416365&amp;postID=2715778288744600577' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/2715778288744600577'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/2715778288744600577'/><link rel='alternate' type='text/html' href='http://composing-the-semantic-web.blogspot.com/2007/11/xmap-mapping-arbitrary-xml-documents-to.html' title='Semantic XML: Mapping arbitrary XML documents to OWL'/><author><name>Holger Knublauch</name><uri>http://www.blogger.com/profile/13180242480924209321</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://www.knublauch.com/images/platypus.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-31416365.post-4518161655236305230</id><published>2007-11-09T16:06:00.000-08:00</published><updated>2007-11-16T12:40:43.457-08:00</updated><title type='text'>TopBraid Composer - Maestro Edition</title><content type='html'>I am thrilled to announce TopBraid Composer 2.4.0. This release features significant usability improvements (graph editing and support for multiple editors/forms for the same file), and also Oracle 11g integration. Please check our &lt;a href="http://www.topbraidcomposer.com/tbc-2.4.0.html"&gt;web page&lt;/a&gt; for a detailed list of changes.&lt;br /&gt;&lt;br /&gt;With version 2.4.0 we are also launching an extended version of TopBraid Composer, called the &lt;a href="http://www.topbraidcomposer.com/tbc-me.html"&gt;Maestro Edition&lt;/a&gt;. Maestro includes all features of Standard TBC, but also comes with many new and extremely powerful capabilities that are not present in the Standard Edition. A detailed list of new features of Maestro is available online, but here is a summary:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;A built-in TopBraid Live test server for rapid application development.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Support for document generation with &lt;a href="http://composing-the-semantic-web.blogspot.com/2007/11/creating-documents-with-sparql-and-jsp.html"&gt;semantic Java Server Pages&lt;/a&gt;.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.sparqlmotion.org/"&gt;SparqlMotion&lt;/a&gt;: A new visual semantic web scripting language comparable with Yahoo Pipes.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://composing-the-semantic-web.blogspot.com/2007/11/xmap-mapping-arbitrary-xml-documents-to.html"&gt;Semantic XML&lt;/a&gt;: A new technology to import arbitrary XML files, and to query, edit and export them back to XML.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://composing-the-semantic-web.blogspot.com/2007/11/birt-creating-sparql-based-charts-and.html"&gt;BIRT&lt;/a&gt;: A SPARQL-based visual report generation and charting tool kit.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;EMail import to OWL for semantic analysis of emails. &lt;/li&gt;&lt;/ul&gt;&lt;p&gt;I will write more about all those capabilities in the next few days. Stay tuned!&lt;/p&gt;&lt;p&gt;The Maestro Edition is available for &lt;a href="http://www.topbraidcomposer.com/"&gt;download now&lt;/a&gt; and we have reset the evaluation period so that all users can get a fresh view on the tool.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31416365-4518161655236305230?l=composing-the-semantic-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://composing-the-semantic-web.blogspot.com/feeds/4518161655236305230/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=31416365&amp;postID=4518161655236305230' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/4518161655236305230'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/4518161655236305230'/><link rel='alternate' type='text/html' href='http://composing-the-semantic-web.blogspot.com/2007/11/topbraid-composer-maestro-edition.html' title='TopBraid Composer - Maestro Edition'/><author><name>Holger Knublauch</name><uri>http://www.blogger.com/profile/13180242480924209321</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://www.knublauch.com/images/platypus.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-31416365.post-378745171106190375</id><published>2007-09-18T20:06:00.000-07:00</published><updated>2007-09-18T21:47:22.408-07:00</updated><title type='text'>TopBraid now supports the OWLIM Inference Engine</title><content type='html'>I am pleased to announce that &lt;a href="http://www.topbraidcomposer.com/"&gt;TopBraid Composer&lt;/a&gt; &lt;a href="http://www.topbraidcomposer.com/tbc-2.3.0.html"&gt;2.3&lt;/a&gt; now comes bundled with a new inference engine: &lt;a href="http://www.ontotext.com/owlim/"&gt;SwiftOWLIM&lt;/a&gt; is a rule-based high-performance reasoner for RDFS and (partial) OWL semantics. OWLIM has been implemented by &lt;a href="http://www.ontotext.com/"&gt;OntoText&lt;/a&gt; and uses the Sesame API as its main interface. It is an attractive foundation both for smaller projects (SwiftOWLIM is a free open-source engine) and for professional use (OntoText offers BigOWLIM, scaling to billions of triples).&lt;br /&gt;&lt;br /&gt;In Composer, OWLIM can be configured to run in three modes (OWL-max, OWL Horst and RDFS), depending on what type of expressivity you need for your application. Our initial tests with OWLIM indicate that OWLIM may become a serious alternative to the better-known engines such as Pellet and Jena. My colleague &lt;a href="http://dallemang.typepad.com/"&gt;Dean Allemang&lt;/a&gt; is using OWLIM to classify ontologies that contain tons of individuals. His models are essentially impossible to handle with Pellet which uses a different reasoning algorithm that is geared for complete OWL DL semantics.&lt;br /&gt;&lt;br /&gt;While Composer 2.3 is the first release with OWLIM support, we anticipate that several improvements will be folded into the coming releases. For example we could expose OWLIM's own rule language similar to the Jena rules interface.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31416365-378745171106190375?l=composing-the-semantic-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://composing-the-semantic-web.blogspot.com/feeds/378745171106190375/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=31416365&amp;postID=378745171106190375' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/378745171106190375'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/378745171106190375'/><link rel='alternate' type='text/html' href='http://composing-the-semantic-web.blogspot.com/2007/09/topbraid-now-supports-owlim-inference.html' title='TopBraid now supports the OWLIM Inference Engine'/><author><name>Holger Knublauch</name><uri>http://www.blogger.com/profile/13180242480924209321</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://www.knublauch.com/images/platypus.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-31416365.post-9121690038551050204</id><published>2007-08-31T17:31:00.000-07:00</published><updated>2007-08-31T18:14:07.919-07:00</updated><title type='text'>TopBraid Live: Rich Semantic Internet Applications with Flex</title><content type='html'>&lt;p&gt;Rich Internet Applications (RIAs) run inside web browsers and provide a much more dynamic user experience than conventional web pages. While traditional HTML-based pages require a full reload of the page when the user clicks on a link, many modern web pages only reload parts of the page and provide animations to dynamically navigate through an information space.&lt;/p&gt;&lt;p&gt;There are several platforms to implement such dynamic web pages, for example &lt;a href="http://en.wikipedia.org/wiki/Ajax_(programming)"&gt;AJAX&lt;/a&gt;, &lt;a href="http://www.adobe.com/products/flex/"&gt;Flash&lt;/a&gt;, &lt;a href="http://java.sun.com/javafx/"&gt;Java FX&lt;/a&gt;, &lt;a href="http://silverlight.net/"&gt;Microsoft Silverlight&lt;/a&gt;, &lt;a href="http://www.openlaszlo.org/"&gt;OpenLaszlo&lt;/a&gt;, &lt;a href="http://www.mozilla.org/projects/xul/"&gt;XUL&lt;/a&gt;. These platform all share a similar programming model that mixes declarative (XML) elements to describe the layout of user interfaces with some imperative scripting to define the application's behavior.&lt;/p&gt;&lt;p&gt;For our newest Semantic Web tooling platform &lt;a href="http://www.topquadrant.com/topbraidlive.html"&gt;TopBraid Live&lt;/a&gt; we had to pick one of these technologies. The goal of TopBraid Live is to serve as development platform for Rich Internet Applications based on server-side Semantic Web models. TopBraid Live provides the whole server-side infrastructure to store and query RDF/OWL data, and a comprehensive client-side API including a library of out-of-the-box components that make creating web applications easier.&lt;/p&gt;&lt;p&gt;After evaluating AJAX and OpenLaszlo for a while we have finally chosen Flash, in particular Flex 2 and ActionScript 3 as the primary foundation for the client-side API of TopBraid Live. In our experience, Flex is the best available technology that is widely deployed and comes with all the flexibility that one would expect for true Rich Internet Applications. In particular we appreciate the nice object-oriented model and strong typing that makes ActionScript 3 code as maintainable as Java or C# code - unlike JavaScript with all its browser incompatibilities and ad-hoc constructs.&lt;/p&gt;Today we are thrilled to announce the first comprehensive Semantic Web API for Flash. The TopBraid Live API provides a comparable data model to Java libraries such as Jena and Sesame. The triples and nodes in the data model are automatically synchronized with the server in a highly scalable architecture. Data is loaded as the user browses through the Semantic Web model, and triples and nodes are cached on the client, avoiding to continuously reloading everything. We provide some abstraction layers to run queries to back user interface components. Many UI widgets such as trees, tables, forms and graphical browsers come out-of-the-box as part of TopBraid Live.&lt;br /&gt;&lt;br /&gt;The screenshot below shows &lt;a href="http://www.topquadrant.com/topbraidensemble.html"&gt;TopBraid Ensemble&lt;/a&gt;, a multi-user Semantic Web browser and editor/wiki based on TopBraid Live (click on the image for a larger view).&lt;br /&gt;&lt;br /&gt;&lt;center&gt;&lt;a href="http://www.topbraidcomposer.com/images/blog/TBE-2007-08-31.png"&gt;&lt;img src="http://www.topbraidcomposer.com/images/blog/TBE-2007-08-31.380.png" /&gt;&lt;/a&gt;&lt;/center&gt;&lt;br /&gt;In order to use TopBraid Ensemble, you need a TopBraid Live server to manage your RDF/OWL data stores (in whatever format you chose). You can configure which models are visible (and editable) by which users. The users can then log in and either navigate through the model or edit parts of it. The tool also provides search capabilities and even a graphical browser.&lt;br /&gt;&lt;br /&gt;I believe that these capabilities and the smooth integration with TopBraid Composer as a professional development tool will make TopBraid Live one of the primary Rich Semantic Web Application platforms on the market.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31416365-9121690038551050204?l=composing-the-semantic-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://composing-the-semantic-web.blogspot.com/feeds/9121690038551050204/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=31416365&amp;postID=9121690038551050204' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/9121690038551050204'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/9121690038551050204'/><link rel='alternate' type='text/html' href='http://composing-the-semantic-web.blogspot.com/2007/08/topbraid-live-rich-semantic-internet_31.html' title='TopBraid Live: Rich Semantic Internet Applications with Flex'/><author><name>Holger Knublauch</name><uri>http://www.blogger.com/profile/13180242480924209321</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://www.knublauch.com/images/platypus.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-31416365.post-5202034490098915533</id><published>2007-08-27T12:33:00.000-07:00</published><updated>2007-08-27T13:58:53.947-07:00</updated><title type='text'>Explaining Inferences</title><content type='html'>One of the nice capabilities of OWL is its rich built-in semantics. These semantics can be used to employ generic inference engines that can make implicit relationships in your OWL model explicit. However, once you start using an inference engine, you are often more or less working with a black box and may discover that the system makes inferences that are difficult to understand.&lt;br /&gt;&lt;br /&gt;In the OWL tools spectrum, &lt;a href="http://code.google.com/p/swoop/"&gt;SWOOP&lt;/a&gt; was probably the first to provide some kind of explanation facility that would point users to a set of base axioms to explain inferences. This capability was based on an experimental version of the &lt;a href="http://pellet.owldl.com/"&gt;Pellet&lt;/a&gt; inference engine which has been folded into the regular Pellet distribution with its version 1.5. The new Pellet release made it straight-forward for us to add a similar capability to the new &lt;a href="http://www.topbraidcomposer.com/"&gt;TopBraid Composer&lt;/a&gt; version 2.2. After running inferences via Pellet you can click on the menu next to inferred triples to open the Explanation view:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://www.topbraidcomposer.com/images/blog/Explanation1.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;The Explanation view displays a clickable list of axioms. In the case below, it shows that the class Safari is inconsistent (i.e. a subclass of owl:Nothing) because it is the subclass of the two mutually disjoint classes Sightseeing and Adventure.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://www.topbraidcomposer.com/images/blog/Explanation2.png" /&gt;&lt;/center&gt;&lt;center&gt;&lt;/center&gt;&lt;div align="left"&gt;At TopQuadrant we have already had several use cases where this capability was a huge time-saver, in particular if ontologies get as large as those that we develop for NASA. Although the explanations may look weird or geeky at first, any pointers into the right direction can make a huge difference.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31416365-5202034490098915533?l=composing-the-semantic-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://composing-the-semantic-web.blogspot.com/feeds/5202034490098915533/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=31416365&amp;postID=5202034490098915533' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/5202034490098915533'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/5202034490098915533'/><link rel='alternate' type='text/html' href='http://composing-the-semantic-web.blogspot.com/2007/08/explanining-inferences.html' title='Explaining Inferences'/><author><name>Holger Knublauch</name><uri>http://www.blogger.com/profile/13180242480924209321</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://www.knublauch.com/images/platypus.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-31416365.post-4480776836524265423</id><published>2007-07-16T14:48:00.000-07:00</published><updated>2007-07-16T15:45:24.967-07:00</updated><title type='text'>Composite Design Pattern in RDF/OWL</title><content type='html'>One of the strengths of RDF is that it encourages reusing ontologies through globally unique URIs and imports from the Web. There is a small but growing library of de-facto standard ontologies such as foaf, geo and dublin core that serve as building blocks for much larger ontologies. Standard building blocks support the development of generic tools and algorithms. For example, if an ontology uses the latitude and longitude properties from the geo ontology, then geo-aware tools can render the subjects on geographical maps. Without such standard properties, coordinates would just be plain numbers, and tools would need to guess whether they are intended to represent locations or not.&lt;br /&gt;&lt;br /&gt;Taking this idea further, some RDF ontologies may even implement design patterns similar to those known from object-oriented systems. There is a well-known pattern called the &lt;a href="http://en.wikipedia.org/wiki/Composite_pattern"&gt;Composite Pattern&lt;/a&gt; which can be used to represent part-of relationships. In a nutshell, this pattern defines a class Component and a class Composite, and a relationship between them to express a child-of relationship. This pattern is frequently used in user-interface libraries to represent the nesting of UI widgets inside of each other, creating complex hierarchies. When this design pattern is used explicitly, then development tools can render the structure of the hierarchy appropriately, e.g. in a tree view.&lt;br /&gt;&lt;br /&gt;In the ontology/Semantic Web world, this pattern is also used very frequently. Several papers were written about representing part-of relationships. For our own work, we also re-invented this pattern numerous times. In addition to representing part-of relationships, we also find a recurring need to represent the ordering of the children. RDF is by definition unordered, and using rdf:Lists is often a pain to use. In response to these recurring requirements, I created a tiny RDF/OWL implementation of the composite design pattern, which can be found at&lt;br /&gt;&lt;p align="center"&gt;&lt;br /&gt;&lt;a href="http://www.topbraid.org/2007/05/composite.owl"&gt;http://www.topbraid.org/2007/05/composite.owl&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;div align="left"&gt;&lt;/div&gt;&lt;div align="left"&gt;This is a trivial ontology, defining three properties only:&lt;/div&gt;&lt;ul&gt;&lt;li&gt;&lt;div align="left"&gt;&lt;strong&gt;composite:child&lt;/strong&gt; is an object property pointing from a parent to a child&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div align="left"&gt;&lt;strong&gt;composite:parent&lt;/strong&gt; is the optional inverse of composite:child&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div align="left"&gt;&lt;strong&gt;composite:index&lt;/strong&gt; represents the index of each child among its siblings, typically starting at 0 for the first child&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p align="left"&gt;While this is a really tiny ontology, it can act as a quite powerful building block for larger models. In particular, &lt;a href="http://www.topbraidcomposer.com/"&gt;TopBraid Composer 2.1&lt;/a&gt; now has built-in support for this ontology. If you have imported the composite namespace into your model, then the form and the association tree will make use of the ordering using the composite:index property. In the following &lt;a href="http://www.topbraid.org/2007/07/compositeDemo.owl"&gt;example&lt;/a&gt;, I have created a class Process with a property step which is a sub-property of composite:child. All children have an index attached to them, and the form will automatically order the children by their index. By default the ordering would have been alphabetically.&lt;/p&gt;&lt;center&gt;&lt;img src="http://www.topbraidcomposer.com/images/blog/CompositeDemoForm.png" /&gt;&lt;/center&gt;&lt;br /&gt;There are menu items to move children up or down. You can use the Associations View to display this relationship in arbitrary nesting:&lt;br /&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://www.topbraidcomposer.com/images/blog/CompositeDemoTree.png" /&gt;&lt;/center&gt;&lt;br /&gt;We will add more support like that into future versions as we are exploring further design patterns. Feel free to reuse this composite ontology in your own projects and please let me know your comments (this blog does not allow comments since I received too much spam).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31416365-4480776836524265423?l=composing-the-semantic-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://composing-the-semantic-web.blogspot.com/feeds/4480776836524265423/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=31416365&amp;postID=4480776836524265423' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/4480776836524265423'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/4480776836524265423'/><link rel='alternate' type='text/html' href='http://composing-the-semantic-web.blogspot.com/2007/07/composite-design-pattern-in-rdfowl.html' title='Composite Design Pattern in RDF/OWL'/><author><name>Holger Knublauch</name><uri>http://www.blogger.com/profile/13180242480924209321</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://www.knublauch.com/images/platypus.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-31416365.post-9197765487511302187</id><published>2007-05-30T13:15:00.000-07:00</published><updated>2007-05-30T13:40:04.444-07:00</updated><title type='text'>Default Namespaces considered harmful</title><content type='html'>In RDF, default namespaces are typically used to minimize the length of resource names. For example, if you have a resource http://www.aldi.de/products.owl#Haferflocken and define everything up to the # as your default namespace, then you can abbreviate the whole URI with "Haferflocken" only.&lt;br /&gt;&lt;br /&gt;While this is very convenient in simple ontologies, things become quickly very confusing if you are building modular ontologies that span multiple namespaces and files. For our NASA work, we are dealing with ontologies that consist of 80 or more modules, all of which have their own namespaces. In such settings, using default namespaces is problematic because the same resources will be called under different names when you switch between files. For example if you are working in SPARQL and store your queries as part of a string-based query library, then the queries may reference resources sometimes as :Haferflocken and sometimes as aldi:Haferflocken, depending on whether a namespace is used or not. Depending on which is the main file, the queries may not work. Another problem is that if only a default namespace exists, and another file imports your ontology, then it is unclear what prefix to use for the external namespace. This leads to situations in which the same namespace is sometimes abbreviated "aldi" and sometimes "products".&lt;br /&gt;&lt;br /&gt;Our recommended practice is to not use any default namespaces, but instead explicitly declare a prefix for that namespace inside of the file so that when someone wants to import your model you all have consistent namespaces. This prepares your models to be imported in a modular fashion down the road.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31416365-9197765487511302187?l=composing-the-semantic-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://composing-the-semantic-web.blogspot.com/feeds/9197765487511302187/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=31416365&amp;postID=9197765487511302187' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/9197765487511302187'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/9197765487511302187'/><link rel='alternate' type='text/html' href='http://composing-the-semantic-web.blogspot.com/2007/05/default-namespaces-considered-harmful.html' title='Default Namespaces considered harmful'/><author><name>Holger Knublauch</name><uri>http://www.blogger.com/profile/13180242480924209321</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://www.knublauch.com/images/platypus.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-31416365.post-165211939395293233</id><published>2007-05-30T09:48:00.000-07:00</published><updated>2007-05-30T09:51:00.441-07:00</updated><title type='text'>Semantic Technology Conference Photos</title><content type='html'>Back to normal life after last week's busy Semantic Technology Conference. For those who could not attend, Keefe has kindly uploaded some photos from the various TopQuadrant-related events:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/semanticconference/"&gt;http://www.flickr.com/photos/semanticconference/&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31416365-165211939395293233?l=composing-the-semantic-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://composing-the-semantic-web.blogspot.com/feeds/165211939395293233/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=31416365&amp;postID=165211939395293233' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/165211939395293233'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/165211939395293233'/><link rel='alternate' type='text/html' href='http://composing-the-semantic-web.blogspot.com/2007/05/semantic-technology-conference-photos.html' title='Semantic Technology Conference Photos'/><author><name>Holger Knublauch</name><uri>http://www.blogger.com/profile/13180242480924209321</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://www.knublauch.com/images/platypus.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-31416365.post-664066927555227087</id><published>2007-05-23T07:16:00.000-07:00</published><updated>2007-05-23T07:23:31.276-07:00</updated><title type='text'>TopBraid Suite presented at SemTech 2007</title><content type='html'>Yesterday we presented the new TopBraid Live and TopBraid Ensemble products at the Semantic Technology conference. The room was packed full (and, more importantly, nobody left during the talk), so I guess we are going in the right direction. There were also excellent networking opportunities at the exhibition, which continues today.&lt;br /&gt;&lt;br /&gt;Here are the slides of my presentation - thanks to all who attended:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.topbraidcomposer.com/docs/STC-2007-HK.ppt"&gt;http://www.topbraidcomposer.com/docs/STC-2007-HK.ppt&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Some more information on the new TopBraid Suite products is available from the &lt;a href="http://www.topquadrant.com"&gt;TopQuadrant web site&lt;/a&gt;. I'll write more about it over the next couple of weeks.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31416365-664066927555227087?l=composing-the-semantic-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://composing-the-semantic-web.blogspot.com/feeds/664066927555227087/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=31416365&amp;postID=664066927555227087' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/664066927555227087'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/664066927555227087'/><link rel='alternate' type='text/html' href='http://composing-the-semantic-web.blogspot.com/2007/05/topbraid-suite-presented-at-semtech.html' title='TopBraid Suite presented at SemTech 2007'/><author><name>Holger Knublauch</name><uri>http://www.blogger.com/profile/13180242480924209321</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://www.knublauch.com/images/platypus.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-31416365.post-1052294674352599910</id><published>2007-05-10T17:30:00.000-07:00</published><updated>2007-05-10T17:54:49.161-07:00</updated><title type='text'>TopQuadrant is hiring!</title><content type='html'>Most people at TopQuadrant are currently busy preparing for the upcoming &lt;a href="http://www.semantic-conference.com/"&gt;Semantic Technology Conference&lt;/a&gt; in San Jose. This will be a great event for us, since we will introduce a new family of products under the umbrella of the TopBraid Suite. After we have quite successfully established TopBraid Composer as the leading professional semantic application development tool, we now take the next step.&lt;br /&gt;&lt;br /&gt;We will introduce &lt;strong&gt;TopBraid Live&lt;/strong&gt; as a client-server platform and library of reusable building blocks for all kinds of Semantic Web applications. This includes typical mash-up components (such as maps and calendars) but also more complex widgets such as trees, forms, reports and charts. Support for semantic search and other standard tasks will be integrated as well. We also introduce &lt;strong&gt;TopBraid Ensemble&lt;/strong&gt; as an out-of-the-box solution for viewing and editing RDF/OWL instances with a thin AJAX-based Web client. Needless to say, all these Web applications are seamlessly integrated with each other. For example, you can use TopBraid Composer to define form layouts and get exactly the same layout in TopBraid Ensemble. Be sure to visit us at our booth to find out more.&lt;br /&gt;&lt;br /&gt;In order to nurture and support all these new products and other customer projects, we are now looking for new developers. In addition to a good command of the underlying RDF-based technologies, candidates need to have excellent Java and Web development skills. If you are able to relocate, then sunny California is the place to be. TopQuadrant is in the middle of a solid phase of growth, and I think we are very well-positioned to become an important player in the semantic technology field. If you are interested in joining us (or know someone who might have a matching profile), please drop me a line.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31416365-1052294674352599910?l=composing-the-semantic-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://composing-the-semantic-web.blogspot.com/feeds/1052294674352599910/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=31416365&amp;postID=1052294674352599910' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/1052294674352599910'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/1052294674352599910'/><link rel='alternate' type='text/html' href='http://composing-the-semantic-web.blogspot.com/2007/05/topquadrant-is-hiring.html' title='TopQuadrant is hiring!'/><author><name>Holger Knublauch</name><uri>http://www.blogger.com/profile/13180242480924209321</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://www.knublauch.com/images/platypus.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-31416365.post-3633473990004110396</id><published>2007-03-23T08:44:00.000-07:00</published><updated>2007-03-23T08:51:00.733-07:00</updated><title type='text'>New TopBraid Composer Users Mailing List</title><content type='html'>I have received a number of request to launch a mailing list for our user community. I hesitated because many of our users work in restricted domains and prefer private emails with us. However, the rapidly increasing size of our user community has changed my mind. I have just launched a new Google Group at&lt;br /&gt;&lt;br /&gt;&lt;a href="http://groups.google.com/group/topbraid-composer-users"&gt;http://groups.google.com/group/topbraid-composer-users&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;If you are interested in TopBraid Composer then please join this group and use the discussion forum to ask questions, provide usability feedback, suggest new features, report bugs, or to get in touch with other TopBraid users around the world.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31416365-3633473990004110396?l=composing-the-semantic-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://composing-the-semantic-web.blogspot.com/feeds/3633473990004110396/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=31416365&amp;postID=3633473990004110396' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/3633473990004110396'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/3633473990004110396'/><link rel='alternate' type='text/html' href='http://composing-the-semantic-web.blogspot.com/2007/03/new-topbraid-composer-users-mailing.html' title='New TopBraid Composer Users Mailing List'/><author><name>Holger Knublauch</name><uri>http://www.blogger.com/profile/13180242480924209321</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://www.knublauch.com/images/platypus.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-31416365.post-9123217759219140711</id><published>2007-02-21T21:41:00.000-08:00</published><updated>2007-02-21T21:49:43.644-08:00</updated><title type='text'>Hybrid Inferencing with TopBraid Composer 2.0</title><content type='html'>&lt;p&gt;Many people who learn Semantic Web languages have a hard time understanding the concept of inference engines (aka reasoners). In a nutshell, an inference engine takes an "asserted" model as input and creates an "inferred" model as output. In the open world of the Semantic Web, inference engines can only add new triples, i.e. the output model is the input model plus additional inferred triples. In other words, inference engines derive new knowledge from existing knowledge. &lt;/p&gt;&lt;p&gt;Various types of inference engines exist, including OWL DL tableaux reasoners like Pellet, and Rule engines such as Jena. Even SPARQL can be regarded as an inference engine, because its &lt;a href="http://composing-the-semantic-web.blogspot.com/2006/09/ontology-mapping-with-sparql-construct.html"&gt;CONSTRUCT keyword&lt;/a&gt; can be used to derive new triples from existing triples. Some applications may also require custom-tailored reasoning engines that apply temporal or geospatial knowledge to infer new knowledge.&lt;/p&gt;&lt;p&gt;However, implementing a complete inference engine that adds some functionality on top of OWL and RDF Schema is a lot of work, and few people want to reinvent the wheel. For example, vanilla implementations of SPARQL and the Jena rules language have no built-in knowledge of OWL DL semantics, yet in many use cases, you want to &lt;strong&gt;run SPARQL or Jena on top of an OWL-compliant reasoning service&lt;/strong&gt; such as Pellet. Fortunately, since all inference engines are essentially black boxes that take some triples as input and generate more triples as output, it is possible to link various engines together so that the output of one engine becomes the input to the next. &lt;/p&gt;&lt;p&gt;Some support of such hybrid inference chaining had already been provided by previous versions of TopBraid Composer. However, this support was scattered across various places in the user interface and not as flexible as it should. This limited its use and made things complicating to explain and demonstrate. So we took the opportunity of the new &lt;a href="http://composing-the-semantic-web.blogspot.com/2007/02/announcing-topbraid-composer-20.html"&gt;TopBraid Composer 2.0&lt;/a&gt; release to generalize and clean up our inferencing support. How this works is illustrated in the screenshot below (click on the image for a larger picture):&lt;/p&gt;&lt;br /&gt;&lt;p align="center"&gt;&lt;a href="http://www.topbraidcomposer.com/images/blog/Inferencing-ConfigureDialog.png"&gt;&lt;img height="271" src="http://www.topbraidcomposer.com/images/blog/Inferencing-ConfigureDialog.380.png" width="380" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;&lt;br /&gt;&lt;p align="left"&gt;The configuration dialog above can be used to select and arrange reasoning engines for a given project. In this case,&lt;/p&gt;&lt;ul&gt;&lt;li&gt;we are taking an asserted model containing real-estate properties and execute Pellet over it. This would reveal OWL DL relationships between concepts, for example to infer that if House is a subclass of RealEstate, then any particular instance of House is also an instance of RealEstate. Supported by this additional knowledge,&lt;/li&gt;&lt;br /&gt;&lt;li&gt;we run a bunch of SWRL or Jena rules to infer relationships that cannot be expressed in OWL DL. For example, the Jena rules engine has a built-in function to do mathematical calculations, so that we can, for example, convert Australian dollar values into US dollars. After we have done these additional calculations, &lt;/li&gt;&lt;br /&gt;&lt;li&gt;we execute SPARQL CONSTRUCT queries to establish new triples and relationships. For example, now that we know the US dollar price of a certain House in Australia, we can evaluate whether it matches my SPARQL FILTER maximum of 900,000 $US. Since this step may create new triples, and these new triples may lead to new relationships from Pellet's point of view,&lt;/li&gt;&lt;br /&gt;&lt;li&gt;we repeat the steps above until no additional triples have been added by any step.&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;br /&gt;&lt;p&gt;If you want to play with this scenario yourself, download TopBraid Composer 2.0, import the &lt;a href="http://www.topbraid.org/2007/02/realEstate.owl"&gt;example real-estate ontology&lt;/a&gt; and configure the infererence engines as shown above. Use the new Run Inferences button to execute the process - it should come back with suggestions on which house to buy for some customers. Note that the file contains some constructs both in their Jena rules notation as well as the SPARQL notation, but you can disable all Jena rules (except for the currency conversion) to get the complete results - the Jena rules are there to illustrate the syntax of both approaches.&lt;/p&gt;&lt;p&gt;While the capability to chain multiple inference engines together is not radically new, the new architecture and its simple, intuitive user interface in TopBraid Composer will open the door for many new kinds of applications. For example, you can define your own reasoning engines with SPARQL or Jena and use them to provide on-the-fly translations and mappings from one data structure into another. Simply collect your mapping rules in a separate ontology and give them to others so that they can put these rules into their own inference delegation chain. If the expressivity of OWL, SPARQL, SWRL or Jena is not sufficient for your needs, you may use a new Eclipse extension point in Composer to add your own Java functions for domain-specific reasoners (ask me for details if you are interested in this). Based on this architecture, we will start to roll out several new features for ontology mapping, data integration and mash-up creation in the coming months.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31416365-9123217759219140711?l=composing-the-semantic-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://composing-the-semantic-web.blogspot.com/feeds/9123217759219140711/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=31416365&amp;postID=9123217759219140711' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/9123217759219140711'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/9123217759219140711'/><link rel='alternate' type='text/html' href='http://composing-the-semantic-web.blogspot.com/2007/02/hybrid-inferencing-with-topbraid.html' title='Hybrid Inferencing with TopBraid Composer 2.0'/><author><name>Holger Knublauch</name><uri>http://www.blogger.com/profile/13180242480924209321</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://www.knublauch.com/images/platypus.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-31416365.post-5377004852593812510</id><published>2007-02-21T21:33:00.000-08:00</published><updated>2007-02-21T21:40:00.472-08:00</updated><title type='text'>OWL 1.1 Support in TopBraid Composer 2.0</title><content type='html'>&lt;p&gt;&lt;a href="http://owl1_1.cs.manchester.ac.uk/"&gt;OWL 1.1&lt;/a&gt; is an evolving extension of the Web Ontology Language (OWL). Driven by a world-wide community of researchers, this proposal aims at fixing some of the most frequently encountered limitations of OWL such as the lack of user-defined datatypes, and cumbersome disjointness axioms. The new 1.1 features include extra syntactic sugar, additional property and qualified cardinality constructors, extended datatype support, simple metamodelling, and extended annotations.&lt;/p&gt;&lt;p&gt;While OWL 1.1 is still at a rather early stage, and will not become an official recommendation before 2008, I believe that OWL 1.1 contains many invaluable extensions that are already useful for everyday work. We therefore decided to integrate 1.1 support into the new &lt;a href="http://composing-the-semantic-web.blogspot.com/2007/02/announcing-topbraid-composer-20.html"&gt;2.0 release&lt;/a&gt; of &lt;a href="http://www.topbraidcomposer.com"&gt;TopBraid Composer&lt;/a&gt;. The &lt;a href="http://pellet.owldl.com"&gt;Pellet&lt;/a&gt; version integrated in Composer already supports reasoning with many of the OWL 1.1 constructs, and more 1.1 tools and APIs will follow. At the same time, users need to be aware that they are adopting the language at a stage where it will almost certainly change. As a result, ontologies that use the new features now may contain deprecated constructs until the language has been officially sanctioned. Furthermore, tool support is on the bleeding edge and will not be as stable and reliable as support for OWL 1.0. &lt;/p&gt;&lt;p&gt;Here are some examples of how the new features are used in Composer. User-defined datatypes are subtypes of the built-in datatypes such as xsd:int and xsd:string. In the screenshot below, all instances of the class Adult must have their age between 18 and 65: &lt;/p&gt;&lt;br /&gt;&lt;p align="center"&gt;&lt;img height="277" alt="OWL 1.1 Local DataRange" src="http://www.topbraidcomposer.com/images/blog/OWL11-LocalDataRange.png" width="364" /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Internally, the new OWL 1.1 language constructs are represented as additional triples. In the example below, I have restricted the range of the age property to fall within the interval of 0 to 200. As shown in the nested form, the rdfs:range of the property is an instance of the system class owl:DataRange, with additional attributes to represent facets such as minInclusive. &lt;/p&gt;&lt;br /&gt;&lt;p align="center"&gt;&lt;img height="459" alt="OWL 1.1 User-defined datatype" src="http://www.topbraidcomposer.com/images/blog/OWL11-RDFSRange.png" width="364" /&gt; &lt;/p&gt;&lt;br /&gt;&lt;p align="left"&gt;A common problem with OWL DL ontologies is that a large number of disjointness axioms is needed to declare that certain classes do not overlap (i.e. share instances). OWL 1.1 introduces the disjointUnionOf property as a convenient shortcut for such cases. In the following TopBraid Composer screenshot, the class RealEstate is defined as the disjoint union of its subclasses Apartment, House and Townhouse using a compact xor notation. Reasoning engines that see such statements would insert pairwise disjointness axioms between those classes on the fly. &lt;/p&gt;&lt;br /&gt;&lt;p align="center"&gt;&lt;img height="303" alt="OWL 1.1 xor" src="http://www.topbraidcomposer.com/images/blog/OWL11-xor.png" width="312" /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p align="left"&gt;Qualified Cardinality Restrictions (QCRs) allow you to define the class of Persons that have some children, at least two of which must be Female: &lt;/p&gt;&lt;br /&gt;&lt;p align="center"&gt;&lt;img height="263" alt="OWL 1.1 QCR" src="http://www.topbraidcomposer.com/images/blog/OWL11-QCR.png" width="312" /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p align="left"&gt;There are several other extensions - please see TopBraid Composer's documentation (Help &gt; Help Contents &gt; TopBraid Composer) and the OWL 1.1 documents on the Web for details. Don't forget to activate OWL 1.1 support in the ontology start page - by default these features are switched off so that users can safely rely on OWL 1.0 if they prefer. Feel free to drop me a line to provide your feedback and questions.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31416365-5377004852593812510?l=composing-the-semantic-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://composing-the-semantic-web.blogspot.com/feeds/5377004852593812510/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=31416365&amp;postID=5377004852593812510' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/5377004852593812510'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/5377004852593812510'/><link rel='alternate' type='text/html' href='http://composing-the-semantic-web.blogspot.com/2007/02/owl-11-support-in-topbraid-composer-20.html' title='OWL 1.1 Support in TopBraid Composer 2.0'/><author><name>Holger Knublauch</name><uri>http://www.blogger.com/profile/13180242480924209321</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://www.knublauch.com/images/platypus.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-31416365.post-159621924518781110</id><published>2007-02-21T21:21:00.000-08:00</published><updated>2007-02-21T21:32:44.821-08:00</updated><title type='text'>Announcing TopBraid Composer 2.0</title><content type='html'>&lt;p&gt;We are very excited to announce the release of &lt;a href="http://www.topbraidcomposer.com/"&gt;TopBraid Composer 2.0&lt;/a&gt; today. This milestone release makes Composer the first professional Semantic Web development tool to support the evolving &lt;a href="http://owl1_1.cs.manchester.ac.uk/"&gt;OWL 1.1&lt;/a&gt; specification. We have also significantly improved the inferencing architecture, allowing TopBraid users to execute reasoners in a delegation chain, and to use SPARQL as a rule language. I will write detailed blog entries about these features shortly.&lt;/p&gt;&lt;p&gt;In addition to these and many other new features (listed on our &lt;a href="http://www.topbraidcomposer.com/tbc-2.0.0.html"&gt;web page&lt;/a&gt;), we have spent extra time debugging to make sure that Composer stays ahead of its competitors in terms of stability and performance. We have discovered and worked around some Eclipse incompatibilities on Mac computers. Doing a major release was also a good opportunity to review and update the help pages: I actually ended up adapting all pages and replacing all the screenshots. Finally, we have simplified the installation on Windows, and now provide a clean installer package including Java and Eclipse.&lt;/p&gt;&lt;p&gt;Reflecting on the rapid evolution of the tool since its first release early 2006, I would like to acknowledge all of our users who have provided invaluable feedback and otherwise supported our work. We very much appreciate to have you on board! Many of the features that you find in Composer these days are also a direct result of TopQuadrant's semantic web projects with customers around the world. We all hope you enjoy TopBraid Composer 2.0 as much as we do!&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31416365-159621924518781110?l=composing-the-semantic-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://composing-the-semantic-web.blogspot.com/feeds/159621924518781110/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=31416365&amp;postID=159621924518781110' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/159621924518781110'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/159621924518781110'/><link rel='alternate' type='text/html' href='http://composing-the-semantic-web.blogspot.com/2007/02/announcing-topbraid-composer-20.html' title='Announcing TopBraid Composer 2.0'/><author><name>Holger Knublauch</name><uri>http://www.blogger.com/profile/13180242480924209321</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://www.knublauch.com/images/platypus.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-31416365.post-116863984855534660</id><published>2007-01-12T14:10:00.000-08:00</published><updated>2007-02-05T13:07:35.763-08:00</updated><title type='text'>Real-time Data Browsing with SPARQL</title><content type='html'>In many cases, good ideas for new features come directly from our end-users. A few days ago, a customer asked for the ability to automatically refresh the SPARQL view whenever the user selects a new resource. This is easy enough to implement, and now available in &lt;a href="http://www.topbraidcomposer.com"&gt;TopBraid Composer&lt;/a&gt; 1.5.1. Look at the following screenshot to see what it does.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://www.topbraidcomposer.com/images/blog/AutoSPARQL.png" /&gt;&lt;/center&gt;&lt;br /&gt;Whenever the user selects a different Suburb, the SPARQL window will automatically run the given query and display the matches. This mechanism is triggered if the current query contains the variable ?this. The trick is to automatically bind the ?this variable with the current resource.&lt;br /&gt;&lt;br /&gt;This useful mechanism can be used to quickly browse instances by arbitrary queries, e.g. to see how the system would behave during ontology design. Thanks a lot, Geoff, for this excellent idea! We appreciate more input like this...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31416365-116863984855534660?l=composing-the-semantic-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://composing-the-semantic-web.blogspot.com/feeds/116863984855534660/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=31416365&amp;postID=116863984855534660' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/116863984855534660'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/116863984855534660'/><link rel='alternate' type='text/html' href='http://composing-the-semantic-web.blogspot.com/2007/01/real-time-data-browsing-with-sparql.html' title='Real-time Data Browsing with SPARQL'/><author><name>Holger Knublauch</name><uri>http://www.blogger.com/profile/13180242480924209321</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://www.knublauch.com/images/platypus.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-31416365.post-116811008375498407</id><published>2007-01-06T11:01:00.000-08:00</published><updated>2007-01-09T06:18:54.616-08:00</updated><title type='text'>More on Mashups: Linear Charts</title><content type='html'>In my previous postings, I wrote about &lt;a href="http://www.topbraidcomposer.com"&gt;TopBraid&lt;/a&gt;'s new &lt;a href="http://composing-the-semantic-web.blogspot.com/2007/01/calendar-mashup-in-topbraid-composer.html"&gt;Calendar mashup&lt;/a&gt; feature as well as our &lt;a href="http://composing-the-semantic-web.blogspot.com/2007/01/topbraid-is-now-also-rdfa-editor.html"&gt;RDFa editor&lt;/a&gt;. Version 1.5 introduces yet another feature called the Linear Chart View. This view allows users to display numeric values along a linear chart with X and/or Y axes. If you have an ontology about real estate properties, and want to get a chart to compare the prices of all relevant properties, then you can display them along the X axis:&lt;br /&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://www.topbraidcomposer.com/images/blog/LinearChartXAxis.png" /&gt;&lt;/center&gt;&lt;br /&gt;Alternatively, you can use the Y Axis:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://www.topbraidcomposer.com/images/blog/LinearChartYAxis.png" /&gt;&lt;/center&gt;&lt;br /&gt;To make things more interesting (also in the sense of mashing up data from multiple sources), select the price along the X axis and the number of bedrooms along the Y axis:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;center&gt;&lt;a href="http://www.topbraidcomposer.com/images/blog/LinearChartXYAxis.png"&gt;&lt;img src="http://www.topbraidcomposer.com/images/blog/LinearChartXYAxis.380.png" /&gt;&lt;/a&gt;&lt;/center&gt;&lt;br /&gt;You can use the mouse to drag the chart in all directions or to change the zooming level. The chart is also clickable and has tool tip texts to display details. It is easy to imagine that we could have similar viewers for other types of diagrams such as pie charts.&lt;br /&gt;&lt;br /&gt;TopBraid is increasingly becoming an information integration hub that puts a lot of power into the hands of ontology designers and users. For example, you could create ontologies that serve as a &lt;a href="http://composing-the-semantic-web.blogspot.com/2006/08/update-automated-database-import-into.html"&gt;view on a relational database&lt;/a&gt; or &lt;a href="http://composing-the-semantic-web.blogspot.com/2006/08/lifting-excel-into-semantic-web.html"&gt;lift Excel spreadsheets into the Semantic Web&lt;/a&gt;. Then combine these data sources with other ontologies and finally display them on chart. In the near future you will also be able to publish the very same models and views on the Web so that end users can analyze them with a thin Ajax-based client. There is quite a bit happening with TopBraid these days. I wonder where this journey is taking us...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31416365-116811008375498407?l=composing-the-semantic-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://composing-the-semantic-web.blogspot.com/feeds/116811008375498407/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=31416365&amp;postID=116811008375498407' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/116811008375498407'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/116811008375498407'/><link rel='alternate' type='text/html' href='http://composing-the-semantic-web.blogspot.com/2007/01/more-on-mashups-linear-charts.html' title='More on Mashups: Linear Charts'/><author><name>Holger Knublauch</name><uri>http://www.blogger.com/profile/13180242480924209321</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://www.knublauch.com/images/platypus.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-31416365.post-116810866682696879</id><published>2007-01-06T10:37:00.000-08:00</published><updated>2007-01-11T02:10:36.906-08:00</updated><title type='text'>Calendar Mashup in TopBraid Composer</title><content type='html'>Mashups are applications that combine content from multiple sources into a single view. For example, if one web page lists the dates and addresses of certain conferences and another web service knows how to convert addresses into geographical coordinates, then it would be helpful to extract both pieces of information into an integrated experience to help with travel arrangements. The open architecture of Semantic Web languages like RDF Schema and OWL make it relatively easy to bring together information from various sources. Once the data structures are brought together and aligned, they can be displayed and analyzed.&lt;br /&gt;&lt;br /&gt;We are incrementally extending our RDF/OWL development tool TopBraid Composer with new forms of visualization. This allows ontology designers and data architects to directly experience what they can actually do with the ontologies. TopBraid already has support for geographical information with its Google Maps interface, but version 1.5 now also introduces a Calendar view.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://www.topbraidcomposer.com/images/blog/CalendarView.380.png" /&gt;&lt;/center&gt;&lt;br /&gt;The Calendar View enables users to visualize xsd:date and xsd:dateTime values from an RDF/OWL model on a month-by-month basis. Users select which properties to show and the system then renders them into their corresponding day boxes. In the following screenshot, the Calendar is shown alongside with the geographical viewer (click for a larger image).&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;center&gt;&lt;a href="http://www.topbraidcomposer.com/images/blog/CalendarScreenshot.png"&gt;&lt;img src="http://www.topbraidcomposer.com/images/blog/CalendarScreenshot.380.png" /&gt;&lt;/a&gt;&lt;/center&gt;&lt;br /&gt;As you can see on these images, some temporal values are displayed to cover multiple days, i.e. they represent a "time span". Well, but there is no standard way to formalize a "time span" in RDF, so you may wonder how does the system actually know that some properties shall be interpreted as start and end points of a time interval? The flexibility of RDF Schema enables a quite elegant solution to this problem. The Calendar is connected to a small &lt;a href="http://www.topbraid.org/2007/01/calendar.owl"&gt;Calendar ontology&lt;/a&gt; which defines two properties calendar:startTime and calendar:endTime. If your domain has a pair of properties travel:departureDate and travel:returnDate then you just need to make these properties subproperties of the calendar properties, and run the classifier to tell the system that all departureDate values shall be interpreted as startTime and all associated returnDates shall become endTimes as well. Instead of having to change the code or configuration of the Calendar itself, we &lt;em&gt;just change the model&lt;/em&gt; to drive the existing viewer.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31416365-116810866682696879?l=composing-the-semantic-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://composing-the-semantic-web.blogspot.com/feeds/116810866682696879/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=31416365&amp;postID=116810866682696879' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/116810866682696879'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/116810866682696879'/><link rel='alternate' type='text/html' href='http://composing-the-semantic-web.blogspot.com/2007/01/calendar-mashup-in-topbraid-composer.html' title='Calendar Mashup in TopBraid Composer'/><author><name>Holger Knublauch</name><uri>http://www.blogger.com/profile/13180242480924209321</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://www.knublauch.com/images/platypus.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-31416365.post-116806823752990425</id><published>2007-01-05T23:23:00.000-08:00</published><updated>2007-01-05T23:23:57.543-08:00</updated><title type='text'>TopBraid is now also an RDFa Editor</title><content type='html'>A few month back I &lt;a href="http://composing-the-semantic-web.blogspot.com/2006/09/rdfa-support-in-topbraid-composer.html"&gt;wrote&lt;/a&gt; about &lt;a href="http://en.wikipedia.org/wiki/RDFa"&gt;RDFa&lt;/a&gt; support in our ontology editor &lt;a href="http://www.topbraidcomposer.com/"&gt;TopBraid Composer&lt;/a&gt;. RDFa is a set of simple XHTML attributes being proposed by W3C, allowing web developers to add RDF/OWL metadata to existing web pages. For example, RDFa can be used to state that a certain string on a page actually is the first name of a person, and that another section on that page contains the person's date of birth. Such RDFa annotations are one way of &lt;a href="http://www.sdforum.org/SDForum/Templates/CalendarEvent.aspx?CID=2086&amp;mo=1&amp;amp;yr=2007"&gt;shrinking the Meaningless Web&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Although RDFa only consists of little more than a handful of attributes, it is not always simple to combine conventional HTML content with semantic markup. RDF as well as its embedding into HTML with RDFa requires some training and should be supported by tools comparable to professional IDEs. We have been thinking about how to provide tool support to help Web page designers to work with RDFa in conjunction with HTML and JSP. Our first result is the new RDFa editing support in TopBraid. This support currently includes&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Syntax highlighting of the RDFa keywords&lt;/li&gt;&lt;li&gt;Auto-completion of property and resource names (with CTRL-space)&lt;/li&gt;&lt;li&gt;Mouse-driven navigation from an RDFa element to the corresponding resource in the ontology (CTRL-mouse over)&lt;/li&gt;&lt;li&gt;A button to quickly extract and view the triples encoded inside the RDFa document&lt;/li&gt;&lt;li&gt;Error checking at edit-time so that unknown resource names are marked as warnings&lt;/li&gt;&lt;li&gt;A library of typical RDFa source pattern snippets&lt;/li&gt;&lt;li&gt;Drag and drop from TopBraid's ontology windows into the RDFa text area&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;The following image shows auto completion with geographical markup.&lt;br /&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://www.topbraidcomposer.com/images/blog/RDFaEditorContentAssist.png" /&gt; &lt;/center&gt;&lt;br /&gt;&lt;br /&gt;One mode of working with this support is to open an ontology that imports the relevant namespaces (such as &lt;a href="http://www.foaf-project.org/"&gt;FOAF&lt;/a&gt; or &lt;a href="http://sioc-project.org/"&gt;SIOC&lt;/a&gt;) and also includes the RDFa data source. Users can then switch between editing and browse the ontology, the HTML/RDFa source code and the resulting HTML page (click on the image for a larger version):&lt;br /&gt;&lt;br /&gt;&lt;center&gt;&lt;a href="http://www.topbraidcomposer.com/images/blog/RDFaEditor.png"&gt;&lt;img src="http://www.topbraidcomposer.com/images/blog/RDFaEditor.380.png" /&gt; &lt;/a&gt;&lt;/center&gt;&lt;br /&gt;Needless to say that people editing RDFa this way can at any time use the TopBraid infrastructure to run reasoners, query engines or all kinds of visualizations and mashups to test how other RDFa-aware applications may work with the page. For example, if an RDFa page defines an entity with geographical coordinates, then these coordinates can be directly displayed on an embedded Google map.&lt;br /&gt;&lt;br /&gt;This integrated development environment for RDFa is enabled by the power of the Eclipse platform. Eclipse does not only provide a windowing framework for TopBraid Composer's windows, but it also comes with many reusable components. In the case of the RDFa editor, we stand on the shoulder of giants and exploit the infrastructure of the &lt;a href="http://www.eclipse.org/webtools/wst/main.html"&gt;Eclipse Web Standard Tools&lt;/a&gt; subproject that provides editing support for HTML, and the &lt;a href="http://www.eclipse.org/webtools/jst/main.html"&gt;Eclipse J2EE Standard Tools&lt;/a&gt; project that adds Java Server Pages support. We have layered our RDFa support on these plugins, allowing Web developers to do incremental steps into the RDFa world from the tools they are familiar with.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/31416365-116806823752990425?l=composing-the-semantic-web.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://composing-the-semantic-web.blogspot.com/feeds/116806823752990425/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=31416365&amp;postID=116806823752990425' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/116806823752990425'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/31416365/posts/default/1168068237529904
