<?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-7507012841435012041</id><updated>2012-02-10T14:52:45.457-08:00</updated><category term='SPARQL Web Pages'/><category term='SPARQL'/><category term='SPIN'/><category term='XSD'/><category term='SPARQLMotion'/><category term='RDF'/><category term='TBL'/><category term='SPARQL endpoint'/><category term='EMOF'/><category term='debugger'/><category term='SKOS'/><category term='EVN'/><category term='How to'/><category term='QVT'/><category term='UML'/><category term='modeling'/><category term='XML'/><category term='OWL'/><category term='upgrade'/><category term='topbraid'/><category term='OCL'/><category term='CMOF'/><category term='SPINMap'/><category term='MOF'/><title type='text'>VOYAGES OF THE SEMANTIC ENTERPRISE</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://topquadrantblog.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://topquadrantblog.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Irene Polikoff</name><uri>http://www.blogger.com/profile/17834271916697741738</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>40</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7507012841435012041.post-625747310961658655</id><published>2011-12-02T07:09:00.000-08:00</published><updated>2011-12-16T13:51:37.783-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SPARQL Web Pages'/><category scheme='http://www.blogger.com/atom/ns#' term='SPARQLMotion'/><title type='text'>Publishing HTML created with SPARQL Web Pages</title><content type='html'>&lt;p style="font-family: arial, helvetica; font-size: 13px; text-align: -webkit-auto; "&gt;&lt;a href="http://topquadrantblog.blogspot.com/2011/11/creating-topbraid-mobile-web-app-with.html"&gt;Last week&lt;/a&gt; we saw how to use SPARQL Web Pages (SWP) to render customized HTML of individual class instances and how to create a web page of all that class's instances with a title at the top. The fine-grained control that SWP gives us over the generated HTML let us take advantage of the jQuery Mobile libraries so that the sample TopBraid application generated web pages appropriate for a smartphone interface, with buttons that expand and collapse at your touch to display details about each class instance.&lt;/p&gt;&lt;p style="font-family: arial, helvetica; font-size: 13px; text-align: -webkit-auto; "&gt;Testing this application meant choosing from two alternatives:&lt;/p&gt;&lt;ul style="font-family: arial, helvetica; font-size: 13px; text-align: -webkit-auto; "&gt;&lt;li style="font-size: 10pt; "&gt;&lt;p style="font-size: 10pt; "&gt;The first was to run it on TopBraid Composer's built-in TopBraid Live Personal Server, which let us look at the page from any web browser running on the same machine.&lt;/p&gt;&lt;/li&gt;&lt;li style="font-size: 10pt; "&gt;&lt;p style="font-size: 10pt; "&gt;Uploading the application's project to a TopBraid Live Enterprise Server, where multiple devices, including phones, could access it.&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p style="font-family: arial, helvetica; font-size: 13px; text-align: -webkit-auto; "&gt;Either way, because TopBraid Live generates these web pages dynamically, if the underlying data is changed, refreshed versions of the web page would reflect this, making TopBraid a great platform for interactive semantic web applications for any device.&lt;/p&gt;&lt;p style="font-family: arial, helvetica; font-size: 13px; text-align: -webkit-auto; "&gt;You don't have to have a TopBraid Live Enterprise server to deliver pages generated by SWP, though. A simple SPARQLMotion script can save your formatted HTML in disk files that you can copy to a web server that may or may not have TopBraid Live installed. Using this technique, you can use the TopBraid platform to create semantic content publishing applications as well as interactive applications.&lt;/p&gt;&lt;p style="font-family: arial, helvetica; font-size: 13px; text-align: -webkit-auto; "&gt;The following SPARQLMotion script, which is stored in the application file described last week, does this for the mobile Kennedys web application.&lt;/p&gt;&lt;center style="font-family: arial, helvetica; font-size: 13px; "&gt;&lt;img src="http://www.topquadrant.com/resources/blog/mobileKennedysSMScript.jpg" alt="mobile Kennedys app SPARQLMotion script" width="450" /&gt;&lt;/center&gt;&lt;p style="font-family: arial, helvetica; font-size: 13px; text-align: -webkit-auto; "&gt;The first module is an sml:ImportRDFFromWorkspace module that reads the file that this script is stored in. That file has the Kennedys data and the SWP formatting markup so that this data can be fed to the next step in the process.&lt;/p&gt;&lt;p style="font-family: arial, helvetica; font-size: 13px; text-align: -webkit-auto; "&gt;The second module, named mk:GenerateHTML, is an sml:CreateUISPINDocument SPARQLMotion module (from the Text Processing section of the SPARQLMotion palette) whose key setting is its sml:view property, which has the following:&lt;/p&gt;&lt;pre style="margin-top: 14pt; margin-bottom: 14pt; margin-left: 0pt; font-size: 13px; text-align: -webkit-auto; "&gt;&lt;pre style="margin-top: 14pt; margin-bottom: 14pt; margin-left: 0pt; "&gt;&amp;lt;ui:resourceView&lt;br /&gt;   ui:resource="&amp;amp;lt;http://topbraidlive.org/mobileKennedys&amp;amp;gt;"/&gt;&lt;br /&gt;&lt;/pre&gt;&lt;/pre&gt;&lt;p style="font-family: arial, helvetica; font-size: 13px; text-align: -webkit-auto; "&gt;It's a snippet of XML specifying that the module should create a resource view for the specified resource, which is identified here with a complete URI. (The URI's delimiting angle brackets are escaped because they're in an XML attribute.) The real work to make this happen was all described in the last blog entry, which showed how the SWP code to generate a complete web page was attached to the&lt;tt&gt;&lt;http: org="" mobilekennedys=""&gt;&lt;/http:&gt;&lt;/tt&gt; resource. The mk:GenerateHTML module in this script also specifies that this generated markup will be stored in a variable named &lt;tt&gt;doc&lt;/tt&gt;.&lt;/p&gt;&lt;p style="font-family: arial, helvetica; font-size: 13px; text-align: -webkit-auto; "&gt;The final mk:SaveFile module in the script is an sml:ExportToTextFile module that saves the contents of the &lt;tt&gt;doc&lt;/tt&gt; variable (set in the module's sml:text property as the SPARQL expression &lt;tt&gt;?doc&lt;/tt&gt;) to a file called output.html. I also set sml:replace to true so that repeated execution of the script wouldn't append the output onto the result of previous runs.&lt;/p&gt;&lt;p style="font-family: arial, helvetica; font-size: 13px; text-align: -webkit-auto; "&gt;After you run this script you'll have a web page called output.html that looks like the display shown in the phone browsers in last week's blog entry, and you can copy this file to any web server you want.&lt;/p&gt;&lt;p style="font-family: arial, helvetica; font-size: 13px; text-align: -webkit-auto; "&gt;This script is very simple. As you bring other SPARQLMotion capabilities into it such as inferencing and reading from all the data formats that TopBraid understands, you can make it much more sophisticated. You can also configure the script to save a collection of multiple files, letting you publish large collections of data in pieces that are digestible for typical browsers. (Phone browsers in particular can get sluggish; my Android LG Ally is not a recent model, and the expanding and collapsing of information about each person on the display of this app is not as quick on the Ally as I'd like it to be.)&lt;/p&gt;&lt;p style="font-family: arial, helvetica; font-size: 13px; text-align: -webkit-auto; "&gt;So, use your imagination to add new features to this SPARQLMotion script, and you can create dynamic or static web pages for phones or any other kinds of browsers, with all the power of TopBraid behind your application development.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7507012841435012041-625747310961658655?l=topquadrantblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://topquadrantblog.blogspot.com/feeds/625747310961658655/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7507012841435012041&amp;postID=625747310961658655' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default/625747310961658655'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default/625747310961658655'/><link rel='alternate' type='text/html' href='http://topquadrantblog.blogspot.com/2011/12/publishing-html-created-with-sparql-web.html' title='Publishing HTML created with SPARQL Web Pages'/><author><name>Bob DuCharme</name><uri>http://www.blogger.com/profile/02742075186312518829</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_13zlUS8aD_8/S0OhTCeBZ8I/AAAAAAAAAAM/cGInR6wDS84/S220/128x128.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7507012841435012041.post-8911127236037391229</id><published>2011-11-22T07:18:00.000-08:00</published><updated>2012-02-10T14:52:45.472-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SPARQL Web Pages'/><title type='text'>Creating a TopBraid mobile web app with SPARQL Web Pages</title><content type='html'>&lt;div id="i0"&gt;&lt;p&gt;I've &lt;a href="http://topquadrantblog.blogspot.com/2010/11/getting-started-with-sparql-web-pages.html"&gt;written here before&lt;/a&gt; about how &lt;a href="http://uispin.org/"&gt;SPARQL Web Pages&lt;/a&gt; (SWP) let you convert your RDF to HTML or XML by embedding SPARQL queries into the appropriate markup. In that very simple example, I showed how to create a web page for an address book entry and then display it both in TopBraid Composer and in a regular web browser.&lt;/p&gt;&lt;p&gt;Today I'm going to show how I did something similar to display a single Person instance from the Kennedys sample data included with TopBraid Composer and then defined a page that showed all the people in that data model. You can download and try the project &lt;a href="http://www.topquadrant.com/resources/blog/mobileKennedys.zip"&gt;here&lt;/a&gt;. The fun part was displaying it so that it looks like a proper mobile web page on a phone's web browser, as shown here on an Android phone and on an iPhone turned sideways to test the re-orienting capability of the display.&lt;/p&gt;&lt;center&gt;&lt;a href="http://www.topquadrant.com/resources/blog/KennedysOnPhones.jpg"&gt;&lt;img src="http://www.topquadrant.com/resources/blog/KennedysOnPhones.jpg" alt="app output on LG Ally and iPhone" border="0" width="400" /&gt;&lt;/a&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Touching someone's name on the phone expands the display to show the remaining property names and values about that person underneath his or her name. In the picture, I've just touched Andrew Cuomo's name on the Android phone and Edward Kennedy Jr's name on the iPhone, displaying details about each of them below their names. Touching the names again hides their data. &lt;/p&gt;&lt;p&gt;In the picture, the two phone browsers are displaying the output of a TopBraid Live server running this application. As we'll see in the sequel to this blog entry, you can use the same SPARQL Web Page configuration to save HTML disk files with all of this formatting so that the phone browsers could view the static web pages stored on a server that didn't have TopBraid Live installed.&lt;/p&gt;&lt;p&gt;To enable proper mobile display, I used the &lt;a href="http://jquerymobile.com/"&gt;jQuery Mobile&lt;/a&gt; library. &lt;a href="http://jquery.com/"&gt;jQuery&lt;/a&gt; is a set of Javascript and CSS libraries designed to let you add sophisticated user interfaces to your web pages without worrying about cross-browser compatibility, and jQuery Mobile is a branch of this project specialized for mobile phones. You don't need to know any JavaScript or CSS to use these libraries; if you're happy with one of their display configuration, using these libraries is usually just a matter of including the right file links in your HTML's &lt;tt&gt;head&lt;/tt&gt; element and then setting certain attributes in your HTML elements to reference the libraries. &lt;/p&gt;&lt;p&gt;I began this application by creating an RDF/SPARQLMotion file in TopBraid Composer with a base URI of http://topbraidlive.org/mobileKennedys. I needed SPARQLMotion for the script that creates the static disk file version of the Kennedys display that we'll learn about next week. Next, I imported the kennedys.rdf model from the /TopBraid/Examples folder in the Navigator view. I also imported the SWP html.rdf and tui.rdf models from the Navigator's /TopBraid/UISPIN folder. (This all works the same when the files to import are Turtle ttl files instead of RDF/XML files.)&lt;/p&gt;&lt;p&gt;After importing the necessary files, the next step was to set up the display of data about a Person instance. After importing the files described above, clicking on kennedys:Person under owl:Thing on the Class view shows that the presence of the SWP libraries has added a ui:instanceView property to the kennedys:Person class form. I could have put the HTML to display a person here, like I did with the address book display in the blog entry mentioned above, but for greater flexibility, I created a separate PersonView class to store this markup and pointed at this class from the Person class's ui:instanceView value.&lt;/p&gt;&lt;p&gt;I created this mk:PersonView class (I had assigned the prefix "mk:" to the URI http://topbraidlive.org/mobileKennedys#) as a child of the ui:Element class, which is a child of the ui:Node class added by the SWP libraries. The ui:prototype property on this class's form is the place for the formatting code and markup, but I did a few setup steps before setting it:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;p&gt;Because the app needs to pass a parameter to the code in ui:prototype specifying which person to display, I had to define that parameter. To do this, I created an sp:person child of the sp:arg property in the Properties view to represent the person argument value passed to the prototype. Next,  I dragged the new property from the Properties view to the spin:constraint property name on the  mk:PersonView form to indicate that this would store the argument passed to the code and markup used to display a single person. This displays the "Create from SPIN template" wizard with all the values filled out the way I needed them, so I just clicked the OK button.&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;JQuery implements some of its magic with HTML extension attributes named &lt;tt&gt;data-collapsed&lt;/tt&gt; and &lt;tt&gt;data-role&lt;/tt&gt;. TopBraid Composer helps you assemble proper HTML by flagging any non-HTML markup, and it won't like these because they're not declared as HTML 4 properties. So, I declared them myself by making two clones of the html:class property (a subproperty of html:attributes) and renamed them html:data-collapsed and html:data-role. This way, TopBraid Composer wouldn't prevent me from saving HTML markup that used these properties as attributes.&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;When listing each person's property names and values (for example, Andrew Cuomo's year of birth and first name in the picture above), I certainly didn't want to list the full URI of each property name. Ideally, each property would have an rdfs:label value that I could display instead; if not, I thought it best to just show the local name of the property's URI. To make this easier, I created a new function called mk:bestName as a subclass of spin:Functions (itself a subclass of spin:Modules). I defined a spin:constraint of sp:arg1 for this function and then defined this spin:body for it:&lt;/p&gt;&lt;pre&gt;SELECT ?label&lt;br /&gt;WHERE {&lt;br /&gt;    BIND (spif:name(?arg1) AS ?name) .&lt;br /&gt;    BIND (IF(fn:contains(?name, ":"), afn:localname(?arg1), ?name) AS ?label) .&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;p&gt;mk:bestName is a good general-purpose function. It calls the SPIN spif:name function, which gets a resource's skos:prefLabel value if available or an rdfs:label value as a second choice. If neither is available, mk:bestName takes the local name of the URI or prefixed name that got returned.&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;Because members of the kennedys:Person class might have a kennedys:name value that I'd prefer the application to use if available, I declared a similar but more specialized function for the Kennedys data called mk:bestKennedyName. This is also as a subclass of spin:Functions, and has a spin:constraint of sp:arg1 and the following as a spin:body:&lt;/p&gt;&lt;pre&gt;SELECT ?label&lt;br /&gt;WHERE {&lt;br /&gt;    OPTIONAL {&lt;br /&gt;        ?arg1 kennedys:name ?kname .&lt;br /&gt;    } .&lt;br /&gt;    BIND (spif:name(?arg1) AS ?name) .&lt;br /&gt;    BIND (COALESCE(?kname, IF(fn:contains(?name, ":"), afn:localname(?arg1), ?name)) AS ?label) .&lt;br /&gt;}}&lt;br /&gt;&lt;/pre&gt;&lt;p&gt;This function body takes advantage of SPARQL 1.1's new &lt;a href="http://www.w3.org/TR/sparql11-query/#func-coalesce"&gt;&lt;tt&gt;COALESCE()&lt;/tt&gt;&lt;/a&gt; function, which returns the value of the first parameter passed to it that can be evaluated without an error.&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;With the functions, the HTML extensions, and the argument to pass to it all set up for the formatting markup in the mk:PersonView class, I was ready to add that markup and SPARQL code to the ui:prototype property of my new class. It's mostly HTML &lt;tt&gt;div&lt;/tt&gt; elements with attributes set according to the models I saw in the source of the &lt;a href="http://jquerymobile.com/demos/1.0/"&gt;jQuery Mobile demos&lt;/a&gt;. The "collapsible" part means that initially only the kennedys:name value will display, as an &lt;tt&gt;h3&lt;/tt&gt; element, and that clicking on that name (or, on a phone, touching it) will toggle the display of the remaining property names and values about that person.&lt;/p&gt;&lt;pre&gt;&amp;lt;div data-collapsed="true" data-role="collapsible"&amp;gt;&lt;br /&gt;   &amp;lt;h3&amp;gt;{= spl:object(?person, kennedys:name) }&amp;lt;/h3&amp;gt;&lt;br /&gt;   &amp;lt;div class="ui-grid-a"&amp;gt;&lt;br /&gt;       &amp;lt;ui:forEach ui:resultSet="{#&lt;br /&gt;               SELECT ?propertyName ?bestValueLabel&lt;br /&gt;               WHERE {&lt;br /&gt;                   ?person ?property ?value .&lt;br /&gt;                   BIND (mk:bestName(?property) AS ?propertyName) .&lt;br /&gt;                   BIND (IF(isIRI(?value), mk:bestKennedyName(?value), ?value)&lt;br /&gt;                      AS ?bestValueLabel) .&lt;br /&gt;               }&lt;br /&gt;               ORDER BY (?property) }"&amp;gt;&lt;br /&gt;           &amp;lt;div class="ui-block-a"&amp;gt;&lt;br /&gt;               &amp;lt;div class="ui-bar ui-bar-c"&amp;gt;{= ?propertyName }&amp;lt;/div&amp;gt;&lt;br /&gt;           &amp;lt;/div&amp;gt;&lt;br /&gt;           &amp;lt;div class="ui-block-b"&amp;gt;&lt;br /&gt;               &amp;lt;div class="ui-bar ui-bar-c"&amp;gt;{= ?bestValueLabel }&amp;lt;/div&amp;gt;&lt;br /&gt;           &amp;lt;/div&amp;gt;&lt;br /&gt;       &amp;lt;/ui:forEach&amp;gt;&lt;br /&gt;   &amp;lt;/div&amp;gt;&lt;br /&gt;&amp;lt;/div&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;p&gt;When you use SWP to define an HTML &lt;tt&gt;div&lt;/tt&gt; element with the data and markup to display something, the SWP engine will create &lt;tt&gt;html&lt;/tt&gt;, &lt;tt&gt;head&lt;/tt&gt;, and &lt;tt&gt;body&lt;/tt&gt; wrapper elements to ensure that a browser viewing the HTML gets a complete web page. The SWP ui:headIncludes property, which you'll see on the mk:PersonView class form with ui:prototype and the other properties there, lets you specify custom markup to add to the HTML &lt;tt&gt;head&lt;/tt&gt; element when the SWP engine sends the web page to the requesting browser. I added the following to this property; it has the &lt;tt&gt;meta&lt;/tt&gt;, &lt;tt&gt;link&lt;/tt&gt;, and &lt;tt&gt;script&lt;/tt&gt; elements necessary to make the resulting HTML a proper jQuery Mobile page:&lt;/p&gt;&lt;pre&gt;&amp;lt;ui:group&amp;gt;&lt;br /&gt;   &amp;lt;meta content="width=device-width, minimum-scale=1.0, maximum-scale=1.0"&lt;br /&gt;         name="viewport"/&amp;gt;&lt;br /&gt;   &amp;lt;link href="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.css"&lt;br /&gt;         rel="stylesheet"/&amp;gt;&lt;br /&gt;   &amp;lt;script src="http://code.jquery.com/jquery-1.6.4.min.js"/&amp;gt;&lt;br /&gt;   &amp;lt;script src="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.js"/&amp;gt;&lt;br /&gt;&amp;lt;/ui:group&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;p&gt;Then, going back to the kennedys:Person element, I added this ui:instanceView value for it to point at the mk:PersonView class I had created:&lt;/p&gt;&lt;pre&gt;&amp;lt;mk:PersonView sp:person="{= ?this }"/&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;p&gt;The &lt;tt&gt;?this&lt;/tt&gt; variable passes the Person instance currently being processed to be used as the &lt;tt&gt;?person&lt;/tt&gt; value in the SPARQL query in the mk:PersonView ui:prototype value.&lt;/p&gt;&lt;p&gt;This is all enough to display a single person, but I wanted to display all the Person instances in a sorted list. I attached this view's definition  to the ontology resource itself by clicking on the little house icon at the top of TopBraid Composer and then adding this ui:view value to it (note that ui:view wasn't already part of the form, so I dragged it on there from TopBraid Composer's Properties view): &lt;/p&gt;&lt;pre&gt;&amp;lt;div&amp;gt;&lt;br /&gt;   &amp;lt;div data-role="header"&amp;gt;&lt;br /&gt;       &amp;lt;h1&amp;gt;Kennedys List&amp;lt;/h1&amp;gt;&lt;br /&gt;   &amp;lt;/div&amp;gt;&lt;br /&gt;   &amp;lt;div data-role="collapsible-set"&amp;gt;&lt;br /&gt;       &amp;lt;ui:forEach ui:resultSet="{#&lt;br /&gt;               SELECT ?p&lt;br /&gt;               WHERE {&lt;br /&gt;                   ?p a kennedys:Person .&lt;br /&gt;                   ?p kennedys:lastName ?lname .&lt;br /&gt;               }&lt;br /&gt;               ORDER BY (?lname) }"&amp;gt;&lt;br /&gt;           &amp;lt;ui:resourceView ui:resource="{= ?p }"/&amp;gt;&lt;br /&gt;       &amp;lt;/ui:forEach&amp;gt;&lt;br /&gt;   &amp;lt;/div&amp;gt;&lt;br /&gt;&amp;lt;/div&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;p&gt;As with the code to display each individual Person instance, this markup is mostly &lt;tt&gt;div&lt;/tt&gt; elements with attribute settings based  on the source of the jQuery Mobile demos I saw. The ui:resourceView element inside the ui:forEach element tells the SWP engine to display the resource according to whatever view was specified for it. In this case, the resource is a kennedys:Person instance, because that's what the SPARQL here query binds to the &lt;tt&gt;?p&lt;/tt&gt; variable, so it will use the view defined earlier. &lt;/p&gt;&lt;p&gt;To test this, I sent a browser to the URL &lt;tt&gt;http://localhost:8083/tbl/uispin?_resource=http://topbraidlive.org/mobileKennedys&lt;/tt&gt;. (URLs for SPARQL Web Page applications often include a &lt;tt&gt;&amp;amp;_base&lt;/tt&gt; parameter to identify the graph of data to use—in this case, it would be &lt;tt&gt;&amp;amp;_base=http://topbraid.org/examples/kennedys&lt;/tt&gt;—but that was unnecessary here because one of the first steps of creating the mobileKennedys model was dragging the Kennedys data onto its Include tab, so it already knew which data to use.) The &lt;tt&gt;_resource&lt;/tt&gt; parameter tells it which resource to render, so I used my file's base URI here because that's where I attached the markup and SPARQL code to display the full web page. These and other parameters are described in the &lt;a href="http://uispin.org/ui.html"&gt;SWP documentation&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;This should work with any browser. (I recently discovered that picking User Agent from Safari's Develop menu lets you set Safari to emulate a variety of other browser, including the mobile versions that run on the iPhone and iPad, which helped me to debug some early problems I had with getting the jQuery Mobile code right.) Because you can't access TopBraid Composer's built-in copy of the TopBraid Live Personal edition from a different computer, there's no way for a phone's browser to access this application when running it on TopBraid Composer, so I uploaded the project storing this application to a copy of TopBraid Live to do the test shown in the photograph above.&lt;/p&gt;&lt;p&gt;Next week, I'll show how I extended this application to save a static HTML file of the mobile web display of Kennedys data as an alternative to the TopBraid Live server's dynamic display. I could then copy that file to a web server that doesn't necessarily have TopBraid Live installed on it. Then, any computer or phone web browser can display it. For a preview of how it looks, send your phone's browser to &lt;a href="http://www.topquadrant.com/resources/blog/k/"&gt;http://www.topquadrant.com/resources/blog/k/&lt;/a&gt;—or, if you want a shorter URL to type on your phone, &lt;a href="http://bit.ly/topqkm"&gt;http://bit.ly/topqkm&lt;/a&gt;.&lt;/p&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7507012841435012041-8911127236037391229?l=topquadrantblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://topquadrantblog.blogspot.com/feeds/8911127236037391229/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7507012841435012041&amp;postID=8911127236037391229' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default/8911127236037391229'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default/8911127236037391229'/><link rel='alternate' type='text/html' href='http://topquadrantblog.blogspot.com/2011/11/creating-topbraid-mobile-web-app-with.html' title='Creating a TopBraid mobile web app with SPARQL Web Pages'/><author><name>Bob DuCharme</name><uri>http://www.blogger.com/profile/02742075186312518829</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_13zlUS8aD_8/S0OhTCeBZ8I/AAAAAAAAAAM/cGInR6wDS84/S220/128x128.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7507012841435012041.post-6159401904537030779</id><published>2011-09-30T10:32:00.000-07:00</published><updated>2011-09-30T17:45:41.572-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OWL'/><category scheme='http://www.blogger.com/atom/ns#' term='SPARQL'/><category scheme='http://www.blogger.com/atom/ns#' term='modeling'/><category scheme='http://www.blogger.com/atom/ns#' term='RDF'/><title type='text'>Ontologies and Data Models – are they the same?</title><content type='html'>Yesterday a question about how ontologies may be different from logical data models was asked by a newcomer on &lt;a href="http://groups.google.com/group/topbraid-users"&gt;TopBraid Users Forum&lt;/a&gt;. As to be expected on the TopBraid Forum, by ontologies he meant specifically ontology models expressed in RDFS/OWL. Because we frequently hear this or similar questions in our trainings, workshops and in conversations with customers, I decided to respond in a blog post instead of writing an e-mail.&lt;br /&gt;&lt;br /&gt;Data modeling was invented more than thirty years ago to help with the design of databases, specifically, relational databases.  As quoted below, ANSI definition from 1975 differentiated between three data models – conceptual, logical and physical. Data modeling quickly became recognized as a tool for analyzing the semantics of an organization with the respect to the structure and flow of the information used in carrying out organization’s activities. Wikipedia offers the following definition of &lt;a href="http://en.wikipedia.org/wiki/Data_modeling"&gt;Data Modeling&lt;/a&gt;:&lt;br /&gt;&lt;blockquote style="background-color: #d0e0e3;"&gt;&lt;span style="font-size: x-small;"&gt;Data modeling is a method used to define and analyze data requirements needed to support the business processes of an organization. The data requirements are recorded as a conceptual data model with associated data definitions. Actual implementation of the conceptual model is called a logical data model. &lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: x-small;"&gt;&amp;lt;…&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: x-small;"&gt;In 1975 ANSI described three kinds of data-model instance:&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-size: x-small;"&gt;Conceptual schema: describes the semantics of a domain (the scope of the model). For example, it may be a model of the interest area of an organization or of an industry. This consists of entity classes, representing kinds of things of significance in the domain, and relationships assertions about associations between pairs of entity classes. A conceptual schema specifies the kinds of facts or propositions that can be expressed using the model. In that sense, it defines the allowed expressions in an artificial "language" with a scope that is limited by the scope of the model.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: x-small;"&gt;Logical schema: describes the structure of some domain of information. This consists of descriptions of (for example) tables, columns, object-oriented classes, and XML tags.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: x-small;"&gt;Physical schema: describes the physical means used to store data. This is concerned with partitions, CPUs, tablespaces, and the like.&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-size: x-small;"&gt;According to ANSI, this approach allows the three perspectives to be relatively independent of each other. Storage technology can change without affecting either the logical or the conceptual model. The table/column structure can change without (necessarily) affecting the conceptual model.&lt;/span&gt;&lt;/blockquote&gt;These definitions describe a clear progression from conceptual to logical to physical data models. SInce their origin is in the 70s, they reflect certain technology assumptions than no longer hold true.&lt;br /&gt;&lt;br /&gt;When information modeling is done to create a relational database, conceptual model must be different from a logical model because there is no place in a relational database structure to capture, for example, business rules, create subsumtion relationships and describe other key aspects of a conceptual model. This semantic information collected and documented as part of the initial modeling is left behind when modelers and designers move on to define a logical data model. The "left behind" parts are used by software developers as they encode business semantics directly into custom programs.&lt;br /&gt;&lt;br /&gt;Logical data model is a subset of a conceptual model that can be expressed using a particular technology. However, there are always some performance considerations that require additional changes to the logical data model before it can be implemented in a relational database. Hence, some of the aspects of a logical model are left behind as it gets translated into a physical data model.&lt;br /&gt;&lt;br /&gt;Since an ontology is a model of a domain describing objects that inhabit it, all three types of data models can be thought of as ontologies. They range from the most expressive one that describes business concepts and processes (the conceptual model) to less expressive and progressively moving from describing business semantics to describing physical structures of the data as it is stored in the databases (the logical and physical data model). Physical model can be thought of as an ontology of a particular database. Wikipedia goes on to note &lt;br /&gt;&lt;blockquote style="background-color: #d0e0e3;"&gt;&lt;span style="font-size: x-small;"&gt;Early phases of many software-development projects emphasize the design of a conceptual data model. Such a design can be detailed into a logical data model. In later stages, this model may be translated into physical data model. &lt;i&gt;&lt;b&gt;However, it is also possible to implement a conceptual model directly.&lt;/b&gt;&lt;/i&gt;&lt;/span&gt;&lt;/blockquote&gt;Semantic Web standards (governed by the W3C, the World Wide Web Consortium) make it possible to implement conceptual models &lt;b&gt;directly&lt;/b&gt;. This is possible due to the layered architecture of the Semantic Web technology stack consisting of:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;RDF –&lt;/span&gt; a canonical data model that is like relational data model in its ability to connect related objects and unlike relational data model in that the data objects (or resources in RDF-speak) are highly granular. &lt;/li&gt;&lt;/ul&gt;&lt;div style="background-color: #fff2cc;"&gt;The smallest unit of information in RDF is not a table or a row in a table, but individual statements – a single fact about a resource.&amp;nbsp;&lt;/div&gt;&lt;div style="background-color: #fff2cc;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="background-color: #fff2cc;"&gt;These statements are called RDF triples. For example, “&lt;i&gt;Atlantis decommission-date July, 2011&lt;/i&gt;” is a triple where &lt;i&gt;Atlantis&lt;/i&gt; is a subject of a triple, &lt;i&gt;decommission date&lt;/i&gt; is a predicate of a triple and &lt;i&gt;July, 2011&lt;/i&gt; is an object of a triple. &lt;i&gt;Atlantis&lt;/i&gt; and &lt;i&gt;decommission date&lt;/i&gt; are RDF resources and &lt;i&gt;July, 2011&lt;/i&gt; is XML literal. Subjects and predicates of a triple are always RDF resources. An object can be either a resource or a literal value. Predicates that connect two resources are relationships or associations in the data modeling speak. Predicates connecting a resource to a literal value are attributes. In RDF they are called respectively object and data properties.&lt;/div&gt;&lt;div style="background-color: #fff2cc;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="background-color: #fff2cc;"&gt;Because RDF model is highly canonical, RDF data is schema-less. There are no constraints that require it to fit into tables or hierarchies. RDF data is simply a network of connected triples. As such, it can be used to represent, if needed, both - table structures and hierarchies. Standard mappings have been defined from relational tables and XML hierarchies into RDF.&lt;/div&gt;&lt;div style="background-color: #fff2cc;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="background-color: #fff2cc;"&gt;Another key differentiating factor of RDF is that it was “born on the web”. Each RDF resource has a globally unique identity, a URI (uniform resource identifier).  For example, the URI for Atlantis may be http://www.nasa.gov/shuttle/Atlantis and the URI for a decommission date may be http://www.nasa.gov/lifecycle#decommissionDate . As a result, it is possible to link RDF data over web in a way similar to how documents can be hyperlinked over the web. By web we mean all HTTP based networks including intranets and extranets.&lt;/div&gt;&lt;div style="background-color: #fff2cc;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="background-color: #fff2cc;"&gt;RDF databases store and provide query access to RDF data. Just like there are standard languages for query of relational and XML data, there is a standard for querying RDF. It is called &lt;a href="http://www.w3.org/TR/rdf-sparql-query/"&gt;SPARQL&lt;/a&gt;. True to the web-native nature of RDF, SPARQL is not only a query language, but also a protocol that makes it possible to access RDF data over HTTP.&lt;/div&gt;&lt;ul&gt;&lt;li&gt;&lt;b&gt;RDFS (RDF Schema) and OWL (Web Ontology Language) &lt;/b&gt;– RDF-based languages for expressing business semantics.&lt;/li&gt;&lt;/ul&gt;&lt;div style="background-color: #fff2cc;"&gt;Jointly RDFS and OWL offer ability to define classes or groups of resources that share common characteristics such as Vehicles and Space Shuttles. The richness of RDFS/OWL makes it possible to fully express the meaning of the business concepts. Data models in RDFS/OWL are stored in the same way as the data, in RDF triples. For example, we can have triples stating that &lt;i&gt;Space Shuttle&lt;/i&gt; is a &lt;i&gt;Class&lt;/i&gt; and it is a sub class of a &lt;i&gt;Vehicle&lt;/i&gt; class and that a vehicle can have only one decommission date (cardinality = 1) and its value must be xsd:date. And you can go beyond cardinality and use the Semantic Web standards to represent a variety of business rules.&lt;/div&gt;&lt;div style="background-color: #fff2cc;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="background-color: #fff2cc;"&gt;Since the data and the schema are stored in the same way, it is possible to query schemas the same way data is queried and to combine search criteria about schemas with the search criteria about data. For example, we can create SPARQL queries to ask for all vehicles that have been decommissioned, all subclasses of a vehicle class, all relationships and attributes a vehicle should have and, when returning decommissioned vehicles, to provide only data values for the fields that have cardinality = 1.&lt;/div&gt;&lt;div style="background-color: #fff2cc;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="background-color: #fff2cc;"&gt;The use of RDF means that the modeling constructs and definitions can be linked and connected. Organizations can refer to each other’s business definitions. Models can be modularized and re-used where appropriate. Differences between related, but not identical concepts can be described. All of this can now be done in a standard compliant and interoperable way.&lt;/div&gt;&lt;br /&gt;A growing number of standards bodies and communities of interest are publishing RDF/OWL data models for their particular domains. For example:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.w3.org/2009/08/skos-reference/skos.html"&gt;SKOS&lt;/a&gt;  – provides a way to represent taxonomies and thesauri&lt;/li&gt;&lt;li&gt;&lt;a href="http://en.wikipedia.org/wiki/ISO_15926%20"&gt;ISO 15926&lt;/a&gt; – offers a data model for sharing life-cycle data for process plants including oil and gas production facilities &lt;/li&gt;&lt;li&gt;&lt;a href="http://www.w3.org/TR/mediaont-10/"&gt;Ontology for Media Resources&lt;/a&gt; - defines a core set of metadata properties for multimedia resources&lt;/li&gt;&lt;li&gt;&lt;a href="http://sioc-project.org/ontology"&gt;SIOC&lt;/a&gt; - defines information about online communities&lt;/li&gt;&lt;li&gt;&lt;a href="http://qudt.org/"&gt;QUDT&lt;/a&gt; - provides models describing measurable quantities, units for measuring different kinds of quantities and the data types used to store and manipulate these objects in software&lt;/li&gt;&lt;li&gt;&lt;a href="http://trdf.sourceforge.net/provenance/ns.html"&gt;Provenance Vocabulary&lt;/a&gt; - defines provenance-related metadata&lt;/li&gt;&lt;/ul&gt;There is much more that can be added to this post including a discussion on the best practices for ontology modeling, ontology architecture, approaches for connecting and mapping models, using rules and constraints, publishing, versioning and governing models. Each of these topics, however, deserves an exploration in its own right.&lt;br /&gt;&lt;br /&gt;I will end by pointing to a few relevant related blogs and web pages we have published before:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;How to extend an ontology &lt;a href="http://topquadrantblog.blogspot.com/2011/03/how-to-extend-ontology.html"&gt;http://topquadrantblog.blogspot.com/2011/03/how-to-extend-ontology.html &lt;/a&gt;&lt;/li&gt;&lt;li&gt;Ontology Mapping with SPINMap &lt;a href="http://topquadrantblog.blogspot.com/search/label/SPINMap"&gt;http://topquadrantblog.blogspot.com/search/label/SPINMap&lt;/a&gt; &lt;/li&gt;&lt;li&gt;Training on RDF, OWL and ontology modeling &lt;a href="http://www.topquadrant.com/training/training_overview.html"&gt;http://www.topquadrant.com/training/training_overview.html &lt;/a&gt;&lt;/li&gt;&lt;li&gt;Transforming XML Schemas and XML into RDF/OWL &lt;a href="http://topquadrantblog.blogspot.com/2011/09/living-in-xml-and-owl-world.html"&gt;http://topquadrantblog.blogspot.com/2011/09/living-in-xml-and-owl-world.html &lt;/a&gt;&lt;/li&gt;&lt;li&gt;Converting UML models to OWL&lt;a href="http://www.blogger.com/goog_1739819784"&gt; &lt;/a&gt;&lt;a href="http://topquadrantblog.blogspot.com/2011/02/converting-uml-models-to-owl-part-1.html"&gt;http://topquadrantblog.blogspot.com/2011/02/converting-uml-models-to-owl-part-1.html &lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7507012841435012041-6159401904537030779?l=topquadrantblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://topquadrantblog.blogspot.com/feeds/6159401904537030779/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7507012841435012041&amp;postID=6159401904537030779' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default/6159401904537030779'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default/6159401904537030779'/><link rel='alternate' type='text/html' href='http://topquadrantblog.blogspot.com/2011/09/ontologies-and-data-models-are-they.html' title='Ontologies and Data Models – are they the same?'/><author><name>Irene Polikoff</name><uri>http://www.blogger.com/profile/17834271916697741738</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7507012841435012041.post-7860518698041260186</id><published>2011-09-28T23:03:00.000-07:00</published><updated>2011-09-29T16:46:35.540-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OWL'/><category scheme='http://www.blogger.com/atom/ns#' term='topbraid'/><category scheme='http://www.blogger.com/atom/ns#' term='SPARQL'/><category scheme='http://www.blogger.com/atom/ns#' term='XSD'/><category scheme='http://www.blogger.com/atom/ns#' term='XML'/><category scheme='http://www.blogger.com/atom/ns#' term='RDF'/><title type='text'>Living in the XML and OWL World - Comprehensive Transformations of XML Schemas and XML data to RDF/OWL</title><content type='html'>&lt;div&gt;&lt;link href="http://www.linkedmodels.org/styles/blog-styles.css" rel="stylesheet" type="text/css"/&gt; &lt;link rel="stylesheet" type="text/css" href="http://www.w3.org/TR/rdf-sparql-query/local.css" /&gt;&lt;script type="text/javascript"&gt; var newwindow; function diagramPopUp(url) newwindow=window.open(url,'name','height=600,width=1000,left=50,top=50,resizable=yes,scrollbars=yes,toolbar=no,status=yes'); if (window.focus) {newwindow.focus()} &lt;/script&gt;&lt;p&gt;Many enterprise information models are expressed using XML Schemas. Data between applications is commonly exchanged in XML, compliant with those schemas. Connecting XML data from different systems in a coherent aggregated way is a challenge that confronts many organizations. Capabilities of RDF/OWL to describe semantics of different data models and aggregate disparate data are a natural fit for addressing these challenges.&lt;/p&gt;&lt;p&gt;For a number of years now, &lt;a href="http://www.topquadrant.com/products/TB_Composer.html"&gt;TopBraid Composer&lt;/a&gt; included the ability to convert XSDs and associated XML files to RDF/OWL. However, for some XML Schemas our converter did not work as well as customers needed. For the upcoming TopBraid Composer 3.6.0 release, it was significantly improved to have a more comprehensive coverage of XSD constructs and more meaningful conversion to OWL. In parallel, we improved our XML data conversion to RDF so that transformations automatically happen based on the generated OWL models. And we have improved performance of the transformations.&lt;/p&gt;&lt;p&gt;An overview of the approach is illustrated in the following figure:&lt;/p&gt;&lt;a href="http://www.linkedmodels.org/images/xsd2owl/xsd-xml-to-owl-approach.png" onclick="diagramPopUp(this.href); return false;"&gt; &lt;img src="http://www.linkedmodels.org/images/xsd2owl/xsd-xml-to-owl-approach.png" alt="Approach" class="center" width="500 px;" height="327 px;" /&gt; &lt;/a&gt;&lt;p&gt;Since, the conversion occurs automatically, users do not have to worry about writing any rules for commonly needed mappings. However, those users that need to make further transformations can use &lt;a href="http://www.spinrdf.org"&gt;SPARQL Rules&lt;/a&gt; and &lt;a href="http://topquadrant.com/products/SPARQLMotion.html"&gt;SPARQLMotion&lt;/a&gt; to customize their generated OWL ontology or further transform RDF triples representing the XML data.&lt;/p&gt;&lt;p&gt;The content of this blog is organized as follows:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="#xml-schemas-converted-as-part-of-our-tests"&gt;XML Schemas converted as part of our tests&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="#some-challenges-in-converting-xml-schemas-to-owl"&gt;Some challenges in converting XML Schemas to OWL&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="#illustrative-example-of-transformation-rules"&gt;Illustrative example of transformation rules&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="#another-example-of-transformation-rules"&gt;Another example of transformation rules&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="#complete-table-of-supported-transformations"&gt;Complete table of supported transformations&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="#a-sparql-metric-query"&gt;A SPARQL Metric Query&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="#concluding-remarks"&gt;Concluding remarks&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h3 id="xml-schemas-converted-as-part-of-our-tests"&gt;&lt;a href="#TOC"&gt;XML Schemas converted as part of our tests&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;We tested the importer on a broad range of complicated and large-scale industry standard XSD files, and converted many XML instances with impressive results. The XSDs we have tested with the new importer include:&lt;/p&gt;&lt;ol&gt;&lt;br /&gt;&lt;li&gt;Banking&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.fpml.org/"&gt;FpML&lt;/a&gt;, the Financial products Markup Language&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.iso20022.org/"&gt;ISO 20022&lt;/a&gt;, a standard for Universal financial industry message scheme&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Energy and Utilities&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.multispeak.org/Pages/default.aspx"&gt;MultiSpeak&lt;/a&gt;, de-facto standard for defining data needed to be exchanged between software applications in order to support the business processes commonly applied at utilities&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Government&lt;ul&gt;&lt;li&gt;&lt;a href="http://cio-nii.defense.gov/sites/dodaf20/"&gt;DoDAF&lt;/a&gt;, the Department of Defense Architecture Framework&lt;/li&gt;&lt;li&gt;&lt;a href="https://www.niem.gov/"&gt;NIEM&lt;/a&gt;, the U.S. National Information Exchange Model&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Oil and Gas&lt;ul&gt;&lt;li&gt;&lt;a href="http://15926.org/home/tiki-index.php/"&gt;ISO 15926&lt;/a&gt;, a standard for integration of life-cycle data for process plants including oil and gas production facilities&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.energistics.org/witsml-standard/"&gt;WITSML&lt;/a&gt;, Wellsite Information Transfer Standard Markup Language&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Healthcare&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.hl7.org/"&gt;HL7&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Electronics&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.accellera.org/activities/ip-xact/"&gt;IP-XACT&lt;/a&gt;, the XML Schema for meta-data documenting Intellectual Property (IP) used in the development, implementation and verification of electronic systems&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Other&lt;ul&gt;&lt;li&gt;&lt;a href="http://zone.ni.com/devzone/cda/tut/p/id/3893"&gt;ATML&lt;/a&gt;, the Auto-Test Markup Language&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;Some of the converted schemas will be published at &lt;a href="http://linkedmodels.org/"&gt;LinkedModels.org&lt;/a&gt;. To get an early access to converted models or for any other questions, contact us at TopQuadrant.&lt;/p&gt;&lt;p&gt;The examples we use in this blog are mainly from the Financial products Markup Language (FpML). All FpML 5.2 XSD and XML instance files were tested. An example is transparency standard under FpML, for which the &lt;code&gt;transparency.ttl&lt;/code&gt; ontology was generated from 23 XSD files.&lt;/p&gt;&lt;br /&gt;&lt;h3 id="some-challenges-in-converting-xml-schemas-to-owl"&gt;&lt;a href="#TOC"&gt;Some challenges in converting XML Schemas to OWL&lt;/a&gt;&lt;/h3&gt;&lt;br /&gt;&lt;p&gt;Some of the challenges in converting XSD to OWL that were addressed are:&lt;/p&gt;&lt;ol&gt;&lt;li&gt;Transforming of anonymous types&lt;/li&gt;&lt;li&gt;Converting complex types with simple contents&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Resolving conflicting nested element and attribute names during OWL property generation&lt;/li&gt;&lt;br /&gt;&lt;li&gt;When and how to distinquish global elements from complex types with similar names during OWL class generation&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Generating enumerations&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Handling substitution groups both at the XSD and XML levels&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Handling the overriding of an XSD type with &lt;code&gt;xsi:type&lt;/code&gt; in XML&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;The example that follows shows the approaches that we have used for the transformation.&lt;/p&gt;&lt;h3 id="illustrative-example-of-transformation-rules"&gt;&lt;a href="#TOC"&gt;Illustrative example of transformation rules&lt;/a&gt;&lt;/h3&gt;&lt;br /&gt;&lt;p&gt;The basic transform for a Complex Type in XSD follows these rules:&lt;/p&gt;&lt;ol&gt;&lt;br /&gt;&lt;li&gt;An OWL class is generated for a complex type.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;The URI of the class is generated in three different ways. If the complex type is global and named, then the &lt;code&gt;name&lt;/code&gt; attribute is used. If the complex type is local and named, then the &lt;code&gt;name&lt;/code&gt; attribute of the owner element is used. If the complex type is anonymous, then the names of its owner element and its parent element are used.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;The &lt;code&gt;xsd:annotation&lt;/code&gt; and attribute annotations describing the complex type get generated as &lt;code&gt;dc:description&lt;/code&gt;, &lt;code&gt;rdfs:comment&lt;/code&gt; and/or &lt;code&gt;skos:definition&lt;/code&gt; OWL annotations.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Nested or reference children elements of the complex type become OWL allValuesFrom restrictions on the class. If the element has a simple type, then a restriction with an OWL datatype property and an XSD datatype range or a user-defined RDFS datatype range is generated. If the element has a complex type, then a restriction with an OWL object property and an OWL class range is generated. The &lt;code&gt;minOccurs&lt;/code&gt; and &lt;code&gt;maxOccurs&lt;/code&gt; values become OWL cardinality restrictions.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Element group and attribute group references are generated as super classes.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Attributes become restrictions with an OWL datatype property and an XSD datatype range or a user-defined RDFS datatype range.&lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;&lt;p&gt;An example of a Complex Type, &lt;code&gt;Trade&lt;/code&gt;, in fpml-doc-5-2.xsd of transparency standard is displayed below:&lt;/p&gt;&lt;br /&gt;&lt;pre class="smallXmlBlock"&gt;&amp;lt;xsd:complexType name=&amp;quot;Trade&amp;quot;&amp;gt;&lt;br /&gt;  &amp;lt;xsd:annotation&amp;gt;&lt;br /&gt;    &amp;lt;xsd:documentation xml:lang=&amp;quot;en&amp;quot;&amp;gt;&lt;br /&gt;    A type defining an FpML trade.&amp;lt;/xsd:documentation&amp;gt;&lt;br /&gt;  &amp;lt;/xsd:annotation&amp;gt;&lt;br /&gt;  &amp;lt;xsd:sequence&amp;gt;&lt;br /&gt;    &amp;lt;xsd:element name=&amp;quot;tradeHeader&amp;quot; type=&amp;quot;TradeHeader&amp;quot;&amp;gt;&lt;br /&gt;      &amp;lt;xsd:annotation&amp;gt;&lt;br /&gt;        &amp;lt;xsd:documentation xml:lang=&amp;quot;en&amp;quot;&amp;gt;&lt;br /&gt;         The information on the trade which is not &lt;br /&gt;         product specific, e.g. trade date.&lt;br /&gt;         &amp;lt;/xsd:documentation&amp;gt;&lt;br /&gt;      &amp;lt;/xsd:annotation&amp;gt;&lt;br /&gt;    &amp;lt;/xsd:element&amp;gt;&lt;br /&gt;    &amp;lt;xsd:group ref=&amp;quot;TradeEconomics.model&amp;quot;&amp;gt;&lt;br /&gt;      &amp;lt;xsd:annotation&amp;gt;&lt;br /&gt;        &amp;lt;xsd:documentation xml:lang=&amp;quot;en&amp;quot;&amp;gt;&lt;br /&gt;        The economics of the trade. In the case of an &lt;br /&gt;        OTC trade, this is the OTC derivative product.&lt;br /&gt;        In the case of a trade of a security,&lt;br /&gt;        it is the instrument trade economoics.&lt;br /&gt;        &amp;lt;/xsd:documentation&amp;gt;&lt;br /&gt;      &amp;lt;/xsd:annotation&amp;gt;&lt;br /&gt;    &amp;lt;/xsd:group&amp;gt;&lt;br /&gt;  &amp;lt;/xsd:sequence&amp;gt;&lt;br /&gt;  &amp;lt;xsd:attribute name=&amp;quot;id&amp;quot; type=&amp;quot;xsd:ID&amp;quot; /&amp;gt;&lt;br /&gt;&amp;lt;/xsd:complexType&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;p&gt;The following is the graph of the OWL class generated for &lt;code&gt;Trade&lt;/code&gt; complex type, which shows the OWL class, restrictions, annotations and superclass.&lt;/p&gt;&lt;br /&gt;&lt;a href="http://www.linkedmodels.org/images/xsd2owl/trade-graph.png" onclick="diagramPopUp(this.href); return false;"&gt; &lt;img src="http://www.linkedmodels.org/images/xsd2owl/trade-graph.png" alt="Trade Graph" class="center" width="600 px;" height="248 px;" /&gt; &lt;/a&gt;&lt;br /&gt;&lt;p&gt;The following class diagram shows a more sophisticated view of &lt;code&gt;Trade&lt;/code&gt; and its related classes downstream in the generated ontology (click on the diagram to open a window with a bigger image).&lt;/p&gt;&lt;br /&gt;&lt;a href="http://www.linkedmodels.org/images/xsd2owl/trade-schema-example.png" onclick="diagramPopUp(this.href); return false;"&gt; &lt;img src="http://www.linkedmodels.org/images/xsd2owl/trade-schema-example.png" alt="Trade Class Diagram" class="center" width="600 px;" height="331 px;" /&gt; &lt;/a&gt;&lt;br /&gt;&lt;p&gt;The diagram highlights these advanced features in generation:&lt;/p&gt;&lt;br /&gt;&lt;ol style="list-style-type: decimal"&gt;&lt;br /&gt;&lt;li&gt;A superclass relation exists between &lt;code&gt;Trade&lt;/code&gt;, generated from an XSD complex type and &lt;code&gt;TradeEconomics.model&lt;/code&gt;, generated from an XSD element group.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;In the XSD, &lt;code&gt;Swap&lt;/code&gt; element has the substitutionGroup &lt;code&gt;Product&lt;/code&gt; element. Thus, &lt;code&gt;A_Global-Swap&lt;/code&gt; becomes a subclass of &lt;code&gt;A_Global-Product&lt;/code&gt;. &lt;code&gt;A_Global-&lt;/code&gt; prefix is used to distinguish the element-derived classes from similarly named complex-type-derived classes.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;code&gt;dtype:value&lt;/code&gt; restrictions are generated to hold the simple contents occuring in complex types. The complex content part of the type become other restrictions.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;The generated object properties have a &lt;code&gt;Ref&lt;/code&gt; suffix to distinguish them from datatype properties with same names. Both types of properties can be used in restrictions on different classes as they may be generated from nested or reference children elements under different complex types.&lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;&lt;p&gt;The instance file, &amp;quot;msg_ex001_new_trade.xml&amp;quot; was imported into the transparency ontology. Here is a peek into that XML file:&lt;/p&gt;&lt;br /&gt;&lt;pre class="smallXmlBlock"&gt;...&lt;br /&gt;&amp;lt;trade&amp;gt;&lt;br /&gt;&amp;lt;tradeHeader&amp;gt;&lt;br /&gt;  &amp;lt;partyTradeIdentifier&amp;gt;&lt;br /&gt;    &amp;lt;tradeId tradeIdScheme=&lt;br /&gt;        &amp;quot;http://fpml.org/universal_swap_id&amp;quot;&amp;gt;123&amp;lt;/tradeId&amp;gt;&lt;br /&gt;    &amp;lt;tradeId tradeIdScheme=]&lt;br /&gt;        &amp;quot;http://fpml.org/submitter_trade_id&amp;quot;&amp;gt;456&amp;lt;/tradeId&amp;gt;&lt;br /&gt;  &amp;lt;/partyTradeIdentifier&amp;gt;&lt;br /&gt;  &amp;lt;tradeInformation&amp;gt;&lt;br /&gt;    ...&lt;br /&gt;    &amp;lt;cleared&amp;gt;true&amp;lt;/cleared&amp;gt;&lt;br /&gt;    &amp;lt;nonStandardTerms&amp;gt;false&amp;lt;/nonStandardTerms&amp;gt;&lt;br /&gt;    &amp;lt;offMarketPrice&amp;gt;false&amp;lt;/offMarketPrice&amp;gt;&lt;br /&gt;    &amp;lt;largeSizeTrade&amp;gt;false&amp;lt;/largeSizeTrade&amp;gt;&lt;br /&gt;    ...&lt;br /&gt;  &amp;lt;/tradeInformation&amp;gt;&lt;br /&gt;  &amp;lt;tradeDate&amp;gt;2011-02-04&amp;lt;/tradeDate&amp;gt;&lt;br /&gt;&amp;lt;/tradeHeader&amp;gt;&lt;br /&gt;&amp;lt;swap&amp;gt;&lt;br /&gt;  &amp;lt;productType&amp;gt;InterestRateSwap&amp;lt;/productType&amp;gt;&lt;br /&gt;  &amp;lt;assetClass&amp;gt;InterestRates&amp;lt;/assetClass&amp;gt;&lt;br /&gt;  &amp;lt;swapStream&amp;gt;&lt;br /&gt;   ...&lt;br /&gt;  &amp;lt;/swapStream&amp;gt;&lt;br /&gt;  &amp;lt;swapStream&amp;gt;&lt;br /&gt;    ...&lt;br /&gt;  &amp;lt;/swapStream&amp;gt;&lt;br /&gt;&amp;lt;/swap&amp;gt;&lt;br /&gt;&amp;lt;/trade&amp;gt;&lt;br /&gt;...&lt;/pre&gt;&lt;p&gt;The above XML constructs were mapped into the following RDF graph, where you can see how the instances, their relationships and their types are generated with respect to the &lt;code&gt;Trade&lt;/code&gt; class diagram (click on the graph to open up a window for a more detailed view).&lt;/p&gt;&lt;br /&gt;&lt;a href="http://www.linkedmodels.org/images/xsd2owl/trade-instance-example.png" onclick="diagramPopUp(this.href); return false;"&gt; &lt;img src="http://www.linkedmodels.org/images/xsd2owl/trade-instance-example.png" alt="Trade Instance Example" class="center" width="600 px;" height="340 px;" /&gt; &lt;/a&gt;&lt;br /&gt;&lt;h3 id="another-example-of-transformation-rules"&gt;&lt;a href="#TOC"&gt;Another example of transformation rules&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;The basic transform for an Enumeration in XSD follows these rules:&lt;/p&gt;&lt;ol&gt;&lt;li&gt;An OWL class is generated from an XSD simple type having XSD enumeration facets. The localname of the class has &lt;code&gt;Enum&lt;/code&gt; suffix to distinguish it from classes generated with similar names.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;This class becomes a subclass of &lt;code&gt;EnumeratedValue&lt;/code&gt; in the same namespace as the OWL class, which itself becomes a subclass of &lt;code&gt;dtype:EnumeratedValue&lt;/code&gt;.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Each XSD enumeration facet becomes an instance of the generated class. &lt;code&gt;dtype:value&lt;/code&gt; holds the enumeration value. &lt;code&gt;dtype:order&lt;/code&gt; is the order in which the enumeration facet occurs.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;An &lt;code&gt;Enumeration&lt;/code&gt; class in the same namespace as the OWL class is also generated. This class becomes subclass of &lt;code&gt;dtype:Enumeration&lt;/code&gt;. An instance of this class is generated as a container to refer to all the instances generated from the current simple type.&lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;&lt;p&gt;Enumerated value instance URIs are generated using a concatenation of the abbreviation of the class localname's upper case letters and the &lt;code&gt;dtype:value&lt;/code&gt; literal.&lt;/p&gt;&lt;p&gt;The following figure shows a graph for &lt;code&gt;PremiumQuoteBasisEnum&lt;/code&gt; class and the OWL constructs generated from the related XSD enumeration facets (click on the diagram to open a window with a bigger image):&lt;/p&gt;&lt;a href="http://www.linkedmodels.org/images/xsd2owl/trade-enumeration-example.png" onclick="diagramPopUp(this.href); return false;"&gt; &lt;img src="http://www.linkedmodels.org/images/xsd2owl/trade-enumeration-example.png" alt="Trade Instance Example" class="center" width="600 px;" height="340 px;" /&gt; &lt;/a&gt;&lt;h3 id="complete-table-of-supported-transformations"&gt;&lt;a href="#TOC"&gt;Complete table of supported transformations&lt;/a&gt;&lt;/h3&gt;&lt;br /&gt;&lt;p&gt;For the reader interested in more details a full overview of the mapping transformations is given in the following table:&lt;/p&gt;&lt;br /&gt;&lt;table class="sample"&gt;&lt;CAPTION&gt;&lt;EM&gt;Table: Conversion from XSD Constructs to OWL Constructs&lt;/EM&gt;&lt;/CAPTION&gt;&lt;tr&gt;&lt;th class="order"&gt;#&lt;/th&gt;&lt;th class="xsd-constructs"&gt;XSD/XML Constructs&lt;/th&gt;&lt;th class="owl-constructs"&gt;OWL Constructs&lt;/th&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;1&lt;/td&gt;&lt;td&gt;&lt;code&gt;xsd:simpleType&lt;/code&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;owl:Datatype&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;2&lt;/td&gt;&lt;td&gt;&lt;code&gt;xsd:simpleType&lt;/code&gt; with &lt;code&gt;xsd:enumeration&lt;/code&gt;&lt;/td&gt;&lt;td&gt;Becomes an &lt;code&gt;owl:Class&lt;/code&gt; as a subclass of &lt;code&gt;EnumeratedValue&lt;/code&gt;. Instances are created for every enumerated value. An instance of &lt;code&gt;Enumeration&lt;/code&gt;, referring to all the instances, is created as well as the &lt;code&gt;owl:oneOf&lt;/code&gt; union over the instances.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;3&lt;/td&gt;&lt;td&gt;&lt;code&gt;xsd:complexType&lt;/code&gt; over &lt;code&gt;xsd:complexContent&lt;/code&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;owl:Class&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;4&lt;/td&gt;&lt;td&gt;&lt;code&gt;xsd:complexType&lt;/code&gt; over &lt;code&gt;xsd:simpleContent&lt;/code&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;owl:Class&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;5&lt;/td&gt;&lt;td&gt;&lt;code&gt;xsd:element&lt;/code&gt; (global) with complex type&lt;/td&gt;&lt;td&gt;&lt;code&gt;owl:Class&lt;/code&gt; and subclass of the class generated from the referenced complex type&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;6&lt;/td&gt;&lt;td&gt;&lt;code&gt;xsd:element&lt;/code&gt; (global) with simple type&lt;/td&gt;&lt;td&gt;&lt;code&gt;owl:Datatype&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;7&lt;/td&gt;&lt;td&gt;&lt;code&gt;xsd:element&lt;/code&gt; (local to a type)&lt;/td&gt;&lt;td&gt;&lt;code&gt;owl:DatatypeProperty&lt;/code&gt; or &lt;code&gt;owl:ObjectProperty&lt;/code&gt; depending on the element type. OWL Restrictions are built for the occurrence.&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;8&lt;/td&gt;&lt;td&gt;&lt;code&gt;xsd:group&lt;/code&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;owl:Class&lt;/code&gt; and subclass of &lt;code&gt;A_AbstractElementGroup&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;9&lt;/td&gt;&lt;td&gt;&lt;code&gt;xsd:attributeGroup&lt;/code&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;owl:Class&lt;/code&gt; and subclass of &lt;code&gt;A_AbstractAttributeGroup&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;10&lt;/td&gt;&lt;td&gt;&lt;code&gt;xsd:minOccurs&lt;/code&gt; and &lt;code&gt;xsd:maxOccurs&lt;/code&gt;&lt;/td&gt;&lt;td&gt;Cardinality specified in minimum cardinality, maximum cardinality and universal (allValuesFrom) OWL restrictions.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;11&lt;/td&gt;&lt;td&gt;Anonymous Complex Type&lt;/td&gt;&lt;td&gt;As for Complex Type except a URI is constructed from the parent element and the nested element reference. Also, the class is defined as a subclass of &lt;code&gt;A_Anon&lt;/code&gt;.&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;12&lt;/td&gt;&lt;td&gt;Anonymous Simple Type&lt;/td&gt;&lt;td&gt;As for Simple Type except a URI is constructed from the parent element and the nested element reference.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;13&lt;/td&gt;&lt;td&gt;&lt;code&gt;xsd:default&lt;/code&gt; on an attribute&lt;/td&gt;&lt;td&gt;Uses &lt;code&gt;dtype:defaultValue&lt;/code&gt; to attach a value to the OWL restriction representing the associated property.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;14&lt;/td&gt;&lt;td&gt;Substitution Groups&lt;/td&gt;&lt;td&gt;Subclass statements are generated for the members. Instance files resolve their types by consulting the OWL model at import-time.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;15&lt;/td&gt;&lt;td&gt;Annotation attributes on elements&lt;/td&gt;&lt;td&gt;OWL Annotation properties are created and placed directly on the relevant class.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;16&lt;/td&gt;&lt;td&gt;Annotations using &lt;code&gt;xsd:annotation&lt;/code&gt;&lt;/td&gt;&lt;td&gt;Become, based on user selection, &lt;code&gt;dc:description&lt;/code&gt;, &lt;code&gt;rdfs:comment&lt;/code&gt; and/or &lt;code&gt;skos:definition&lt;/code&gt; OWL annotations.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;17&lt;/td&gt;&lt;td&gt;&lt;code&gt;xsi:type&lt;/code&gt; on an XML element&lt;/td&gt;&lt;td&gt;Overrides the schema type with the specified type.&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;h3 id="a-sparql-metric-query"&gt;&lt;a href="#TOC"&gt;A SPARQL Metric Query&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;As a quick check on the generated OWL models, the following is a useful SPARQL query that counts the number of properties on each OWL class.&lt;/p&gt;&lt;br /&gt;&lt;pre class="query"&gt;&lt;br /&gt;&lt;br /&gt; SELECT ?class (COUNT(DISTINCT ?p) AS ?properties)&lt;br /&gt; WHERE {&lt;br /&gt;     ?class a owl:Class .&lt;br /&gt;     FILTER( afn:namespace( ?class ) = &lt;br /&gt;        "http://www.fpml.org/FpML-5/transparency#") .&lt;br /&gt;     OPTIONAL {&lt;br /&gt;         ?class rdfs:subClassOf ?r .&lt;br /&gt;         ?r a owl:Restriction .&lt;br /&gt;         ?r owl:onProperty ?p .&lt;br /&gt;     }&lt;br /&gt; }&lt;br /&gt; GROUP BY ?class&lt;br /&gt; ORDER BY DESC( ?properties )&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;p&gt;The classes for the transparency ontology have the distribution of properties shown in the following figure (click on the diagram to open a window with a bigger image). For example, &lt;code&gt;TradeInformation&lt;/code&gt; has 12 properties:&lt;/p&gt;&lt;br /&gt;&lt;a href="http://www.linkedmodels.org/images/xsd2owl/transparency-classes-properties.png" onclick="diagramPopUp(this.href); return false;"&gt; &lt;img src="http://www.linkedmodels.org/images/xsd2owl/transparency-classes-properties.png" alt="FpML Example 2" class="center" width="600 px;" height="244 px;" /&gt; &lt;/a&gt;&lt;br /&gt;&lt;h3 id="concluding-remarks"&gt;&lt;a href="#TOC"&gt;Concluding remarks&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;The new capability is easy to use. As before, a convenient import wizard will guide the user. The dialog has a number of new options. XML conversion will happen automatically when users open XML files in TBC or use XML import modules in SPARQLMotion. As long as an XML file is valid against an XSD that it is based on, the XML will be transformed in accordance to the schema. Parts of the XML files that do not validate against a schema will continue to be converted using the default Semantic XML structure. There is also a new option to specify which OWL file to use as a schema when mapping a specific XML file to triples. This feature is also available for spreadsheets and will be covered in a separate blog.&lt;/p&gt;&lt;p&gt;We believe that the importance of this work is not only in its value to harvest XML Schemas. Ability to use the automatic creation of triples from XML instance files directly in applications is proving to be key to a number of customers. For example, TopQuadrant is currently using this approach in a project for the North Sea Oil and Gas industry.&lt;/p&gt;&lt;p&gt;The functionality we have described will be released in TopBraid Composer 3.6.0. This release entered internal beta this week. Please contact us if you want a try these capabilities before general availability, which is currently planned for November.&lt;/p&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/7507012841435012041-7860518698041260186?l=topquadrantblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://topquadrantblog.blogspot.com/feeds/7860518698041260186/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7507012841435012041&amp;postID=7860518698041260186' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default/7860518698041260186'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default/7860518698041260186'/><link rel='alternate' type='text/html' href='http://topquadrantblog.blogspot.com/2011/09/living-in-xml-and-owl-world.html' title='Living in the XML and OWL World - Comprehensive Transformations of XML Schemas and XML data to RDF/OWL'/><author><name>ralphtq</name><uri>http://www.blogger.com/profile/11340855777025790541</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7507012841435012041.post-3512663953720321432</id><published>2011-07-21T15:25:00.000-07:00</published><updated>2011-07-21T15:27:46.452-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SPINMap'/><title type='text'>Putting your drag-and-drop SPINMap vocabulary mappings into production</title><content type='html'>&lt;span class="Apple-style-span" style="font-family: arial, helvetica; font-size: 14px; "&gt;&lt;p style="font-family: arial, helvetica; font-size: 10pt; "&gt;The "Composing the Semantic Web" blog entry &lt;a href="http://composing-the-semantic-web.blogspot.com/2011/04/spinmap-sparql-based-ontology-mapping.html"&gt;SPINMap: SPARQL-based Ontology Mapping with a Graphical Notation&lt;/a&gt; describes TopBraid 3.5's new tool for mapping between vocabularies or ontologies. (It also points to a handy video that demonstrates both simple and sophisticated uses of SPINMap.) Once you've created a mapping, though, how do you use it to convert data? As it turns out, no new technology is necessary; SPINMap just creates &lt;a href="http://www.w3.org/Submission/2011/02/"&gt;SPIN&lt;/a&gt; rules that you can apply in a SPARQLMotion script.&lt;/p&gt;&lt;p style="font-family: arial, helvetica; font-size: 10pt; "&gt;Let's look at an example. Imagine that I'm a publisher who receives images and metadata about those images from ExampleCo every month, and I load these images and metadata into my company's Digital Asset Management system. ExampleCo uses their own vocabulary to describe the metadata, but I prefer to use the &lt;a href="http://nepomuk.semanticdesktop.org/"&gt;NEPOMUK&lt;/a&gt; vocabulary for describing image metadata, because I know that by taking advantage of a vocabulary used by other systems around the world, my data can more easily interoperate with other data and tools.&lt;/p&gt;&lt;p style="font-family: arial, helvetica; font-size: 10pt; "&gt;Following the steps described in the blog posting mentioned above, I create the mapping from ExampleCo's pd:Image class and its associated properties to the NEPOMUK equivalents. Because the NEPOMUK image vocabulary's nexif:Photo class has so many properties associated with it, the diagram of it doesn't all fit on the screen at once, but it was easy enough scroll up and down as I mapped the pd:Image properties on the left to various NEPOMUK nexif:Photo properties.&lt;/p&gt;&lt;img src="http://www.snee.com/bobdc.blog/img/tq/usingmapping1.jpg" border="0" hspace="30px" vspace="30px" alt="Mapping from input to output with SPINMap" width="540" /&gt;&lt;p style="font-family: arial, helvetica; font-size: 10pt; "&gt;I saved the mapping in its own file, which I called ExampleCo2Nepomuk.ttl. At this point, I could convert a set of ExampleCo metadata by importing a file of that data and ExampleCo2Nepomuk.ttl into the same model and then picking &lt;b&gt;Run Inferences&lt;/b&gt; from the &lt;b&gt;Inference&lt;/b&gt; menu, assuming that &lt;b&gt;Configure Inferencing&lt;/b&gt; on the same menu had TopSPIN configured as the inferencing engine.&lt;/p&gt;&lt;p style="font-family: arial, helvetica; font-size: 10pt; "&gt;I wanted this to be more automated, though, so I put it in a SPARQLMotion script that could be called as a web service or from a TopBraid Ensemble interface. This would make it easier to re-use this mapping every month on each new batch of ExampleCo image data as it comes in:&lt;/p&gt;&lt;img src="http://www.snee.com/bobdc.blog/img/tq/usingmapping2.jpg" border="0" hspace="30px" vspace="30px" alt="SPARQLMotion script that applies mappings" /&gt;&lt;p style="font-family: arial, helvetica; font-size: 10pt; "&gt;The script's first module prompts for the input filename, because it will be a new dataset each month. This module hands the filename to the "Get ExampleCo RDF" module, an Import RDF From Workspace module that reads in the ExampleCo data.&lt;/p&gt;&lt;p style="font-family: arial, helvetica; font-size: 10pt; "&gt;At the same time, another Import RDF From Workspace module named "Get mapping rules" reads in the ExampleCo2Nepomuk.ttl file storing the SPIN-based mapping rules. Both of these modules feed their triples to an Apply TopSPIN module named "Apply mapping rules," which has its sml:replace value set to true so that it only passes along the new triples that it creates and not the input triples. The script's last module saves the result in a disk file, but could easily send it off for addition to a triplestore in a Digital Asset Management system.&lt;/p&gt;&lt;p style="font-family: arial, helvetica; font-size: 10pt; "&gt;There's nothing especially new or unusual in this script; what's new is that the rules that it applies to the data were created by a graphical drag-and-drop tool instead of being coded by hand. (Rest assured that the rules stored by the tool are still expressed using standard SPARQL.) With easy data aggregation being one of the great advantages of semantic web applications, it's nice to know that SPINMap lets you define data transformations with less trouble than ever before, making your application development (and application maintenance) even faster.&lt;/p&gt;&lt;p style="font-family: arial, helvetica; font-size: 10pt; "&gt;As an added bonus, because the mappings are stored as SPIN rules (also known as &lt;a href="http://spinrdf.org/"&gt;SPARQL Rules&lt;/a&gt;), they can easily be combined with other SPARQL Rules that you can run with the same script. These other rules might perform validation to ensure that the data being read conforms to certain data quality standards, or they could calculate new values based on a combination of the incoming data and existing stored data.&lt;/p&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7507012841435012041-3512663953720321432?l=topquadrantblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://topquadrantblog.blogspot.com/feeds/3512663953720321432/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7507012841435012041&amp;postID=3512663953720321432' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default/3512663953720321432'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default/3512663953720321432'/><link rel='alternate' type='text/html' href='http://topquadrantblog.blogspot.com/2011/07/putting-your-drag-and-drop-spinmap.html' title='Putting your drag-and-drop SPINMap vocabulary mappings into production'/><author><name>Bob DuCharme</name><uri>http://www.blogger.com/profile/02742075186312518829</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_13zlUS8aD_8/S0OhTCeBZ8I/AAAAAAAAAAM/cGInR6wDS84/S220/128x128.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7507012841435012041.post-7758293090210573785</id><published>2011-06-26T17:50:00.000-07:00</published><updated>2011-06-26T18:46:50.404-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SPIN'/><category scheme='http://www.blogger.com/atom/ns#' term='SPARQL'/><title type='text'>Comparing SPIN with RIF</title><content type='html'>Since SPIN (SPARQL Inferencing Notation) aka SPARQL Rules became &lt;a href="http://www.w3.org/Submission/2011/SUBM-spin-overview-20110222/"&gt;W3C member submission&lt;/a&gt;,we find ourselves responding to the growing interest to it.&lt;br /&gt;&lt;br /&gt;With this, a question some may ask is how SPIN is different from or similar to &lt;a href="http://www.w3.org/TR/2010/REC-rif-core-20100622/"&gt;RIF&lt;/a&gt; - W3C's standard for rules interchange. &lt;br /&gt;&lt;br /&gt;While I have heard this asked a couple of times, I was pleasantly surprised that it was is not a very common question. Pleasantly, because a certain level of confusion is to be expected about new things and, both, SPIN and RIF are relatively new. If so few people ask this question, then SPIN specification did a good job explaining and positioning it and people easily grasp the unique and important needs it serves. Still, I thought it was worth while to write up my thoughts on comparing SPIN with RIF.&lt;br /&gt;&lt;br /&gt;The goal of RIF was to create an interchange format for use between rules engines. As such, unlike SPIN, RIF is not an idea that is specifically or particularly aligned with RDF. This is why RIF was created as XML (although there is now work on RDF serialization). I am not pointing this out as a shortcoming of RIF, but rather to put in perspective the origin and the reason for RIF. In its goals, RIF is similar to OMG's XMI which also uses XML and was created to be an interchange format between different tools.&lt;br /&gt; &lt;br /&gt;Given this similarity, XMI’s failure in being a reliable interchange format becomes relevant when considering RIF's future. Will RIF succeed in reaching its goal? One can easily argue that with the variety of available rules languages and engines, RIF’s job is harder than what XMI needed to do to succeed.&lt;br /&gt; &lt;br /&gt;As noted &lt;a href="http://www.w3.org/2005/rules/wiki/RIF_FAQ#What_is_RIF.3F"&gt;here&lt;/a&gt;, different rules languages exist because there are different algorithms and formalisms for rules. Furthermore, different rule products have different sets of capabilities. RIF dialects are intended to be the least common denominators for a given type of a rule engine. This means that in order to effectively use the same set of RIF rules in the ‘rules engine A’ and in the ‘rules engine B’, the following needs to happen:&lt;br /&gt; &lt;br /&gt;&lt;span style="font-weight:bold;"&gt;1. RIF dialect used to express the rules, needs to be supported by both rules engines.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Checking the &lt;a href="http://www.w3.org/2005/rules/wiki/Implementations"&gt;implementation page&lt;/a&gt;, one will see that currently the overlap between any two engines is not that great. Some support BLD, some support PRD + Core, others support BLD partial or PRD minus something, etc.&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;&lt;br /&gt;&lt;br /&gt;2. RIF dialect used to express the rules, must be enough for the task at hand.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;As mentioned above, RIF by design is somewhat of a least common denominator. This means that a user could always do more with a given rules engine than they can express in a dialect of RIF. &lt;br /&gt;&lt;br /&gt;For example (as noted &lt;a href="http://www.w3.org/2005/rules/wiki/RIF_FAQ#I.27d_like_to_know_if_it.27s_possible_to_translate_RIF_into_SPARQL_Construct_clause_.28and_back.29"&gt;here&lt;/a&gt;), SPARQL is more expressive than what is possible with RIF. This is not unique to SPARQL, it is true for pretty much any rules technology. &lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;3. The interchange must work&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Given well known XMI issues, I am quite keen to see RIF test cases as well as test case results from the implementers&lt;br /&gt; &lt;br /&gt;Attitude of the major rule engine vendors towards RIF is currently, at best, lukewarm. For example, on &lt;a href="http://forums.oracle.com/forums/thread.jspa?threadID=2145544&amp;tstart=165"&gt;the Oracle forum&lt;/a&gt;, support engineers recommend against attempting to interchange rules by saying:&lt;br /&gt; &lt;br /&gt;&lt;span style="font-style:italic;"&gt;“In a hybrid environment I'd recommend that rules authored in ILOG be executed in the ILOG engine, and that rules authored in OPA be executed in the OPA engine, rather than attempt to interchange rules between the two products. As long as there is a clear scope boundary between what the rule sets are used for, then there wouldn't be any duplication or interchange of rules.”&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;Having considered the design goals and challenges of RIF, it is easy to see that the design goals of SPIN are quite different. SPIN is not about capturing rules that can then be translated for execution by different types of rule engines. Rather it is about capturing rules that can be executed directly over RDF data and about having rules that are intimately connected to the Semantic Web models. &lt;br /&gt;&lt;br /&gt;With these goals in mind, we identified the following three things as important principles in SPIN's design:&lt;br /&gt; &lt;br /&gt;1. &lt;span style="font-weight:bold;"&gt;Rules can be expressed in a familiar language.&lt;/span&gt; People working with RDF must know SPARQL. Using SPARQL for rules means that they don’t need to use another language&lt;br /&gt;&lt;br /&gt;2. &lt;span style="font-weight:bold;"&gt;Rules can be executed by any RDF database.&lt;/span&gt; Since they are in SPARQL, rules are portable – not across rules engines, but across RDF stores&lt;br /&gt;&lt;br /&gt;3. &lt;span style="font-weight:bold;"&gt;Evolution of the models does not unnecessarily break the rules.&lt;/span&gt; For example, let’s say we change the URI of a resource used in a rule. If a rule uses some other format (XML) and is not connected to the underlying RDF in a way other than a blob, it becomes hard to maintain these two different sets of information&lt;br /&gt; &lt;br /&gt;Finally, SPIN takes an object-oriented approach to rules. It is about programming and about associating behavior with classes while RIF takes a model-theoretic view on how the rules may relate to ontologies. This is a key difference as noted in &lt;a href="http://www.w3.org/Submission/2011/02/Comment/"&gt;W3C comments on SPIN submission&lt;/a&gt;. &lt;br /&gt;&lt;br /&gt;In short, SPIN and RIF address different needs and have different design goals. They can be considered complimentary. &lt;br /&gt;&lt;br /&gt;What about using SPIN and RIF together? Given the key role SPARQL plays in the architecture of Semantic Web solutions, I am certain that should RIF get traction in its adoption, someone will create a RIF profile for SPARQL and write a RIF to SPARQL translation.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7507012841435012041-7758293090210573785?l=topquadrantblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://topquadrantblog.blogspot.com/feeds/7758293090210573785/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7507012841435012041&amp;postID=7758293090210573785' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default/7758293090210573785'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default/7758293090210573785'/><link rel='alternate' type='text/html' href='http://topquadrantblog.blogspot.com/2011/06/comparing-spin-with-rif.html' title='Comparing SPIN with RIF'/><author><name>Irene Polikoff</name><uri>http://www.blogger.com/profile/17834271916697741738</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7507012841435012041.post-2315034439191461835</id><published>2011-03-30T07:04:00.000-07:00</published><updated>2011-03-30T07:11:54.456-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SKOS'/><category scheme='http://www.blogger.com/atom/ns#' term='How to'/><title type='text'>How to: extend an ontology</title><content type='html'>&lt;span class="Apple-style-span" style="font-family: arial, helvetica; font-size: 14px; "&gt;&lt;p style="font-family: arial, helvetica; font-size: 10pt; "&gt;When people work with ontologies, XML schemas and software development, it's almost a cliché to say that re-use of existing work is better than creating something new from scratch. Existing work, though, is not always a perfect fit to your needs, and the ease of customizing it for your needs often depends a lot on how the original work was designed—when you're reusing XML schemas or software source code. Customizing OWL ontologies and RDF schemas, on the other hand, is pretty simple nearly all of the time, especially when you use TopBraid Composer.&lt;/p&gt;&lt;p style="font-family: arial, helvetica; font-size: 10pt; "&gt;For example, let's say that you have a taxonomy of business terms to track, and the W3C's &lt;a href="http://www.w3.org/2004/02/skos/"&gt;SKOS&lt;/a&gt; standard defines all the properties you need to maintain metadata about these terms, with two exceptions: SKOS has nothing about the last person to edit a term and it has no slot for the editor's department code, which is a special bit of metadata within your enterprise. Customizing SKOS to include these is just two steps:&lt;/p&gt;&lt;ol&gt;&lt;li style="font-family: arial, helvetica; font-size: 10pt; "&gt;&lt;p style="font-family: arial, helvetica; font-size: 10pt; "&gt;Create an empty new ontology and import SKOS into it.&lt;/p&gt;&lt;/li&gt;&lt;li style="font-family: arial, helvetica; font-size: 10pt; "&gt;&lt;p style="font-family: arial, helvetica; font-size: 10pt; "&gt;Define your two properties in this new ontology and give them a domain of &lt;tt&gt;skos:Concept&lt;/tt&gt; so that SKOS tools such as TopBraid &lt;a href="http://www.topquadrant.com/solutions/ent_vocab_net.html"&gt;Enterprise Vocabulary Net&lt;/a&gt;(EVN) know that they're potential properties of your SKOS concepts.&lt;/p&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p style="font-family: arial, helvetica; font-size: 10pt; "&gt;To do this with TopBraid Composer, start by creating a new RDF/OWL file in one of your projects. On the wizard dialog box for creating this file, enter the Base URI of your new customized version of the SKOS ontology. If I worked for The Example Company, I might create a baseURI of http://example.com/ns/exskos.&lt;/p&gt;&lt;p style="font-family: arial, helvetica; font-size: 10pt; "&gt;On the same dialog box, click the checkbox next to SKOS under "Initial imports" and click &lt;b&gt;Finish&lt;/b&gt;. (If you forget to click the checkbox first, you can always drag the skos-core.rdf file from the Navigator View's /TopBraid/SKOS folder to the &lt;b&gt;Imports&lt;/b&gt; tab. In fact, to start creating a customized version of any ontology, drag a copy of it into your custom ontology's &lt;b&gt;Imports&lt;/b&gt; tab.)&lt;/p&gt;&lt;p style="font-family: arial, helvetica; font-size: 10pt; "&gt;Once the file is created, having a namespace prefix associated with the base URI makes it easier to create the new properties, so on your new ontology's &lt;b&gt;Overview&lt;/b&gt;tab add an &lt;tt&gt;ex&lt;/tt&gt; prefix for the http://example.com/ns/exskos# namespace. Don't forget the pound sign; the prefix will be standing in for this URI, and you want&lt;tt&gt;ex:editor&lt;/tt&gt; to represent http://example.com/ns/exskos#editor, not http://example.com/ns/exskoseditor.&lt;/p&gt;&lt;p style="font-family: arial, helvetica; font-size: 10pt; "&gt;Now we're ready to add the customizations. Instead of creating a new &lt;tt&gt;editor&lt;/tt&gt; property from scratch, it's better to define it as a subproperty of the Dublin Core&lt;tt&gt;dc:creator&lt;/tt&gt; property so that applications that don't know about our new property but do know about Dublin Core properties will have some clue what it's for.&lt;/p&gt;&lt;ol&gt;&lt;li style="font-family: arial, helvetica; font-size: 10pt; "&gt;&lt;p style="font-family: arial, helvetica; font-size: 10pt; "&gt;Drag the dc1-1.rdf Dublin Core ontology file from the /TopBraid/Common folder in TopBraid Composer's Navigator view to the &lt;b&gt;Imports&lt;/b&gt; tab to import the Dublin Core ontology. You'll see several new properties will join the SKOS ones on the &lt;b&gt;Properties&lt;/b&gt; view.&lt;/p&gt;&lt;/li&gt;&lt;li style="font-family: arial, helvetica; font-size: 10pt; "&gt;&lt;p style="font-family: arial, helvetica; font-size: 10pt; "&gt;Right-click on &lt;tt&gt;dc:creator&lt;/tt&gt; there and pick &lt;b&gt;Create subproperty&lt;/b&gt;. In the &lt;b&gt;Create subproperty&lt;/b&gt; wizard, replace the dc:Property_1 value that appears as the default &lt;b&gt;Name of new instance&lt;/b&gt; value with ex:editor, which uses the ex prefix that you defined earlier.&lt;/p&gt;&lt;/li&gt;&lt;li style="font-family: arial, helvetica; font-size: 10pt; "&gt;&lt;p style="font-family: arial, helvetica; font-size: 10pt; "&gt;Click the checkbox next to rdfs:label on the dialog box's &lt;b&gt;Annotations Template&lt;/b&gt; so that an rdfs:label property gets automatically set for this property. (One nice thing about how the RDF data model lets you assign properties to properties is that you can associate human readable names to substitute for the actual property names on forms and reports.)&lt;/p&gt;&lt;/li&gt;&lt;li style="font-family: arial, helvetica; font-size: 10pt; "&gt;&lt;p style="font-family: arial, helvetica; font-size: 10pt; "&gt;Click the &lt;b&gt;OK&lt;/b&gt; button and you'll see a property form in the middle of your screen for your new property, which will be selected in the &lt;b&gt;Properties&lt;/b&gt; view. (It's on the left of the screenshot below because the &lt;b&gt;Classes&lt;/b&gt; view is not shown there.)&lt;/p&gt;&lt;img src="http://www.snee.com/bobdc.blog/img/tq/extendont1.jpg" width="540" /&gt;&lt;/li&gt;&lt;li style="font-family: arial, helvetica; font-size: 10pt; "&gt;&lt;p style="font-family: arial, helvetica; font-size: 10pt; "&gt;To show that your ontology is defining this new property for SKOS concepts, click the small white triangle next to the word &lt;b&gt;domain&lt;/b&gt; on the ex:editor property form and pick &lt;b&gt;Add existing&lt;/b&gt; to indicate that this property's domain will be an existing class. Click skos:Concept, which will be under owl:Thing on the wizard's class tree, and click &lt;b&gt;OK&lt;/b&gt;.&lt;/p&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p style="font-family: arial, helvetica; font-size: 10pt; "&gt;You're finished defining your editor property. The department code one will be even quicker to create, because it won't be a subproperty of something else:&lt;/p&gt;&lt;ol&gt;&lt;li style="font-family: arial, helvetica; font-size: 10pt; "&gt;&lt;p style="font-family: arial, helvetica; font-size: 10pt; "&gt;Click the &lt;b&gt;Properties&lt;/b&gt; view's small white triangle to display its menu and pick &lt;b&gt;Create rdf:Property&lt;/b&gt;. Name the new property ex:deptCode on the &lt;b&gt;Create Property&lt;/b&gt; wizard dialog box. The Annotations Template's rdfs:label checkbox should already be checked, so click &lt;b&gt;OK&lt;/b&gt;.&lt;/p&gt;&lt;/li&gt;&lt;li style="font-family: arial, helvetica; font-size: 10pt; "&gt;&lt;p style="font-family: arial, helvetica; font-size: 10pt; "&gt;Set your newest property's domain to skos:Concept the same way you did for ex:editor and save your file.&lt;/p&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p style="font-family: arial, helvetica; font-size: 10pt; "&gt;You're done! You know have a customized version of the SKOS ontology. If you now use TopBraid Composer or EVN to create a new instance of the Concept class in this file, you would see &lt;b&gt;editor&lt;/b&gt; and &lt;b&gt;dept code&lt;/b&gt; fields on your new concept's resource form along with &lt;b&gt;has broader&lt;/b&gt; and all the other standard SKOS properties. (If you create concept instances with TopBraid Composer and the labels are toggled to show qnames instead of human-readable labels, they'll say &lt;b&gt;ex:editor&lt;/b&gt; and&lt;b&gt;ex:deptCode&lt;/b&gt;.) Instead of creating concept instances in this file, though, you would more likely create a new taxonomy file that imports your customized ontology the same way that your ontology imported the SKOS and Dublin Core ontologies, and then you would store your taxonomy's concepts in this new file.&lt;/p&gt;&lt;p style="font-family: arial, helvetica; font-size: 10pt; "&gt;The modularity of this approach brings another benefit that isn't as easy when customizing typical XML schemas and other software resource files: when a SKOS upgrade is released, you can simply delete the import of the current SKOS ontology in your customization of it and import the new one instead, and all of your applications that use your custom ontology should be able to go on using it the same way the did before.&lt;/p&gt;&lt;p style="font-family: arial, helvetica; font-size: 10pt; "&gt;It's nice to know that customization of a standard ontology that nearly meets your needs is so easy, and many organizations are doing this with the SKOS ontology to create a better fit with their vocabulary management requirements. This isn't limited to customizing SKOS, though; the same principle works with any OWL ontology or RDF schema. As an added benefit, if you create a customized version of a particular standard for your enterprise, you can follow these same steps to create customizations of your customization for individual departments within your enterprise.&lt;/p&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7507012841435012041-2315034439191461835?l=topquadrantblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://topquadrantblog.blogspot.com/feeds/2315034439191461835/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7507012841435012041&amp;postID=2315034439191461835' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default/2315034439191461835'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default/2315034439191461835'/><link rel='alternate' type='text/html' href='http://topquadrantblog.blogspot.com/2011/03/how-to-extend-ontology.html' title='How to: extend an ontology'/><author><name>Bob DuCharme</name><uri>http://www.blogger.com/profile/02742075186312518829</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_13zlUS8aD_8/S0OhTCeBZ8I/AAAAAAAAAAM/cGInR6wDS84/S220/128x128.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7507012841435012041.post-5136363861962740422</id><published>2011-02-03T17:12:00.000-08:00</published><updated>2011-09-21T21:50:58.188-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OCL'/><category scheme='http://www.blogger.com/atom/ns#' term='QVT'/><category scheme='http://www.blogger.com/atom/ns#' term='OWL'/><category scheme='http://www.blogger.com/atom/ns#' term='EMOF'/><category scheme='http://www.blogger.com/atom/ns#' term='UML'/><category scheme='http://www.blogger.com/atom/ns#' term='CMOF'/><category scheme='http://www.blogger.com/atom/ns#' term='SPARQL'/><category scheme='http://www.blogger.com/atom/ns#' term='RDF'/><category scheme='http://www.blogger.com/atom/ns#' term='MOF'/><title type='text'>Converting UML Models to OWL - Part 1: The Approach</title><content type='html'>&lt;div&gt;&lt;script type="text/javascript"&gt;var newwindow; function diagramPopUp(url){   newwindow=window.open(url,'name','height=600,width=1000,left=50,top=50,resizable=yes,scrollbars=yes,toolbar=no,status=yes'); if (window.focus) {newwindow.focus()}}&lt;/script&gt; &lt;style type="text/css"&gt;&lt;!--  pre.xmlBlock  { font-size:1.20em; background-color:#CCFFFF; border:#999999 2px solid ; display: block;   margin-left: auto;   margin-right: auto; }  pre.smallXmlBlock  { font-size:1.0em; background-color:#CCFFFF; border:#999999 2px solid ; display: block;   margin-left: auto;   margin-right: auto; }  pre.turtleBlock  { font-size:1.20em; background-color:#CCFFFF; border:#999999 2px solid ; display: block;   margin-left: auto;   margin-right: auto; }  pre.spinBlock { font-size:1.1em; background-color:#CCFFFF; border:#999999 2px solid ; display: block;   margin-left: auto;   margin-right: auto;  }  img.center { display: block;   margin-left: auto;   margin-right: auto; }  p.caption  { display: block; font-size: 22 px; line-height: 17px; margin-left: auto; margin-right: auto; margin: 10px; padding-top: 4px; text-align: center; font-weight: bold; white-space: nowrap; color: black; } code.rdfStatement { display: inline; font-size: 16 px; background-color:#CCFFFF; border:#999999 1px solid ;} div.sparqlDetails { border: 2px dotted; }  p.sparqlDetails { padding-top: 2px; padding-bottom: 2px; padding-right: 5px; padding-left: 35px; text-indent: -30px; } div.indentedSparqlDetails { padding-top: 2px; padding-bottom: 2px; padding-right: 25px; padding-left: 35px; }  --&gt;&lt;/style&gt;&lt;br /&gt;&lt;p&gt;Convert UML to OWL - why would you ever want to do this? One reason suffices: many enterprise models, that serve as either standards or enterprise schemas, are specified in UML. Increasingly, there is interest in having content of UML models re-purposed in RDF/OWL and the need for RDF/OWL to interoperate with systems built from UML Models.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;UML Models are notoriously hard to exchange between UML tools, let alone be transformed into OWL. The exchange format &lt;a href="http://www.omg.org/technology/documents/modeling_spec_catalog.htm#XMI"&gt;XMI&lt;/a&gt; is not only is difficult to understand but also has vendor-specific extensions. The vagaries of &lt;a href="http://www.omg.org/mof/"&gt;MOF&lt;/a&gt;, &lt;a href="http://en.wikipedia.org/wiki/Meta-Object_Facility"&gt;CMOF&lt;/a&gt;&lt;a&gt; and &lt;/a&gt;&lt;a href="http://en.wikipedia.org/wiki/Meta-Object_Facility"&gt;EMOF&lt;/a&gt; create their own challenges. Nonetheless we have done transformations of UML to OWL. Using a model-based transformation approach, based on &lt;a href="http://www.topquadrant.com/products/SPIN.html"&gt;SPARQL Rules&lt;/a&gt;, XMI models of UML models can be converted to OWL. UML class diagrams can be represented in OWL without information loss. The inverse, however, is not true and will require another blog series.&lt;br /&gt;&lt;/p&gt;&lt;h3 id="contents"&gt;UML to OWL - Part 1 Contents&lt;/h3&gt;Part 1 of the series explains the basis of the approach. The complete series of blogs, as currently conceived, is as follows:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Converting UML Models to OWL - Part 1: The Approach&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Converting UML Models to OWL - Part 2: Transforming UML Models to OWL Using SPARQL&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Converting UML Models to OWL - Part 3: Examples of Industry UML Model Transformations&lt;/li&gt;&lt;/ul&gt;The content of this blog is organized as follows:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;&lt;a href="#goals"&gt;Goals, Objectives and Requirements&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="#backgrounderXMI"&gt;Backgrounder on XMI&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="#backgrounderMOF"&gt;Backgrounder on MOF&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="#solution"&gt;Solution Outline&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="#overviewOfSXML"&gt;Overview of Semantic XML&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="#ocmof"&gt;OCMOF - the OWL Representation of CMOF&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="#howItWorks"&gt;How the Transformations from UML to OWL Work&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="#generationOfUMLMetaClasses"&gt;Generation of UML Metaclasses&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="#generationOfUMLClasses"&gt;Generation of UML Classes&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="#generationOfUMLSubClassOfs"&gt;Generation of UML Class Superclass Relationships&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="#generationOfUMLPackages"&gt;Generation of UML Packages&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="#generationOfUMLPackageRelationships"&gt;Generation of UML Package Relationships&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="#performance"&gt;Performance&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="#conclusion"&gt;Concluding Remarks&lt;/a&gt;&lt;/li&gt;&lt;/ol&gt;Readers who are very interested in the detailed technical approach, should read all sections of this blog in order. Those who just need to have an overview of the approach could skip sections 9 through 12. Those who have deep knowledge of XMI and MOF may want to skip sections 2 and 3, but I would welcome their feedback on the accuracy of my statements.&lt;br /&gt;&lt;p&gt;Note that some diagrams may be too small to be viewed in the body of the document.  Clicking on such a diagram will open a new window with a larger depiction of the diagram.&lt;/p&gt;&lt;h3 id="goals"&gt;Goals, Objectives and Requirements&lt;/h3&gt;The OWL Models must faithfully represent packages and the logical models or class diagrams. Out of scope, currently, are all of the other UML models such as Interaction Diagrams and State Diagrams. The approach must be able to convert UML by processing XMI files from specific tools. This requires a strategy for converting from the XML structures of XMI to OWL models.&lt;br /&gt;&lt;h3 id="backgrounderXMI"&gt;Backgrounder on XMI&lt;/h3&gt;XMI, the &lt;a href="http://www.omg.org/technology/documents/modeling_spec_catalog.htm#XMI"&gt;&lt;em&gt;XML Metadata Interchange&lt;/em&gt;&lt;/a&gt;&lt;em&gt;&lt;/em&gt; standard is a serialization format for UML Models. The main purpose of XMI is to define how the XML elements are organized within an XMI file. The XMI spec also defines a mechanism for how one XMI element references another, within and across XMI files. Such a mechanism is needed as it is a legal scenario for a single UML model to be serialized to more than one XMI file.&lt;br /&gt;&lt;div&gt;&lt;a href="#contents"&gt;&lt;img src="http://www.linkedmodels.org/images/uml2owl/up_arrow.jpg" width="15" height="15" /&gt;Top&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;h3 id="backgrounderMOF"&gt;Backgrounder on MOF&lt;/h3&gt;MOF began at the time of &lt;a href="http://www.omg.org/technology/documents/corba_spec_catalog.htm"&gt;CORBA&lt;/a&gt; and the need for IDL interfaces. MOF 1.4 resulted in its mapping to Java being codified in the &lt;a href="http://jcp.org/en/home/index"&gt;Java Community Process (JCP)&lt;/a&gt; as the &lt;a href="http://java.sun.com/products/jmi/"&gt;Java Metadata Initiative (JMI)&lt;/a&gt;. MOF 2.0 was developed in tandem with UML 2.0. The separation of MOF into EMOF and CMOF was motivated by the influence of EMF's Ecore, and model-driven Java development. CMOF was more the motivation of meta model developers. CMOF stands for &lt;em&gt;Complete Meta Object Facility&lt;/em&gt; and is an OMG standard for the UML 2 model interchange. More information can be found at &lt;a href="http://www.omg.org/spec/UML/2.3/"&gt;&lt;b&gt;this page&lt;/b&gt;&lt;/a&gt; on the &lt;a href="http://www.omg.org/"&gt;OMG&lt;/a&gt; Website.&lt;br /&gt;&lt;p&gt;CMOF includes fully fledged associations, association generalization, property subsetting and redefinition, derived unions, and package merge. Typical XMI container structures look like the example below, from the CMOF UML Infrastructure Model. The basic idea is that a &lt;code&gt;packagedElement&lt;/code&gt; owns other elements. A &lt;code&gt;type&lt;/code&gt; attribute specifies the type of the &lt;code&gt;packagedElement&lt;/code&gt;.&lt;br /&gt;Things get a little busy with how IDs are used for associations and their member ends. That complication, we can leave for Part 2.&lt;/p&gt;&lt;br /&gt;&lt;pre class="smallXmlBlock"&gt;&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;&lt;br /&gt;  &amp;lt;xmi:XMI xmi:version="2.1" xmlns:xmi="http://schema.omg.org/spec/XMI/2.1"&lt;br /&gt;   xmlns:cmof="http://schema.omg.org/spec/MOF/2.0/cmof.xml"&amp;gt;&lt;br /&gt;   &amp;lt;cmof:Package xmi:id="_0" name="InfrastructureLibrary"&amp;gt;&lt;br /&gt;    &amp;lt;ownedMember xmi:type="cmof:Package" xmi:id="Core" name="Core"&amp;gt;&lt;br /&gt;     &amp;lt;ownedMember xmi:type="cmof:Package"&lt;br /&gt;      xmi:id="Core-Abstractions" name="Abstractions"&amp;gt;&lt;br /&gt;      &amp;lt;packageImport xmi:type="cmof:packageImport"&lt;br /&gt;      xmi:id="Core-Abstractions-_packageImport.0"&lt;br /&gt;      importedPackage="Core-PrimitiveTypes"&lt;br /&gt;      importingNamespace="Core-Abstractions"/&amp;gt;&lt;br /&gt;      &amp;lt;ownedMember xmi:type="cmof:Package"&lt;br /&gt;       xmi:id="Core-Abstractions-Ownerships" name="Ownerships"&amp;gt;&lt;br /&gt;       &amp;lt;packageImport xmi:type="cmof:packageImport"&lt;br /&gt;        xmi:id="Core-Abstractions-Ownerships-_packageImport.0"&lt;br /&gt;        importedPackage="Core-Abstractions-Elements"&lt;br /&gt;        importingNamespace="Core-Abstractions-Ownerships"/&amp;gt;&lt;br /&gt;        &amp;lt;ownedMember xmi:type="cmof:Class"&lt;br /&gt;         xmi:id="Core-Abstractions-Ownerships-Element" name="Element" isAbstract="true"&amp;gt;&lt;br /&gt;         &amp;lt;ownedComment xmi:type="cmof:Comment"&lt;br /&gt;          xmi:id="Core-Abstractions-Ownerships-Element-_ownedComment.0"&lt;br /&gt;          annotatedElement="Core-Abstractions-Ownerships-Element"&amp;gt;&lt;br /&gt;          &amp;lt;body&amp;gt;An element is a constituent of a model.&lt;br /&gt;          As such, it has the capability of owning other elements.&amp;lt;/body&amp;gt;&lt;br /&gt;         &amp;lt;/ownedComment&amp;gt;&lt;br /&gt;        &amp;lt;ownedRule xmi:type="cmof:Constraint"&lt;br /&gt;         xmi:id="Core-Abstractions-Ownerships-Element-not_own_self"&lt;br /&gt;         name="not_own_self" constrainedElement="Core-Abstractions-Ownerships-Element"&lt;br /&gt;         namespace="Core-Abstractions-Ownerships-Element"&amp;gt;&lt;br /&gt;         &amp;lt;ownedComment xmi:type="cmof:Comment"&lt;br /&gt;          xmi:id="Core-Abstractions-Ownerships-Element-not_own_self-_ownedComment.0"&lt;br /&gt;          annotatedElement="Core-Abstractions-Ownerships-Element-not_own_self"&amp;gt;&lt;br /&gt;          &amp;lt;body&amp;gt;An element may not directly or indirectly own itself.&amp;lt;/body&amp;gt;&lt;br /&gt;         &amp;lt;/ownedComment&amp;gt;&lt;br /&gt;         &amp;lt;specification xmi:type="cmof:OpaqueExpression"&lt;br /&gt;          xmi:id="Core-Abstractions-Ownerships-Element-not_own_self-_specification"&amp;gt;&lt;br /&gt;          &amp;lt;language&amp;gt;OCL&amp;lt;/language&amp;gt;&lt;br /&gt;          &amp;lt;body&amp;gt;not self.allownedElements()-&amp;gt;includes(self)&amp;lt;/body&amp;gt;&lt;br /&gt;         &amp;lt;/specification&amp;gt;&lt;br /&gt;        &amp;lt;/ownedRule&amp;gt;&lt;br /&gt;        ...&lt;br /&gt;        &amp;lt;ownedAttribute xmi:type="cmof:Property"&lt;br /&gt;         xmi:id="Core-Abstractions-Ownerships-Element-ownedElement"&lt;br /&gt;         name="ownedElement" type="Core-Abstractions-Ownerships-Element"&lt;br /&gt;         upper="*" lower="0" isReadOnly="true" isDerived="true"&lt;br /&gt;         isDerivedUnion="true" isComposite="true"&lt;br /&gt;         association="Core-Abstractions-Ownerships-A_ownedElement_owner"&amp;gt;&lt;br /&gt;         &amp;lt;ownedComment xmi:type="cmof:Comment"&lt;br /&gt;          xmi:id="Core-Abstractions-Ownerships-Element-ownedElement-_ownedComment.0"&lt;br /&gt;          annotatedElement="Core-Abstractions-Ownerships-Element-ownedElement"&amp;gt;&lt;br /&gt;          &amp;lt;body&amp;gt;The Elements owned by this element.&amp;lt;/body&amp;gt;&lt;br /&gt;         &amp;lt;/ownedComment&amp;gt;&lt;br /&gt;        &amp;lt;/ownedAttribute&amp;gt;&lt;br /&gt;        ...&lt;br /&gt;&lt;/pre&gt;&lt;p class="caption"&gt;Figure 1: A sample of XMI&lt;/p&gt;&lt;br /&gt;&lt;p&gt;For more background on the history of MOF the following references may be of value: &lt;a href="http://www.moflon.org/background/history/"&gt;MOFLON&lt;/a&gt;, and &lt;a href="http://en.wikipedia.org/wiki/Unified_Modeling_Language"&gt;Wikipedia&lt;/a&gt;.&lt;/p&gt;&lt;a href="#contents"&gt;&lt;img src="http://www.linkedmodels.org/images/uml2owl/up_arrow.jpg" width="15" height="15" /&gt;Top&lt;/a&gt;&lt;br /&gt;&lt;h3 id="solution"&gt;Solution Outline&lt;/h3&gt;Model-based transformation is the central idea of the approach. To implement it we have developed a metamodel of CMOF in OWL. Our strategy is to get out of XML into RDF Triples as soon as possible. Using an ontology of XML we convert XMI into a composite model of triples. XML is a simple enough structure for the composite object pattern - elements contain elements and elements have attributes. XML elements and attributes that make up the XMI file are transformed into OWL instances of the CMOF metamodel. Once we have the XMI in triples we can map constructs to classes and properties of a CMOF metamodel. This model then serves as the generator for model-based transformations to an OWL model of the UML.&lt;br /&gt;&lt;p&gt;Once these instances are loaded as "raw" RDF, rules fire to perform the transformations. Rules are associated with classes to ensure that instances of those classes are processed in an execution sequence. Using &lt;a href="http://www.topquadrant.com/products/SPIN.html"&gt;SPARQL Rules (SPIN)&lt;/a&gt;, instances of a class are each processed through a binding mechanism specified by &lt;code&gt;?this&lt;/code&gt; variable. SPARQL Rules can be considered an approach that is similar to, or can be compared with, UML's &lt;a href="http://www.omg.org/spec/OCL/2.0/"&gt;Object Constraint Language (OCL)&lt;/a&gt; and the &lt;a href="http://www.omg.org/spec/QVT/"&gt;Query/View/Transformation (QVT)&lt;/a&gt; approach to transformations.&lt;/p&gt;The benefits of the OWL and SPARQLRules model-based approach to transformation are:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Intimacy of the rules with RDF/OWL - triples are evaluated directly&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Understandability - rules are smaller and expressed in the relevant contexts of the model&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Enhanced Performance - evaluation of rules is localized to relevant instances&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Customizability and Evolvability – transformations can be changed by modifying models and/or SPARQL rules&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Ease of maintenance - rules are associated with the constructs they operate over&lt;/li&gt;&lt;/ul&gt;&lt;a href="#contents"&gt;&lt;img src="http://www.linkedmodels.org/images/uml2owl/up_arrow.jpg" width="15" height="15" /&gt;Top&lt;/a&gt;&lt;br /&gt;&lt;h3 id="overviewOfSXML"&gt;Overview of Semantic XML&lt;/h3&gt;XMI is imported into the CMOF metamodel using TopBraid Composer's &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; as a mapping method. With Semantic XML, 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. Nesting of XML elements is represented in OWL using a &lt;code&gt;composite:child&lt;/code&gt; property - an object pattern in OWL that is described at &lt;a href="http://composing-the-semantic-web.blogspot.com/2007/07/composite-design-pattern-in-rdfowl.html"&gt;this blog entry&lt;/a&gt;.&lt;br /&gt;&lt;p&gt;The key idea of Semantic XML is that each of the generated OWL classes and datatype properties is annotated with an annotation property, &lt;code&gt;sxml:element&lt;/code&gt; and &lt;code&gt;sxml:attribute&lt;/code&gt;, respectively. These properties relate the OWL concepts to the XML serialization. Note that these annotations are also used if an OWL model needs to be serialized back to XML format.&lt;/p&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. The mapping is bi-directional and loss-less so that files can be loaded, manipulated and saved without losing structural information.&lt;br /&gt;&lt;p&gt;&lt;/p&gt;A video explaining how Semantic XML works is available at &lt;a href="http://www.topbraidcomposer.com/videos/tutorials/xmap/XMap-TopBraid.wmv"&gt;this link&lt;/a&gt;.&lt;br /&gt;&lt;div&gt;&lt;a href="#contents"&gt;&lt;img src="http://www.linkedmodels.org/images/uml2owl/up_arrow.jpg" width="15" height="15" /&gt;Top&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;h3 id="ocmof"&gt;OCMOF - the OWL Representation of CMOF&lt;/h3&gt;The strategy for the transformation can be summarized as follows:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Use OWL classes to represent XMI Element Types&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Use SPARQL Rules on those classes to generate CMOF Metaclasses&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Use Metaclasses to make OWL Classes that represent the UML Model&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;An OWL metamodel of CMOF represents the kinds of containers, elements and attributes shown above. The metamodel was built by studying the UML Metamodel of UML 2.0 - the original motivation for this was to have an automated way of dealing with changes to UML. That will be a future consideration, for now this has proven to be a valuable way of doing verification and validation. The UML metamodel will be covered in Part 2 of this blog series, for Part 1, it is instructive perhaps to show a small piece of the XMI. Below is the XMI for &lt;code&gt;Basic-Property&lt;/code&gt; from the UML model &lt;code&gt;infrastructure.cmof.xmi&lt;/code&gt;.&lt;br /&gt;&lt;pre class="xmlBlock"&gt;&amp;lt;ownedAttribute xmi:type="cmof:Property"&lt;br /&gt;  xmi:id="Core-Basic-Class-ownedAttribute" name="ownedAttribute"&lt;br /&gt;  type="Core-Basic-Property" isOrdered="true"&lt;br /&gt;  upper="*" lower="0" isComposite="true"&lt;br /&gt;  association="Core-Basic-A_ownedAttribute_class"&amp;gt;&lt;br /&gt;  &amp;lt;ownedComment xmi:type="cmof:Comment"&lt;br /&gt;    xmi:id="Core-Basic-Class-ownedAttribute-_ownedComment.0"&lt;br /&gt;    annotatedElement="Core-Basic-Class-ownedAttribute"&amp;gt;&lt;br /&gt;    &amp;lt;body&amp;gt;The attributes owned by a class.&lt;br /&gt;    These do not include the inherited attributes.&lt;br /&gt;    Attributes are represented by instances of Property.&amp;lt;/body&amp;gt;&lt;br /&gt;  &amp;lt;/ownedComment&amp;gt;&lt;br /&gt; &amp;lt;/ownedAttribute&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;p class="caption"&gt;Figure 2: A fragment of the XMI for the UML metamodel&lt;/p&gt;&lt;br /&gt;&lt;p&gt;As a example of XMI element mappings, the &lt;code&gt;sxml:element&lt;/code&gt; maps the XMI element for &lt;code&gt;ocmof:ownedAttribute&lt;/code&gt; as shown in the &lt;a href="http://www.dajobe.org/2004/01/turtle/2007-09-11/"&gt;Turtle&lt;/a&gt; extract from the OWL model below.&lt;/p&gt;&lt;br /&gt;&lt;pre class="turtleBlock"&gt;ocmof:ownedAttribute&lt;br /&gt;  a  owl:Class ;&lt;br /&gt;  rdfs:label "Attribute"^^xsd:string ;&lt;br /&gt;  rdfs:subClassOf ocmof:TypedThing , ocmof:NamedThing ;&lt;br /&gt;  rdfs:subClassOf&lt;br /&gt;    [ a owl:Restriction ;&lt;br /&gt;      owl:maxCardinality "1"^^xsd:nonNegativeInteger ;&lt;br /&gt;      owl:onProperty ocmof:isComposite&lt;br /&gt;    ] ;&lt;br /&gt;  rdfs:subClassOf&lt;br /&gt;    [ a owl:Restriction ;&lt;br /&gt;      owl:maxCardinality "1"^^xsd:nonNegativeInteger ;&lt;br /&gt;      owl:onProperty ocmof:type&lt;br /&gt;    ] ;&lt;br /&gt;  rdfs:subClassOf&lt;br /&gt;    [ a  owl:Restriction ;&lt;br /&gt;      owl:maxCardinality "1"^^xsd:nonNegativeInteger ;&lt;br /&gt;      owl:onProperty ocmof:isDerivedUnion&lt;br /&gt;    ] ;&lt;br /&gt;  rdfs:subClassOf&lt;br /&gt;    [ a  owl:Restriction ;&lt;br /&gt;     owl:maxCardinality "1"^^xsd:nonNegativeInteger ;&lt;br /&gt;     owl:onProperty ocmof:isReadOnly&lt;br /&gt;    ] ;&lt;br /&gt;  rdfs:subClassOf&lt;br /&gt;    [ a  owl:Restriction ;&lt;br /&gt;      owl:maxCardinality "1"^^xsd:nonNegativeInteger ;&lt;br /&gt;      owl:onProperty ocmof:default&lt;br /&gt;    ] ;&lt;br /&gt;  sxml:element "ownedAttribute"^^xsd:string .&lt;br /&gt;&lt;/pre&gt;&lt;p class="caption"&gt;Figure 3: ocmof:ownedAttribute in Turtle&lt;/p&gt;The last line, &lt;code class="rdfStatement"&gt;sxml:element "ownedAttribute"^^xsd:string&lt;/code&gt;, is the mapping.&lt;br /&gt;&lt;p&gt;As a example of XMI attribute mappings, the &lt;code&gt;sxml:attribute&lt;/code&gt; maps the XMI attribute for &lt;code&gt;ocmof:isOrdered&lt;/code&gt; as shown in the &lt;a href="http://www.dajobe.org/2004/01/turtle/2007-09-11/"&gt;Turtle&lt;/a&gt; extract from the OWL model below.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;pre class="turtleBlock"&gt;ocmof:isOrdered&lt;br /&gt;  a owl:DatatypeProperty ;&lt;br /&gt;  rdfs:domain ocmof:ownedAttribute ,&lt;br /&gt;  ocmof:ownedParameter ,&lt;br /&gt;  ocmof:OwnedEnd ;&lt;br /&gt;  rdfs:label "is ordered"^^xsd:string ;&lt;br /&gt;  rdfs:range xsd:boolean ;&lt;br /&gt;  sxml:attribute "isOrdered"^^xsd:string .&lt;br /&gt;&lt;/pre&gt;&lt;p class="caption"&gt;&lt;/p&gt;&lt;p class="caption"&gt;Figure 4: ocmof:isOrdered in Turtle&lt;/p&gt;The last line, &lt;code class="rdfStatement"&gt;sxml:attribute "isOrdered"^^xsd:string&lt;/code&gt;, is the mapping.&lt;br /&gt;&lt;p&gt;The transformation to OWL results in the following class for &lt;code&gt;uml:Core-Basic-Property&lt;/code&gt;.&lt;br /&gt;Clicking on the image will open a larger image in a new window.&lt;br /&gt;&lt;/p&gt;&lt;a href="http://www.linkedmodels.org/images/uml2owl/core-basic-element.png" onclick="diagramPopUp(this.href); return false;"&gt;&lt;img src="http://www.linkedmodels.org/images/uml2owl/core-basic-element.png" alt="Core-Basic-Property Classes" class="center" width="590 px;" height="156 px;" /&gt;&lt;p class="caption"&gt;Figure 5: A Generated Metaclass Example - uml:Core-Basic-Property&lt;/p&gt;&lt;/a&gt;The diagram shows how the datatype properties of the class &lt;code&gt;uml:Core-Basic-Property&lt;/code&gt; correspond to the XMI attributes given in the above fragment. For example &lt;code&gt;isComposite&lt;/code&gt; becomes the property &lt;code&gt;hasBooleanIsComposite&lt;/code&gt;. The prefix &lt;code&gt;hasBoolean&lt;/code&gt;&lt;span style="font-family:monospace;"&gt; &lt;/span&gt;is customizable.&lt;br /&gt;&lt;p&gt;First an OWL model of CMOF XML Elements is used to generate instances of metaclasses to build OWL Classes for XMI Elements. The namespace prefix of &lt;code&gt;ocmof&lt;/code&gt; has been used to denote all modeling constructs that makeup the CMOF metamodel. The prefix &lt;code&gt;cmof&lt;/code&gt; is the namespace for all constructs generated from the import of the XMI files. &lt;/p&gt;&lt;p&gt;In the diagram below, we show the main classes of the metamodel. Classes like &lt;code&gt;NamedThing&lt;/code&gt; and &lt;code&gt;TypedThing&lt;/code&gt; have been introduced to optimize the work of the transformers. Constructs in XMI can typically be both named and typed. This kind of multiple inheritance is no problem for the transformations. The diagram is a partial view only. Clicking on the image will open a larger image in a new window.&lt;/p&gt;&lt;a href="http://www.linkedmodels.org/images/uml2owl/ocmof-classes.png" onclick="diagramPopUp(this.href); return false;"&gt;&lt;br /&gt;&lt;img src="http://www.linkedmodels.org/images/uml2owl/ocmof-classes.png" alt="OCMOF Classes" class="center" width="590 px;" height="224 px;" /&gt;&lt;p class="caption"&gt;Figure 6: Some of the classes of the CMOF OWL model&lt;/p&gt;&lt;/a&gt;As an alternate view, the diagram that follows is an HTML report of NamedThing in TopBraid Composer. This is automatically generated using SPARQL Web Pages (aka &lt;a href="http://uispin.org/"&gt;UISPIN&lt;/a&gt;)&lt;br /&gt;&lt;a href="http://www.linkedmodels.org/images/uml2owl/namedThing-summary.png" onclick="diagramPopUp(this.href); return false;"&gt;&lt;br /&gt;&lt;img src="http://www.linkedmodels.org/images/uml2owl/namedThing-summary.png" alt="NamedThing Summary generated by UISPIN" class="center" width="365 px;" height="451 px;" /&gt;&lt;p class="caption"&gt;Figure 7: OCMOF NamedThing - an abstract class for the transformations&lt;/p&gt;&lt;/a&gt;The diagram below shows more details of some &lt;code&gt;ownedElements&lt;/code&gt;. Note how attributes of each of these classes relate to CMOF constructs.&lt;br /&gt;&lt;a href="http://www.linkedmodels.org/images/uml2owl/ownedElements.png" onclick="diagramPopUp(this.href); return false;"&gt;&lt;br /&gt;&lt;img src="http://www.linkedmodels.org/images/uml2owl/ownedElements.png" alt="Owned Elements" class="center" width="590 px;" height="224 px;" /&gt;&lt;p class="caption"&gt;Figure 8: Some "ownedElement" OWL Classes in the OCMOF model&lt;/p&gt;&lt;/a&gt;These ocmof classes serve as the starting point for generating ocmof meta-classes and instances of these classes that become the UML model transformed into OWL. The figure below shows the main metaclasses that are generated by rules on the ocmof classes.&lt;br /&gt;&lt;a href="http://www.linkedmodels.org/images/uml2owl/cmof-metaclass.png" onclick="diagramPopUp(this.href); return false;"&gt;&lt;br /&gt;&lt;img src="http://www.linkedmodels.org/images/uml2owl/cmof-metaclass.png" alt="CMOF Metaclasses" class="center" width="590 px;" height="346 px;" /&gt;&lt;p class="caption"&gt;Figure 9: The key Meta-classes of the CMOF OWL model&lt;/p&gt;&lt;/a&gt;&lt;br /&gt;&lt;div&gt;&lt;a href="#contents"&gt;&lt;img src="http://www.linkedmodels.org/images/uml2owl/up_arrow.jpg" width="15" height="15" /&gt;Top&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;h3 id="howItWorks"&gt;How the Transformations from UML to OWL Work&lt;/h3&gt;Model-based transformations use rules associated with OWL Classes. OWL Metaclasses are built using a SPARQL rule for instances of &lt;code&gt;TypedThing&lt;/code&gt;. The names of the metaclasses are determined from the value of the &lt;code&gt;xmi:type&lt;/code&gt; attribute. A number of SPARQL Rules are defined on &lt;code&gt;TypeThing&lt;/code&gt;. Priorities are set by the alphabetic ordering given by the first comment line of the rule. These rules look after the generation of:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;UML Metaclasses&lt;br /&gt;&lt;/li&gt;&lt;li&gt;UML Classes&lt;br /&gt;&lt;/li&gt;&lt;li&gt;UML Class Superclass Relationships&lt;br /&gt;&lt;/li&gt;&lt;li&gt;UML Packages&lt;br /&gt;&lt;/li&gt;&lt;li&gt;UML Package Relationships&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;Each rule will now be described.&lt;/p&gt;&lt;br /&gt;&lt;div&gt;&lt;a href="#contents"&gt;&lt;img src="http://www.linkedmodels.org/images/uml2owl/up_arrow.jpg" width="15" height="15" /&gt;Top&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;h4 id="generationOfUMLMetaClasses"&gt;Generation of UML Metaclasses&lt;/h4&gt;The first task is to create a metaclass and class for every type of element in the ingested XMI file. This is done using the SPARQL Rule below:&lt;br /&gt;&lt;pre class="spinBlock"&gt;&lt;br /&gt;# STEP CMOF-SR-001  make UML Metaclass from CMOF type&lt;br /&gt;CONSTRUCT {&lt;br /&gt;  ?metaClassURI a rdfs:Class .&lt;br /&gt;  ?metaClassURI rdfs:subClassOf cmof:MetaClass .&lt;br /&gt;  ?metaClassURI rdfs:label ?metaClassLabel .&lt;br /&gt;  ?typeURI a owl:Class .&lt;br /&gt;  ?typeURI a ?metaClassURI .&lt;br /&gt;  ?typeURI rdfs:subClassOf uml:Construct .&lt;br /&gt;  ?typeURI rdfs:label ?classLabel .&lt;br /&gt; }&lt;br /&gt;WHERE {&lt;br /&gt;  ?this xmi:type ?type .&lt;br /&gt;  FILTER (?type != "cmof:Property") .&lt;br /&gt;  BIND (o2o:localNameOfQName(?type) AS ?name) .&lt;br /&gt;  BIND (fn:concat("CMOF ", ?name) AS ?metaClassLabel) .&lt;br /&gt;  BIND (fn:concat("UML ", ?name) AS ?classLabel) .&lt;br /&gt;  BIND (xmi.common:makeUML-URI(?name) AS ?typeURI) .&lt;br /&gt;  BIND (xmi.common:makeCMOF-URI(?name) AS ?metaClassURI) .&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;p class="caption"&gt;Figure 10: The SPARQL Rules that make the metaclasses in the OCMOF model&lt;/p&gt;What is going on in these rules? First we explain the "where" clause.&lt;br /&gt;&lt;br /&gt;&lt;div class="sparqlDetails"&gt;&lt;p class="sparqlDetails"&gt;&lt;code class="rdfStatement"&gt;?this xmi:type ?type&lt;/code&gt; binds &lt;code&gt;?this&lt;/code&gt; to an instance of &lt;code&gt;TypedThing&lt;/code&gt;. For each instance the rule is evaluated.&lt;/p&gt;&lt;p class="sparqlDetails"&gt;&lt;code class="rdfStatement"&gt;FILTER (?type != "cmof:Property")&lt;/code&gt; blocks further evaluation of the rule if the instance is of type &lt;code&gt;cmof:Property&lt;/code&gt;. The reason for this will be explained in Part 2.&lt;/p&gt;&lt;p class="sparqlDetails"&gt;&lt;code class="rdfStatement"&gt;BIND (o2o:localNameOfQName(?type) AS ?name)&lt;/code&gt; extracts the name of the type from the QName.&lt;/p&gt;&lt;p class="sparqlDetails"&gt;&lt;code class="rdfStatement"&gt;BIND (fn:concat("CMOF ", ?name) AS ?metaClassLabel )&lt;/code&gt; builds a label for the metaclass. The function &lt;code&gt;fn:concat&lt;/code&gt; is from the &lt;a href="http://jena.sourceforge.net/ARQ/library-function.html"&gt;JENA SPARQL Library&lt;/a&gt;. We use it here to prepend "CMOF" to the name we get from the type of the XMI Element.&lt;/p&gt;&lt;br /&gt;&lt;p class="sparqlDetails"&gt;&lt;code class="rdfStatement"&gt;BIND (fn:concat("UML ", ?name) AS ?classLabel)&lt;/code&gt; makes a class label from the name. We will be constructing both a metaclass and a class from the XMI type. We build a metaclass in order to say what kind of things can happen on the classes. In other words, the generated OWL model is a 3-level ontology. Likewise here we build a label for the UML Class.&lt;/p&gt;&lt;p class="sparqlDetails"&gt;&lt;code class="rdfStatement"&gt;BIND (xmi.common:makeUML-URI(?name) AS ?typeURI)&lt;/code&gt; builds a URI for the UML Class corresponding to &lt;code&gt;type&lt;/code&gt;. This uses a function call to &lt;code&gt;xmi.common:makeUML-URI&lt;/code&gt; whose job it is to build the correct namespace path for a UML construct URI. The implementation is shown below.&lt;br /&gt;&lt;/p&gt;&lt;div class="indentedSparqlDetails"&gt;&lt;pre class="spinBlock"&gt;SELECT ?uri&lt;br /&gt;WHERE {&lt;br /&gt;  BIND (xmi.common:baseURI() AS ?baseURI) .&lt;br /&gt;  BIND (smf:buildURI("{?baseURI}#{?arg1}") AS ?uri) .&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;p class="sparqlDetails"&gt;where,&lt;br /&gt;&lt;code class="rdfStatement"&gt;smf:buildURI("{?baseURI}#{?arg1}"))&lt;/code&gt; builds a URI for the name given in &lt;code&gt;?arg1&lt;/code&gt; with a base URI supplied by the function &lt;code&gt;xmi.common:baseURI()&lt;/code&gt;.&lt;/p&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;&lt;p class="sparqlDetails"&gt;&lt;code class="rdfStatement"&gt;BIND (xmi.common:makeCMOF-URI(?name) AS ?metaClassURI )&lt;/code&gt; builds a URI for the metaclass corresponding to &lt;code&gt;type&lt;/code&gt;. Likewise this constructs a namspace path for CMOF constructs.&lt;/p&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;Next we explain what is happening in the head of the rule with the &lt;code&gt;Construct&lt;/code&gt; statements. These statements use the generated URIs to create instances of meta-classes and classes.&lt;/p&gt;&lt;br /&gt;&lt;div class="sparqlDetails"&gt;&lt;p class="sparqlDetails"&gt;&lt;code class="rdfStatement"&gt;?metaClassURI a rdfs:Class&lt;/code&gt;&lt;br /&gt;gives the metaClass its type.&lt;/p&gt;&lt;br /&gt;&lt;p class="sparqlDetails"&gt;&lt;code class="rdfStatement"&gt;?metaClassURI rdfs:subClassOf cmof:MetaClass&lt;/code&gt;&lt;br /&gt;specifies that the metaclass is a sub-class of &lt;code&gt;cmof:MetaClass&lt;/code&gt; - an abstract metaclass for all cmof classes.&lt;/p&gt;&lt;p class="sparqlDetails"&gt;&lt;code class="rdfStatement"&gt;?metaClassURI rdfs:label ?metaClassLabel&lt;/code&gt;&lt;br /&gt;gives the metaclass a human label.&lt;/p&gt;&lt;p class="sparqlDetails"&gt;&lt;code class="rdfStatement"&gt;?typeURI a owl:Class&lt;/code&gt;&lt;br /&gt;gives the UML Class a type&lt;/p&gt;&lt;p class="sparqlDetails"&gt;&lt;code class="rdfStatement"&gt;?typeURI a ?metaClassURI&lt;/code&gt;&lt;br /&gt;gives the UML Class a more specific type so that it can have more properties than &lt;code&gt;owl:Class&lt;/code&gt; provides.&lt;/p&gt;&lt;p class="sparqlDetails"&gt;&lt;code class="rdfStatement"&gt;?typeURI rdfs:subClassOf uml:Construct&lt;/code&gt;&lt;br /&gt;specifies that the UML Class is a subclass of the abstract OWL Class &lt;code&gt;uml:Construct&lt;/code&gt;/&lt;/p&gt;&lt;p class="sparqlDetails"&gt;&lt;code class="rdfStatement"&gt;?typeURI rdfs:label ?classLabel&lt;/code&gt;&lt;br /&gt;gives the UML Class a human label.&lt;/p&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;a href="#contents"&gt;&lt;img src="http://www.linkedmodels.org/images/uml2owl/up_arrow.jpg" width="15" height="15" /&gt;Top&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;h4 id="generationOfUMLClasses"&gt;Generation of UML Classes&lt;/h4&gt;Once we have the necessary metaclasses we can begin the work of creating instances of those classes. These instances will, of course, be classes (the meta-world can get confusing). This work is done the the SPARQL Rule below.&lt;br /&gt;&lt;pre class="spinBlock"&gt;&lt;br /&gt;# STEP CMOF-SR-002  make UML Classes from CMOF elements&lt;br /&gt;CONSTRUCT {&lt;br /&gt;  ?type a rdfs:Class .&lt;br /&gt;  ?type rdfs:subClassOf cmof:MetaClass .&lt;br /&gt;  ?class a ?type .&lt;br /&gt;  ?class rdfs:label ?name .&lt;br /&gt;  ?class ocmof:hasCMOFbasis ?this .&lt;br /&gt;  ?superURI a owl:Class .&lt;br /&gt;  ?superURI a cmof:CategoryClass .&lt;br /&gt;  ?superURI rdfs:label ?super .&lt;br /&gt;  ?subURI a owl:Class .&lt;br /&gt;  ?subURI a cmof:CategoryClass .&lt;br /&gt;  ?subURI rdfs:subClassOf ?superURI .&lt;br /&gt;  ?subURI rdfs:label ?sub .&lt;br /&gt;  ?class rdfs:subClassOf ?mySuperClass .&lt;br /&gt;}&lt;br /&gt;WHERE {&lt;br /&gt;  ?this xmi:type "cmof:Class" .&lt;br /&gt;  ?this xmi:id ?name .&lt;br /&gt;  BIND (o2o:pathPart(?name, "-") AS ?path) .&lt;br /&gt;  OPTIONAL {&lt;br /&gt;    ?path o2o:pairHyphenIncrementally ( ?super ?sub ) .&lt;br /&gt;    BIND (xmi.common:makeUML-URI(smf:buildString("CLASSES_{?super}")) AS ?superURI) .&lt;br /&gt;    BIND (xmi.common:makeUML-URI(smf:buildString("CLASSES_{?sub}")) AS ?subURI) .&lt;br /&gt;    BIND (xmi.common:makeCMOF-Resource("cmof:Class") AS ?type) .&lt;br /&gt;    BIND (xmi.common:makeUML-URI(?name) AS ?class) .&lt;br /&gt;    } .&lt;br /&gt;  BIND (xmi.common:makeUML-URI(smf:buildString("CLASSES_{?path}")) AS ?mySuperClass) .&lt;br /&gt;  }&lt;br /&gt;&lt;/pre&gt;&lt;p class="caption"&gt;Figure 11: The SPARQL Rules that make UML Classes&lt;/p&gt;More details of this transformation will be given in Part 2 of this blog series. An interesting aspect of this particular rule to mention now is how it builds deep inheritance structures by using &lt;a href="http://jena.sourceforge.net/ARQ/extension.html"&gt;Property Functions&lt;/a&gt; to recurse over hyphenated names (more on the use of Property Functions, also known as Magic Properties, with TopBraid Composer can be found at &lt;a href="http://composing-the-semantic-web.blogspot.com/2009/11/magic-properties-with-spin.html"&gt;this blog entry&lt;/a&gt;). These hyphenated names occur throughout the XMI metamodel of UML. For example &lt;code&gt;Core-Basic-Class&lt;/code&gt; looks like:&lt;br /&gt;&lt;pre class="xmlBlock"&gt;&amp;lt;ownedMember xmi:type="cmof:Class" xmi:id="Core-Basic-Class" name="Class" superClass="Core-Basic-Type"&amp;gt;&lt;br /&gt;  &amp;lt;ownedComment xmi:type="cmof:Comment" xmi:id="Core-Basic-Class-_ownedComment.0"&lt;br /&gt;    annotatedElement="Core-Basic-Class"&amp;gt;&lt;br /&gt;    &amp;lt;body&amp;gt;A class is a type that has objects as its instances.&amp;lt;/body&amp;gt;&lt;br /&gt;  &amp;lt;/ownedComment&amp;gt;&lt;br /&gt;  &amp;lt;ownedAttribute xmi:type="cmof:Property" xmi:id="Core-Basic-Class-isAbstract"&lt;br /&gt;    name="isAbstract" type="Core-PrimitiveTypes-Boolean" default="false"&amp;gt;&lt;br /&gt;    &amp;lt;ownedComment xmi:type="cmof:Comment" xmi:id="Core-Basic-Class-isAbstract-_ownedComment.0" annotatedElement="Core-Basic-Class-isAbstract"&amp;gt;&lt;br /&gt;    &amp;lt;body&amp;gt;True when a class is abstract.&amp;lt;/body&amp;gt;&lt;br /&gt;   &amp;lt;/Attribute&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;p class="caption"&gt;Figure 12: Example of Hyphenated Names in the UML Metamodel&lt;/p&gt;&lt;br /&gt;&lt;p&gt;How this is done in the SPARQL Rule is explained briefly below.&lt;/p&gt;&lt;br /&gt;&lt;div class="sparqlDetails"&gt;&lt;p class="sparqlDetails"&gt;In the SPARQL Rule shown above in figure 11, the statement in the tail: &lt;code class="rdfStatement"&gt;?path o2o:pairHyphenIncrementally ( ?super ?sub )&lt;/code&gt; is a Property Function that returns two results: &lt;code&gt;?super&lt;/code&gt; and &lt;code&gt;?sub&lt;/code&gt; for every hypenated pair.&lt;br /&gt;for each pair the statement: &lt;code class="rdfStatement"&gt;?subURI rdfs:subClassOf ?superURI&lt;/code&gt; in the head of the rule builds superclass relationships.&lt;/p&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;a href="#contents"&gt;&lt;img src="http://www.linkedmodels.org/images/uml2owl/up_arrow.jpg" width="15" height="15" /&gt;Top&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;h4 id="generationOfUMLSubClassOfs"&gt;Generation of UML Class Superclass Relationships&lt;/h4&gt;Once we have all of the UML Classes, the next rule can build the &lt;code&gt;rdfs:subClassOf&lt;/code&gt; relationships.&lt;br /&gt;&lt;pre class="spinBlock"&gt;# STEP CMOF-SR-005 - fixup the superclass of the root Classes&lt;br /&gt;CONSTRUCT {&lt;br /&gt;  ?class rdfs:subClassOf uml:Class .&lt;br /&gt;}&lt;br /&gt;WHERE {&lt;br /&gt;  ?class a cmof:CategoryClass .&lt;br /&gt;  BIND (afn:localname(?class) AS ?className) .&lt;br /&gt;  FILTER fn:starts-with(?className, "CLASSES_") .&lt;br /&gt;  NOT EXISTS {&lt;br /&gt;  ?class rdfs:subClassOf ?superClass .&lt;br /&gt; } .&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;The result of executing the preceding UML Class rules is the UML Class Hierarchy shown in the diagram below.&lt;br /&gt;&lt;a href="http://www.linkedmodels.org/images/uml2owl/uml-classes-hierarchy.png" onclick="diagramPopUp(this.href); return false;"&gt;&lt;br /&gt;&lt;img src="http://www.linkedmodels.org/images/uml2owl/uml-classes-hierarchy.png" alt="UML Metamodel Class Hierarchy" class="center" width="404 px;" height="594 px;" /&gt;&lt;p class="caption"&gt;Figure 13: Generated UML Metamodel Class Hierarchy&lt;/p&gt;&lt;/a&gt;&lt;a href="#contents"&gt;&lt;img src="http://www.linkedmodels.org/images/uml2owl/up_arrow.jpg" width="15" height="15" /&gt;Top&lt;/a&gt;&lt;br /&gt;&lt;h4 id="generationOfUMLPackages"&gt;Generation of UML Packages&lt;/h4&gt;&lt;pre class="spinBlock"&gt;# STEP CMOF-SR-020 - make Packages&lt;br /&gt;CONSTRUCT {&lt;br /&gt;  ?package rdfs:label ?name .&lt;br /&gt;  ?package ocmof:hasCMOFbasis ?this .&lt;br /&gt;  ?mySuperClass a owl:Class .&lt;br /&gt;  ?mySuperClass rdfs:label ?path .&lt;br /&gt;  ?superURI a owl:Class .&lt;br /&gt;  ?superURI a cmof:CategoryClass .&lt;br /&gt;  ?superURI rdfs:label ?super .&lt;br /&gt;  ?subURI a owl:Class .&lt;br /&gt;  ?subURI a cmof:CategoryClass .&lt;br /&gt;  ?subURI rdfs:subClassOf ?superURI .&lt;br /&gt;  ?subURI rdfs:label ?sub .&lt;br /&gt;  ?package a ?mySuperClass .&lt;br /&gt;  ?package a uml:Package .&lt;br /&gt;}&lt;br /&gt;WHERE {&lt;br /&gt;  ?this xmi:type "cmof:Package" .&lt;br /&gt;  ?this xmi:id ?name .&lt;br /&gt;  BIND (xmi.common:makeUML-URI(?name) AS ?package) .&lt;br /&gt;  BIND (o2o:pathPart(?name, "-") AS ?path) .&lt;br /&gt;  OPTIONAL {&lt;br /&gt;    ?path o2o:pairHyphenIncrementally ( ?super ?sub ) .&lt;br /&gt;    BIND (xmi.common:makeUML-URI(smf:buildString("PACKAGES_{?super}")) AS ?superURI) .&lt;br /&gt;    BIND (xmi.common:makeUML-URI(smf:buildString("PACKAGES_{?sub}")) AS ?subURI) .&lt;br /&gt;  } .&lt;br /&gt;  BIND (xmi.common:makeUML-URI(smf:buildString("PACKAGES_{?path}")) AS ?mySuperClass) .&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;div&gt;&lt;a href="#contents"&gt;&lt;img src="http://www.linkedmodels.org/images/uml2owl/up_arrow.jpg" width="15" height="15" /&gt;Top&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;h4 id="generationOfUMLPackageRelationships"&gt;Generation of UML Package Relationships&lt;/h4&gt;&lt;br /&gt;&lt;pre class="spinBlock"&gt;# STEP CMOF-SR-024 - fixup the superclass of the root Packages&lt;br /&gt;CONSTRUCT {&lt;br /&gt;  ?packageClass rdfs:subClassOf uml:Package .&lt;br /&gt;}&lt;br /&gt;WHERE {&lt;br /&gt;  ?this xmi:type "cmof:Package" .&lt;br /&gt;  ?package ocmof:hasCMOFbasis ?this .&lt;br /&gt;  ?package a ?packageClass .&lt;br /&gt;  NOT EXISTS {&lt;br /&gt;  ?packageClass rdfs:subClassOf ?superClass .&lt;br /&gt;  } .&lt;br /&gt; }&lt;br /&gt;&lt;/pre&gt;The result of executing the preceding UML Package rules is the UML Package Hierarchy shown in the diagram below.&lt;br /&gt;&lt;a href="http://www.linkedmodels.org/images/uml2owl/uml-packages-hierarchy.png" onclick="diagramPopUp(this.href); return false;"&gt;&lt;br /&gt;&lt;img src="http://www.linkedmodels.org/images/uml2owl/uml-packages-hierarchy.png" alt="UML Metamodel Packages Hierarchy" class="center" width="404 px;" height="290 px;" /&gt;&lt;p class="caption"&gt;Figure 14: Generated UML Metamodel Package Hierarchy&lt;/p&gt;&lt;br /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div&gt;&lt;a href="#contents"&gt;&lt;img src="http://www.linkedmodels.org/images/uml2owl/up_arrow.jpg" width="15" height="15" /&gt;Top&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;h3 id="performance"&gt;Performance&lt;/h3&gt;As a measurement of the performance with the TopBraid Composer release 3.4.0, the conversion of the UML Infrastructure XMI took 38.611 seconds and generated 19,575 statements (RDF triples) on a DELL Studio XPS Laptop with 4GB of memory, running Windows 7. This translates to an inference speed of 507 TPS (Triples per second).&lt;br /&gt;&lt;div&gt;&lt;a href="#contents"&gt;&lt;img src="http://www.linkedmodels.org/images/uml2owl/up_arrow.jpg" width="15" height="15" /&gt;Top&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;h3 id="conclusion"&gt;Concluding Remarks&lt;/h3&gt;Part 1 of this blog has introduced the power of model-based transformation using SPARQL Rules as a means to transform XMI to OWL. Our experience in doing this work confirms the extensibility and flexibility of this approach. The subject is a complex one requiring a grounding in the intricacies of UML Metamodeling, and a knowledge of SPARQL and SPARQL Rules. We have attempted to do that briefly in this blog - not an easy matter.&lt;br /&gt;&lt;p&gt;Part 2 of this blog series will discuss transforming UML Models to OWL Using SPARQL.&lt;/p&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/7507012841435012041-5136363861962740422?l=topquadrantblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://topquadrantblog.blogspot.com/feeds/5136363861962740422/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7507012841435012041&amp;postID=5136363861962740422' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default/5136363861962740422'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default/5136363861962740422'/><link rel='alternate' type='text/html' href='http://topquadrantblog.blogspot.com/2011/02/converting-uml-models-to-owl-part-1.html' title='Converting UML Models to OWL - Part 1: The Approach'/><author><name>ralphtq</name><uri>http://www.blogger.com/profile/11340855777025790541</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7507012841435012041.post-5890828195364742673</id><published>2011-01-19T05:12:00.000-08:00</published><updated>2011-01-19T05:14:56.941-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='TBL'/><title type='text'>Running TopBraid Live in the Amazon EC2 cloud</title><content type='html'>&lt;span class="Apple-style-span" style="font-family: arial, helvetica; font-size: 14px; "&gt;&lt;p style="font-family: arial, helvetica; font-size: 10pt; "&gt;A &lt;a href="http://dilbert.com/strips/comic/2011-01-07"&gt;recent Dilbert strip&lt;/a&gt; inspired me to go through Dave Winer's &lt;a href="http://howto.opml.org/dave/ec2/"&gt;EC2 for Poets&lt;/a&gt; tutorial as a geeky weekend project. It was surprisingly easy and inexpensive to get a computer image running in Amazon's "Elastic Computing Cloud" (EC2) and to then get a copy of TopQuadrant's TopBraid Live running in that image.&lt;/p&gt;&lt;img src="http://www.snee.com/bobdc.blog/img/tq/tblonec2.jpg" width="590" /&gt;&lt;p style="font-family: arial, helvetica; font-size: 10pt; "&gt;These images are cheap to run, as you can see on their &lt;a href="http://aws.amazon.com/ec2/#pricing"&gt;price list&lt;/a&gt;. Note that the cost per hour of running a default Linux image is not eighty-five cents an hour when using servers in northern Virginia, but eight and a half cents. (It's an additional penny an hour when using their servers in California, Ireland, or Singapore.) If you're willing to spend a dollar or two an hour, you can get full control of some really large-scale computing power without spending much money unless you're planning some long-term use of it, in which case you'll want to compare the options with your requirements more closely than I did. You'll want one of the &lt;a href="http://aws.amazon.com/ebs/"&gt;EBS&lt;/a&gt; images, which still offers you a wide choice of platforms. Otherwise, the only way to stop a running image is to terminate it, in which case it (and all your configuration of it) is gone. With an EBS image, once you stop running it, you can always restart it.&lt;/p&gt;&lt;p style="font-family: arial, helvetica; font-size: 10pt; "&gt;I started off with an Ubuntu Linux image, but I had trouble installing Sun Java on it. After starting up a Fedora image, installing Sun Java and Tomcat were easy, and once Tomcat was installed, the installation of TopBraid Live under Tomcat according to the TBL installation instructions was simple and straightforward.&lt;/p&gt;&lt;p style="font-family: arial, helvetica; font-size: 10pt; "&gt;The ease with which I switched my efforts from Ubuntu to Fedora was an important lesson in cloud use; it sure was easier than installing Fedora over Ubuntu on a laptop hard disk, and if I decided to switch back, going back to the Ubuntu EC2 image would take seconds, unlike reverting a hard disk once I'd overwritten the Ubuntu image with Fedora. You can initialize several different images in the EC2 cloud, and if you're not running any of them, Amazon only bills you for storage, which is pennies, so you can set up several to wait for you and start and stop them whenever you like. If you want more memory, cluster processing, 64-bit instead of 32-bit, or other additional resources, you can just try it and see how it goes. This means that when you plan out the deployment of TopBraid applications using 32- or 64-bit TBL, you don't have to worry too much about having an available machine with the best possible operating system and hardware configuration, because you can experiment with different cloud images until you find the setup that's best for you. (I never tried a Windows image or SUSE or one of the other Linux images, but if I was going to roll out a production TBL application I'd explore these further as part of my planning.)&lt;/p&gt;&lt;p style="font-family: arial, helvetica; font-size: 10pt; "&gt;It's pretty impressive to think about the kind of power and flexibility that you can get when you deploy cloud-based semantic web applications, and as I found out with my little experiment, the barriers to entry for trying it out are extremely low. After 16 hours of running one instance, 3 hours of running another, and 3.1 GB of data transfer in the last few weeks, I currently owe Amazon Web Services a total of $2.29. So, if you're holding off on trying TBL because you don't have the appropriate box on which to run it, Amazon's EC2 offers some nice options to try out.&lt;/p&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7507012841435012041-5890828195364742673?l=topquadrantblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://topquadrantblog.blogspot.com/feeds/5890828195364742673/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7507012841435012041&amp;postID=5890828195364742673' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default/5890828195364742673'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default/5890828195364742673'/><link rel='alternate' type='text/html' href='http://topquadrantblog.blogspot.com/2011/01/running-topbraid-live-in-amazon-ec2.html' title='Running TopBraid Live in the Amazon EC2 cloud'/><author><name>Bob DuCharme</name><uri>http://www.blogger.com/profile/02742075186312518829</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_13zlUS8aD_8/S0OhTCeBZ8I/AAAAAAAAAAM/cGInR6wDS84/S220/128x128.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7507012841435012041.post-4908188611534429367</id><published>2010-12-29T11:10:00.000-08:00</published><updated>2010-12-29T11:13:34.106-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='EVN'/><category scheme='http://www.blogger.com/atom/ns#' term='SKOS'/><category scheme='http://www.blogger.com/atom/ns#' term='How to'/><title type='text'>How to: convert a spreadsheet to SKOS</title><content type='html'>&lt;span class="Apple-style-span" style="font-family: arial, helvetica; font-size: 13px; "&gt;&lt;p style="font-family: arial, helvetica; font-size: 10pt; "&gt;In an &lt;a href="http://bit.ly/bIbTbc"&gt;earlier&lt;/a&gt; entry, we learned how SPARQL Rules can increase the quality of taxonomies and other controlled vocabularies stored using the W3C SKOS ontology. (As I wrote there, the &lt;a href="http://www.w3.org/TR/#tr_SKOS"&gt;Simple Knowledge Organization System&lt;/a&gt;vocabulary management specification is gaining popularity because, as a standard, it makes it easier to share taxonomies and thesaurii between different systems. It also guards investments in vocabulary development against the potential problems of dependence on a proprietary vendor format.)&lt;/p&gt;&lt;p style="font-family: arial, helvetica; font-size: 10pt; "&gt;TopQuadrant's &lt;a href="http://www.topquadrant.com/solutions/ent_vocab_net.html"&gt;Enterprise Vocabulary Net&lt;/a&gt; (EVN) vocabulary manager uses SKOS as its default format for storing data. Whether you use EVN or not, a first step in systematic management of vocabularies is often the conversion of vocabularies stored in ad hoc spreadsheets—an unfortunately very popular way to store them—to SKOS, so today we'll look at how TopBraid makes this conversion easy.&lt;/p&gt;&lt;p style="font-family: arial, helvetica; font-size: 10pt; "&gt;Below is an Excel spreadsheet with some data about a few Caniformia animals. (In the Linnaeus classification of animals, Caniformia is the suborder of Carnivora, which is an order of the Mammalia class.) It shows two families of this suborder and a few genuses and species of each family, with both the Latin and common name of each species.&lt;/p&gt;&lt;img src="http://www.snee.com/bobdc.blog/img/tq/xls2skos2.jpg" /&gt;&lt;p style="font-family: arial, helvetica; font-size: 10pt; "&gt;Using a SPARQLMotion script, the basic steps of converting a spreadsheet like this to SKOS are:&lt;/p&gt;&lt;ol&gt;&lt;li style="font-family: arial, helvetica; font-size: 10pt; "&gt;&lt;p style="font-family: arial, helvetica; font-size: 10pt; "&gt;Read in the spreadsheet as a set of RDF triples.&lt;/p&gt;&lt;/li&gt;&lt;li style="font-family: arial, helvetica; font-size: 10pt; "&gt;&lt;p style="font-family: arial, helvetica; font-size: 10pt; "&gt;Use a CONSTRUCT query to convert the spreadsheet triples to SKOS triples. This is the step that varies the most from one conversion to another, because people can arrange spreadsheets any way they want, so the logic of the CONSTRUCT query has to infer the correct relationships between the values on the spreadsheet.&lt;/p&gt;&lt;/li&gt;&lt;li style="font-family: arial, helvetica; font-size: 10pt; "&gt;&lt;p style="font-family: arial, helvetica; font-size: 10pt; "&gt;Save the SKOS triples as an RDF file or in whatever format is appropriate to your applications that will use this data.&lt;/p&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p style="font-family: arial, helvetica; font-size: 10pt; "&gt;The following shows the SPARQLMotion script that I used to convert the spreadsheet above.&lt;/p&gt;&lt;img src="http://www.snee.com/bobdc.blog/img/tq/xls2skos3.jpg" /&gt;&lt;p style="font-family: arial, helvetica; font-size: 10pt; "&gt;It has a module for each of the three steps listed above and an additional &lt;tt&gt;SetBaseURIStr&lt;/tt&gt; module to set a &lt;tt&gt;?baseURIStr&lt;/tt&gt; variable. The script refers to the base URI of the output several times, and instead of hardcoding it in all those places, I decided to use this module to set this variable and to then reference the variable from other places so that resetting the base URI could be done in one place. The "set BaseURIString" module has a very simple SELECT query:&lt;/p&gt;&lt;pre style="margin-top: 14pt; margin-bottom: 14pt; margin-left: 14pt; "&gt;SELECT ?baseURIStr&lt;br /&gt;WHERE {&lt;br /&gt;    LET (?baseURIStr := "http://example.com/taxonomies/animals") .&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;p style="font-family: arial, helvetica; font-size: 10pt; "&gt;When you import an Excel file into TopBraid, the "Import Excel Cell Instances" SPARQLMotion module can pull triples from the spreadsheet with information such as the fact that a given cell has a row value of 7 (using zero-based counting), a column value of 0, a type value of "xsd:string", and "giant panda" as its contents. This level of detail can be useful for picking apart complex spreadsheets, but for simpler ones, if you instead use an "Import RDF from Workspace" module (in other words, if you have the script open the spreadsheet as if it were an RDF file), TopBraid uses the headings of the spreadsheet to identify more of the semantics of the data. For example, it would create triples saying that the thing identified as &lt;tt&gt;Row-6&lt;/tt&gt; has a &lt;tt&gt;commonName&lt;/tt&gt; value of "giant panda" and a &lt;tt&gt;genus&lt;/tt&gt; value of "Ailuropoda". This will be easier to convert to SKOS with a CONSTRUCT query.&lt;/p&gt;&lt;p style="font-family: arial, helvetica; font-size: 10pt; "&gt;There are five basic tasks that the conversion module must perform, all through the creation of triples:&lt;/p&gt;&lt;ol&gt;&lt;li style="font-family: arial, helvetica; font-size: 10pt; "&gt;&lt;p style="font-family: arial, helvetica; font-size: 10pt; "&gt;Declare that the dataset being created is an ontology.&lt;/p&gt;&lt;/li&gt;&lt;li style="font-family: arial, helvetica; font-size: 10pt; "&gt;&lt;p style="font-family: arial, helvetica; font-size: 10pt; "&gt;Import the standard W3C SKOS ontology so that we can reference its classes and properties.&lt;/p&gt;&lt;/li&gt;&lt;li style="font-family: arial, helvetica; font-size: 10pt; "&gt;&lt;p style="font-family: arial, helvetica; font-size: 10pt; "&gt;Declare a concept scheme. A SKOS vocabulary can have as many concept schemes as you like, but we'll just create one for our example.&lt;/p&gt;&lt;/li&gt;&lt;li style="font-family: arial, helvetica; font-size: 10pt; "&gt;&lt;p style="font-family: arial, helvetica; font-size: 10pt; "&gt;Declare concepts for each species, genus, and family found in the input triples, with a &lt;tt&gt;skos:broader&lt;/tt&gt; property pointing from each one to either the appropriate broader concept or, if there is none, to the concept scheme created in the previous step.&lt;/p&gt;&lt;/li&gt;&lt;li style="font-family: arial, helvetica; font-size: 10pt; "&gt;&lt;p style="font-family: arial, helvetica; font-size: 10pt; "&gt;Create triples that attach any additional metadata to the appropriate concepts—in this case, to assign the common name value to each species concept. SKOS is very flexible, so if you had additional non-SKOS properties specific to your own applications that you wanted to assign to each concept, the steps would be similar to the ones for attaching the common name values from this spreadsheet to each concept.&lt;/p&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p style="font-family: arial, helvetica; font-size: 10pt; "&gt;Whe the "Import RDF from Workspace" module reads in a spreadsheet such as caniformia.xls, it uses the spreadsheet's filename to define a prefix for the spreadsheet's properties so that it can refer to those properties with names like &lt;tt&gt;caniformia:genus&lt;/tt&gt;. After opening the spreadsheet directly in TopBraid Composer, I saw that the base URI created for the data and associated with the &lt;tt&gt;caniformia:&lt;/tt&gt; prefix was file:///xls2skos/caniformia.xls, because I had it in a project named xls2skos. I wanted to use this prefix in my SPARQLMotion script's CONSTRUCT query, so I associated this URI with the &lt;tt&gt;caniformia:&lt;/tt&gt; prefix in the Overview tab of the xls2skos.n3 file that stored the SPARQLMotion script.&lt;/p&gt;&lt;p style="font-family: arial, helvetica; font-size: 10pt; "&gt;The actual conversion takes place in the Apply Construct module that I named "convert XLSData". These modules can store multiple CONSTRUCT queries, so I used two. The first does the basic setup of the taxonomy being created, which are the first three of the five tasks listed above:&lt;/p&gt;&lt;pre style="margin-top: 14pt; margin-bottom: 14pt; margin-left: 14pt; "&gt;CONSTRUCT {&lt;br /&gt;    ?baseURI a owl:Ontology .&lt;br /&gt;    ?baseURI owl:imports &amp;lt;http://www.w3.org/2004/02/skos/core&gt; .&lt;br /&gt;    &amp;lt;http://example.com/taxonomies/animals/caniformia&gt; a skos:ConceptScheme .&lt;br /&gt;    &amp;lt;http://example.com/taxonomies/animals/caniformia&gt; rdfs:label "Caniformia" .&lt;br /&gt;}&lt;br /&gt;WHERE {&lt;br /&gt;    LET (?baseURI := smf:buildURI("&amp;lt;{?baseURIStr}&gt;")) .&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;p style="font-family: arial, helvetica; font-size: 10pt; "&gt;The second query performs steps 4 and 5:&lt;/p&gt;&lt;pre style="margin-top: 14pt; margin-bottom: 14pt; margin-left: 14pt; "&gt;CONSTRUCT {&lt;br /&gt;    ?speciesURI a skos:Concept .&lt;br /&gt;    ?genusURI a skos:Concept .&lt;br /&gt;    ?familyURI a skos:Concept .&lt;br /&gt;    ?speciesURI skos:prefLabel ?speciesName .&lt;br /&gt;    ?speciesURI skos:altLabel ?commonName .&lt;br /&gt;    ?speciesURI skos:broader ?genusURI .&lt;br /&gt;    ?genusURI skos:broader ?familyURI .&lt;br /&gt;    &amp;lt;http://example.com/taxonomies/animals/caniformia&gt; skos:hasTopConcept ?familyURI .&lt;br /&gt;}&lt;br /&gt;WHERE {&lt;br /&gt;    ?row caniformia:commonName ?commonName .&lt;br /&gt;    ?row caniformia:species ?speciesName .&lt;br /&gt;    LET (?species := smf:encodeURL(?speciesName)) .&lt;br /&gt;    LET (?speciesURI := smf:buildURI("&amp;lt;{?baseURIStr}#{?species}&gt;")) .&lt;br /&gt;    ?row caniformia:genus ?genusName .&lt;br /&gt;    LET (?genus := smf:encodeURL(?genusName)) .&lt;br /&gt;    LET (?genusURI := smf:buildURI("&amp;lt;{?baseURIStr}#{?genus}&gt;")) .&lt;br /&gt;    ?row caniformia:family ?familyName .&lt;br /&gt;    LET (?family := smf:encodeURL(?familyName)) .&lt;br /&gt;    LET (?familyURI := smf:buildURI("&amp;lt;{?baseURIStr}#{?family}&gt;")) .&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;p style="font-family: arial, helvetica; font-size: 10pt; "&gt;In addition to creating a SKOS concept for each species, it creates one for each genus and family as well, using the &lt;tt&gt;skos:broader&lt;/tt&gt; property to identify the connections between these concepts that make up the hierarchical taxonomy of terms.&lt;/p&gt;&lt;p style="font-family: arial, helvetica; font-size: 10pt; "&gt;One big decision to make with this query was how to create URIs that provided unique identifiers for each new concept being created. I knew that the species, family, and genus names must be unique, so I added those to the base URI after passing them to smf:encodeURL(), a SPARQLMotion extension function that escapes any characters that won't work well in a URI. If you have taxonomy data in a spreadsheet, there may already be a unique number or other form of ID assigned to some or all taxonomy terms that your conversion can grab so that you don't have to create URIs from the names on the spreadsheet like I did.&lt;/p&gt;&lt;p style="font-family: arial, helvetica; font-size: 10pt; "&gt;I also decided to use species names like "Canis lupus" as the &lt;tt&gt;skos:preferredLabel&lt;/tt&gt; value in the output and to use labels from the spreadsheet's "common name" column like "gray wolf" as &lt;tt&gt;skos:altLabel&lt;/tt&gt; values. If you wanted to to use common name values as preferred labels and species names as alternative labels, it would be a simple change to the query above.&lt;/p&gt;&lt;p style="font-family: arial, helvetica; font-size: 10pt; "&gt;My "convert XLSData" module also has its &lt;tt&gt;sml:replace&lt;/tt&gt; value set to &lt;tt&gt;True&lt;/tt&gt; so that it doesn't pass along the input triples to the final module, which saves the conversion result. This last module, which I named "Save as TDB", is an "Export to TDB" SPARQLMotion module that saves the conversion results using the Jena TDB format. I could have used a SPARQLMotion "Export to RDF" module, which saves triples as a Turtle or RDF/XML disk file, but I wanted to use the results of my conversion in EVN. EVN requires that you use Jena's TDB or SDB formats so that it can attach metadata to your work to support reporting and workflow tracking.&lt;/p&gt;&lt;p style="font-family: arial, helvetica; font-size: 10pt; "&gt;After running the conversion, here is one view of it in EVN:&lt;/p&gt;&lt;img src="http://www.snee.com/bobdc.blog/img/tq/xls2skos1.jpg" width="590" /&gt;&lt;p style="font-family: arial, helvetica; font-size: 10pt; "&gt;This is a minimal example using a small spreadsheet with no non-SKOS metadata. If your spreadsheet includes columns for data that don't fit easily into the SKOS model, you can use TopBraid Composer to create a customized version of SKOS that includes your own properties, and your SPARQLMotion script's conversion module can then add triples for those properties to the result. Viewing them in EVN, they would appear under &lt;b&gt;Custom Properties&lt;/b&gt; on the right. And of course, the screen shot above only hints at all that EVN lets you do with your controlled vocabulary once you convert it to SKOS.&lt;/p&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7507012841435012041-4908188611534429367?l=topquadrantblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://topquadrantblog.blogspot.com/feeds/4908188611534429367/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7507012841435012041&amp;postID=4908188611534429367' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default/4908188611534429367'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default/4908188611534429367'/><link rel='alternate' type='text/html' href='http://topquadrantblog.blogspot.com/2010/12/how-to-convert-spreadsheet-to-skos.html' title='How to: convert a spreadsheet to SKOS'/><author><name>Bob DuCharme</name><uri>http://www.blogger.com/profile/02742075186312518829</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_13zlUS8aD_8/S0OhTCeBZ8I/AAAAAAAAAAM/cGInR6wDS84/S220/128x128.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7507012841435012041.post-5822280667556208410</id><published>2010-11-10T06:59:00.000-08:00</published><updated>2010-11-10T07:03:53.344-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SPARQL'/><category scheme='http://www.blogger.com/atom/ns#' term='SPARQL Web Pages'/><title type='text'>Getting started with SPARQL Web Pages</title><content type='html'>&lt;span class="Apple-style-span" style="font-family: arial, helvetica; "&gt;&lt;p style="font-family: arial, helvetica; font-size: 10pt; "&gt;In earlier entries on this blog, we've seen how SPARQL Rules attached to classes can let you &lt;a href="http://topquadrantblog.blogspot.com/2010/08/how-to-find-skos-constraint-violations.html"&gt;identify constraint violations&lt;/a&gt; in instances of those classes and implement other kinds of business logic, all using the SPARQL standard. With release 3.4, which is now in beta, TopQuadrant products have another new application of SPARQL that lets you attach useful metadata to class definitions: descriptions of how you want the class's instances to look in a browser. We call this SPARQL Web Pages.&lt;/p&gt;&lt;p style="font-family: arial, helvetica; font-size: 10pt; "&gt;TopQuadrant vice president of product development Holger Knublauch has written several blog entries introducing SPARQL Web Pages under its original name, UISPIN, such as &lt;a href="http://composing-the-semantic-web.blogspot.com/2010/03/uispin-creating-html-and-svg-documents.html"&gt;UISPIN: Creating HTML and SVG Documents with SPARQL&lt;/a&gt;, &lt;a href="http://composing-the-semantic-web.blogspot.com/2010/04/charts-and-business-reports-with-uispin.html"&gt;Charts and Business Reports with UISPIN&lt;/a&gt;, and &lt;a href="http://composing-the-semantic-web.blogspot.com/2010/04/uispin-example-documenting-spin.html"&gt;UISPIN Example: Documenting SPIN Functions&lt;/a&gt;. In this blog entry, we'll see how to get started with a simple but useful example.&lt;/p&gt;&lt;p style="font-family: arial, helvetica; font-size: 10pt; "&gt;Address book information is not as simple to represent in RDF as one might think. A street address, city name, and postal code should be shown in a specific order, but RDF facilities for ordering the property values for a given instance can add annoying layers of complexity to a data model. Without ordering, though a simple address book entry can be difficult to read, like the following fake address shown in Turtle format:&lt;/p&gt;&lt;br /&gt;&lt;pre style="margin-top: 14pt; margin-bottom: 14pt; margin-left: 14pt; "&gt;a:Entry_1&lt;br /&gt;      rdf:type a:Entry ;&lt;br /&gt;      a:city  "San Diego" ;&lt;br /&gt;      a:email "jerry122@hotmail.com" ;&lt;br /&gt;      a:firstName "Jerry" ;&lt;br /&gt;      a:homePhone "(738) 610-2019" ;&lt;br /&gt;      a:lastName "Snyder" ;&lt;br /&gt;      a:mobile "(702) 382-4712" ;&lt;br /&gt;      a:postalCode "39248" ;&lt;br /&gt;      a:region "CA" ;&lt;br /&gt;      a:streetAddress "3137 11th Ave." .&lt;/pre&gt;&lt;br /&gt;&lt;p style="font-family: arial, helvetica; font-size: 10pt; "&gt;Using TopBraid Composer Maestro Edition, I created an RDF file with an Entry class for address book entries. I declared the properties shown above, with the Entry class as their domain, and then I added a few fake address book instances to the file. The file has a base URI of http://example.org/addressBook, which will be important later.&lt;/p&gt;&lt;p style="font-family: arial, helvetica; font-size: 10pt; "&gt;Next, I imported the html.rdf model from the UISPIN folder of the TopBraid project that is automatically added to every workspace. (In a production application, especially if I was working with a standard ontology instead of a hand-crafted little model defining an address book entry, I'd create a new file that imported the standard class and property definitions as well as html.rdf instead of adding the SPARQL Web page definitions directly into the file that defines the address book model.) The UISPIN folder also includes models to generate SVG, charts, and more; the html.rdf file lets you add HTML-generating SPARQL code to your classes. Below, you can see how I've added the ui:instanceView property from this file's model to the definition of my Entry class:&lt;/p&gt;&lt;img src="http://www.snee.com/bobdc.blog/img/tq/swebpgs1.jpg" width="590" /&gt;&lt;p style="font-family: arial, helvetica; font-size: 10pt; "&gt;When I scroll the Class View down a little, you can see what I entered as the ui:instanceView property value. It's an HTML template, with instructions for plugging in instance data, that will be output whenever TopBraid sees an instance of this class:&lt;/p&gt;&lt;img src="http://www.snee.com/bobdc.blog/img/tq/swebpgs2.jpg" /&gt;&lt;p style="font-family: arial, helvetica; font-size: 10pt; "&gt;It lays out an &lt;tt&gt;div&lt;/tt&gt; element that begins with the address entry's mailing address and then has a small table showing the entry's email address and phone numbers, with these property names bolded in the output. You can take advantage of the full power of SPARQL in these templates, as you'll see in Holger's blog entries, but I kept things simple by mostly just using the spl:object() function to insert specific property values into various places in the HTML.&lt;/p&gt;&lt;p style="font-family: arial, helvetica; font-size: 10pt; "&gt;When I view the form tab of the Entry class and click on a row in the Instances view, I see a Resource Form for that instance, like I always did:&lt;/p&gt;&lt;img src="http://www.snee.com/bobdc.blog/img/tq/swebpgs3.jpg" /&gt;&lt;p style="font-family: arial, helvetica; font-size: 10pt; "&gt;You can see a new &lt;b&gt;Browser&lt;/b&gt; tab next to the &lt;b&gt;Form&lt;/b&gt; tab, though, and it lets me see the instance view formatted according to the HTML template that I created in the ui:instanceView value:&lt;/p&gt;&lt;img src="http://www.snee.com/bobdc.blog/img/tq/swebpgs4.jpg" /&gt;&lt;p style="font-family: arial, helvetica; font-size: 10pt; "&gt;Even better, TopBraid Live can serve up the data using these HTML templates outside of TopBraid Composer, so that sending a browser to the URL&lt;a href="http://localhost:8083/tbl/uispin?_resource=http://example.org/addressBook%23Entry_1&amp;amp;_baseURI=http://example.org/addressBook"&gt;http://localhost:8083/tbl/uispin?_resource=http://example.org/addressBook%23Entry_1&amp;amp;_baseURI=http://example.org/addressBook&lt;/a&gt; displays the result in the browser (note the use of the base URI to specify the model with the data to display and the escaping of "#" as "%23"):&lt;/p&gt;&lt;img src="http://www.snee.com/bobdc.blog/img/tq/swebpgs5.jpg" width="590" /&gt;&lt;p style="font-family: arial, helvetica; font-size: 10pt; "&gt;Of course, this HTML can also have links and reference CSS, Javascript, web services, and other applications on the TBL server where it's hosted, so you can build some very sophisticated user interfaces. Check out Holger's blog entries for further ideas on where you can take this, especially when you start incorporating SPARQL queries and their results into the templates.&lt;/p&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7507012841435012041-5822280667556208410?l=topquadrantblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://topquadrantblog.blogspot.com/feeds/5822280667556208410/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7507012841435012041&amp;postID=5822280667556208410' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default/5822280667556208410'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default/5822280667556208410'/><link rel='alternate' type='text/html' href='http://topquadrantblog.blogspot.com/2010/11/getting-started-with-sparql-web-pages.html' title='Getting started with SPARQL Web Pages'/><author><name>Bob DuCharme</name><uri>http://www.blogger.com/profile/02742075186312518829</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_13zlUS8aD_8/S0OhTCeBZ8I/AAAAAAAAAAM/cGInR6wDS84/S220/128x128.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7507012841435012041.post-1804478358095467173</id><published>2010-10-27T08:44:00.000-07:00</published><updated>2010-10-27T08:49:06.416-07:00</updated><title type='text'>TopQuadrant's new Enterprise Vocabulary Manager</title><content type='html'>&lt;span class="Apple-style-span" style="font-family: arial, helvetica; font-size: 19px; "&gt;&lt;a id="id103311" href="http://www.topquadrant.com/solutions/ent_vocab_net.html"&gt;&lt;img id="id103315" src="http://www.topquadrant.com/images/TBEVN_logo.jpg" border="0" style="border-style: none;" align="right" hspace="30px" vspace="30px" alt="EVN logo" width="240px" /&gt;&lt;/a&gt;&lt;p id="id103336" style="font-family: arial, helvetica; font-size: 10pt; "&gt;The TopBraid platform can be used to build all kinds of applications and solutions. We've recently noticed one particular area where more and more customers needed help, and where semantic technology and our tools were a great fit: the management of multiple connected vocabularies spread out across an enterprise. To meet this need, we've created &lt;a id="id103345" href="http://www.topquadrant.com/solutions/ent_vocab_net.html"&gt;TopBraid Enterprise Vocabulary Net&lt;/a&gt; (EVN), a solution that works out of the box while having all the power of TopBraid Suite behind its customization capabilities.&lt;/p&gt;&lt;p id="id103356" style="font-family: arial, helvetica; font-size: 10pt; "&gt;The EVN &lt;a id="id103359" href="http://www.topquadrant.com/solutions/ent_vocab_net.html"&gt;product page&lt;/a&gt; has a long list of its features, which provide everything you need to manage taxonomies and thesaurii (and even create simple ontologies) in multi-user environments. The ability to review proposed changes before rolling them into production, with a choice of reports and other options for analyzing those changes and their potential impact, will be especially useful in larger organizations.&lt;/p&gt;&lt;p id="id103375" style="font-family: arial, helvetica; font-size: 10pt; "&gt;The use of EVN requires no knowledge of SKOS, RDF, or the related W3C standards, but the use of these standards behind EVN's graphical user interface is what makes EVN both flexible and scalable. The use of public standards for data, models, and application logic makes it much easier to integrate EVN with other systems than any other vocabulary management solutions we've seen in the marketplace. They also make it easier for EVN to let you set up an environment where different vocabularies in different parts of a large organization can work cooperatively with no need to merge those vocabularies into a single large, central vocabulary.&lt;/p&gt;&lt;p id="id103389" style="font-family: arial, helvetica; font-size: 10pt; "&gt;EVN is included in TopBraid Composer Maestro Edition release 3.4, which is now in beta, so you can try it without purchasing a separate product. For a quick overview of the features and what the product looks like, start with the&lt;a id="id103396" href="http://www.topquadrant.com/docs/marcom/TopBraid_EVN_Screenshots_Tour.pdf"&gt;screenshot tour&lt;/a&gt;, or jump right in to the tutorial included with EVN's &lt;a id="id103404" href="http://topquadrant.com/topbraid/evn/doc/"&gt;documentation&lt;/a&gt;.&lt;/p&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7507012841435012041-1804478358095467173?l=topquadrantblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://topquadrantblog.blogspot.com/feeds/1804478358095467173/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7507012841435012041&amp;postID=1804478358095467173' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default/1804478358095467173'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default/1804478358095467173'/><link rel='alternate' type='text/html' href='http://topquadrantblog.blogspot.com/2010/10/topquadrants-new-enterprise-vocabulary.html' title='TopQuadrant&apos;s new Enterprise Vocabulary Manager'/><author><name>Bob DuCharme</name><uri>http://www.blogger.com/profile/02742075186312518829</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_13zlUS8aD_8/S0OhTCeBZ8I/AAAAAAAAAAM/cGInR6wDS84/S220/128x128.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7507012841435012041.post-3954285014956025604</id><published>2010-10-04T06:54:00.000-07:00</published><updated>2010-10-04T06:57:27.149-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='How to'/><title type='text'>How to: read RSS and RDFa from the web with a SPARQLMotion script</title><content type='html'>&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: medium; "&gt;&lt;p&gt;How do you get a SPARQLMotion script to read an RSS or Atom feed as RDF triples? How do you get a SPARQLMotion script to read triples that have been embedded into web pages using RDFa? The answer to both questions is the same: use the specialized SPARQLMotion module for the task. All you have to do is specify the URL of the file with the information you want to read.&lt;/p&gt;&lt;p&gt;To demonstrate both, we'll put together a short script that:&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;p&gt;Reads the RSS feed about technology news from &lt;a href="http://www.newsweek.com/"&gt;Newsweek&lt;/a&gt; magazine&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;Pulls the triples from the RDFa embedded in the Newsweek articles described in the feed&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;Saves the extracted triples in a &lt;a href="http://www.w3.org/TeamSubmission/turtle/"&gt;Turtle&lt;/a&gt; file&lt;/p&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;Along with Dublin Core properties such as &lt;tt&gt;dc:title&lt;/tt&gt; and &lt;tt&gt;dc:description&lt;/tt&gt;, RDFa attributes in Newsweek articles store additional RDF metadata using the &lt;a href="http://developers.facebook.com/docs/opengraph"&gt;Open Graph&lt;/a&gt; vocabulary developed by Facebook. This makes it easier for Facebook to incorporate additional information about news articles in their applications—for example, if people click the Facebook button next to a Newsweek article in order to share it with their Facebook friends.&lt;/p&gt;&lt;p&gt;It also makes it easier for you to use information about these articles in your own applications. The sample application below just saves the retrieved triples in a file, but you could also pass them to other SPARQLMotion modules that could have OpenCalais analyze the text, combine the triples with data from another source, create a new, specialized RSS feed or &lt;a href="http://topquadrantblog.blogspot.com/2010/05/how-to-publish-your-linked-data-with.html"&gt;SPARQL endpoint&lt;/a&gt;, or send an email message based on the results of your processing. Retrieving the data is just the beginning.&lt;/p&gt;&lt;p&gt;To create this application, start by creating a new SPARQLMotion file called &lt;kbd class="userinput"&gt;getnewsweektech&lt;/kbd&gt;. (For more detailed background on the steps involved in creating and running a SPARQLMotion script, see the PDF tutorial &lt;a href="http://www.topquadrant.com/docs/tbc/AppDevQuickstartGuide.pdf"&gt;TopBraid Application Development Quickstart Guide&lt;/a&gt;.)&lt;/p&gt;&lt;p&gt;Create a new SPARQLMotion script in your getnewsweektech.n3 file. For its first module, select &lt;tt&gt;sml:ImportNewsFeed&lt;/tt&gt; from the&lt;tt&gt;sml:ImportFromRemoteModules&lt;/tt&gt; category and name it &lt;kbd class="userinput"&gt;GetNewsweekTechNewsFeed&lt;/kbd&gt;. To configure it, you only need to set its &lt;tt&gt;sml:url&lt;/tt&gt; value to&lt;kbd class="userinput"&gt;http://feeds.newsweek.com/newsweek/technology?format=xml&lt;/kbd&gt;, a URL I learned about from &lt;a href="http://www.newsweek.com/company/feeds.html"&gt;Newsweek's web page about their RSS feeds&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;Once this module pulls down the RSS data and TopBraid converts it to triples, your script will look through these triples for web page URLs provided as RSS link values and then retrieve the triples that are stored as RDFa in those web pages. The script can't pull the triples from all those web pages at once, so we'll use an IterateOverSelect module to drive the next step. We'll specify a SPARQL SELECT query in the IterateOverSelect module to find the RSS link values, and then for each result that this SELECT query finds, another module will retrieve the triples from the web page named by the link value.&lt;/p&gt;&lt;p&gt;Drag an &lt;strong&gt;Iterate over select&lt;/strong&gt; module from the Control Flow section of the SPARQLMotion palette and name it &lt;kbd class="userinput"&gt;GetArticleLinks&lt;/kbd&gt;. Paste the following query in as the value for its &lt;tt&gt;sml:selectQuery&lt;/tt&gt; property:&lt;/p&gt;&lt;pre class="pre"&gt;PREFIX rss: &amp;lt;http://purl.org/rss/1.0/&amp;gt; &lt;br /&gt;SELECT ?articleURLString&lt;br /&gt;WHERE {&lt;br /&gt;  ?s a rss:item .&lt;br /&gt;  ?s rss:link ?articleURL .&lt;br /&gt;  LET (?articleURLString := xsd:string(?articleURL)) .&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;p&gt;The module that retrieves the RDFa needs a string version of the URL to specify where it should look for the RDFa, so the query above assigns a string version of each &lt;tt&gt;rss:item&lt;/tt&gt; resource's &lt;tt&gt;rss:link&lt;/tt&gt; value to the variable &lt;tt&gt;?articleURLString&lt;/tt&gt;. The script will execute the body of the IterateOverSelect (a separate module that we haven't created yet) once for each value bound to this variable. You're done configuring this module.&lt;/p&gt;&lt;p&gt;Next, we'll create the body of the IterateOverSelect. This can be a series of modules, but for this application we'll only need one. Drag an&lt;strong&gt;Import RDFa&lt;/strong&gt; module from the Import from Remote section of the SPARQLMotion palette and name it &lt;kbd class="userinput"&gt;ReadArticleRDFa&lt;/kbd&gt;. When configuring this new module, click the white triangle for its &lt;tt&gt;sml:url&lt;/tt&gt; property's context menu and select &lt;span class="uicontrol" style="font-weight: bold; "&gt;Add SPARQL expression&lt;/span&gt;. This lets you add any combination of SPARQL keywords, symbols, function calls, and operators that returns a single value; for this, all you need here is the variable reference &lt;tt&gt;?articleURLString&lt;/tt&gt;. Each time this module retrieves triples from the RDFa in the web page at this URL, it will pass along the triples that it found to the next module. If this module has an &lt;tt&gt;sml:needsTidy&lt;/tt&gt; property, set it to True to make it easier to read RSS that isn't well-formed XML.&lt;/p&gt;&lt;p&gt;For our script's last module, drag an &lt;strong&gt;Export to RDF File&lt;/strong&gt; module from the palette's Export to Local section and call it &lt;kbd class="userinput"&gt;SaveArticleTriples&lt;/kbd&gt;. Set its &lt;tt&gt;sml:targetFilePath&lt;/tt&gt; value to &lt;kbd class="userinput"&gt;newsweekTech.n3&lt;/kbd&gt;; it will write this file to the directory that holds the SPARQLMotion file with your script. Set the module's &lt;tt&gt;sml:baseURI&lt;/tt&gt; to &lt;kbd class="userinput"&gt;http://example.com/newsweek/tech/metadata&lt;/kbd&gt; or to any URI that you like.&lt;/p&gt;&lt;p&gt;All that's left is to connect up the four modules as shown below. When you add a connector out of your Get Article Links &lt;strong&gt;Iterate Over Select&lt;/strong&gt;module, TopBraid Composer will ask you whether your new connector is pointing at the body of the loop (the part to execute for each binding of the selected variable) or at the module that should take control of the script when the iteration is finished. Connect Get Article Links to the Read Article RDFa module with an &lt;tt&gt;sm:body&lt;/tt&gt; link, because that's the part we want executed for each iteration, and connect Get Article Links to Save Article Triples with an &lt;tt&gt;sm:next&lt;/tt&gt; link to transfer control (and the collected triples) there when the iteration is all done.&lt;/p&gt;&lt;img src="http://www.snee.com/bobdc.blog/img/tq/rssrdfa1.jpg" alt="" /&gt;&lt;p&gt;Select the Save Article Triples module and click the green triangle at the top of the workspace to execute the script up to that final module, and you should end up with a newsweekTech.n3 file in the same directory as your getnewsweektech.n3 file that holds the script. This new file will hold triples extracted from the various web pages named in the Newsweek tech news feed.&lt;/p&gt;&lt;p&gt;To branch out, you could substitute the names of &lt;a href="http://www.newsweek.com/company/feeds.html"&gt;other Newsweek feeds&lt;/a&gt;, or additional ones, and then collect all the triples together. You could drive the whole thing with a TopBraid Ensemble interface where an end user picks the category of Newsweek news (for example, their technology, politics, business, or entertainment categories) whose metadata should be retrieved. You could also find other publications that store RDFa metadata in their articles, or other websites, such as &lt;a href="http://topquadrantblog.blogspot.com/2009/12/rdfa-on-topquadrantcom.html"&gt;TopQuadrant's&lt;/a&gt;. And, as I mentioned earlier, you could combine this with other features of SPARQLMotion and TopBraid to make a very powerful application.&lt;/p&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7507012841435012041-3954285014956025604?l=topquadrantblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://topquadrantblog.blogspot.com/feeds/3954285014956025604/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7507012841435012041&amp;postID=3954285014956025604' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default/3954285014956025604'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default/3954285014956025604'/><link rel='alternate' type='text/html' href='http://topquadrantblog.blogspot.com/2010/10/how-to-read-rss-and-rdfa-from-web-with.html' title='How to: read RSS and RDFa from the web with a SPARQLMotion script'/><author><name>Bob DuCharme</name><uri>http://www.blogger.com/profile/02742075186312518829</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_13zlUS8aD_8/S0OhTCeBZ8I/AAAAAAAAAAM/cGInR6wDS84/S220/128x128.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7507012841435012041.post-5827900262965295770</id><published>2010-08-16T07:24:00.000-07:00</published><updated>2010-08-16T07:32:29.827-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SKOS'/><category scheme='http://www.blogger.com/atom/ns#' term='How to'/><title type='text'>How to: Find SKOS constraint violations in AGROVOC with SPARQL Rules</title><content type='html'>&lt;span class="Apple-style-span"   style="  ;font-family:arial, helvetica;font-size:13px;"&gt;&lt;h1 id="id103287"   style="  font-weight: bold; font-family:arial, helvetica;font-size:24px;"&gt;&lt;span class="Apple-style-span"  style="font-weight: normal; font-size:-webkit-xxx-large;"&gt;&lt;span class="Apple-style-span"  style=" ;font-size:13px;"&gt;&lt;p id="id103292" style="font-family: arial, helvetica; font-size: 10pt; "&gt;&lt;/p&gt;&lt;h1 id="id103287"   style="  font-weight: bold; font-family:arial, helvetica;font-size:24px;"&gt;&lt;span class="Apple-style-span"  style="font-weight: normal;  font-size:13px;"&gt;The &lt;a id="id103296" href="http://www.w3.org/TR/#tr_SKOS"&gt;Simple Knowledge Organization System&lt;/a&gt; (SKOS) vocabulary management specification is gaining popularity because, as a standard, it makes it easier to share taxonomies and thesaurii between different systems. It also guards investments in vocabulary development against the potential problems of dependence on a proprietary vendor format.&lt;/span&gt;&lt;/h1&gt;&lt;div id="id103289"&gt;&lt;p id="id103310" style="font-family: arial, helvetica; font-size: 10pt; "&gt;The W3C makes an &lt;a id="id103312" href="http://www.w3.org/2004/02/skos/core.rdf"&gt;OWL ontology&lt;/a&gt; for SKOS available, which makes it easier to ensure that your vocabulary conforms to the standard. As a comment near the beginning of it tells us, though,&lt;/p&gt;&lt;blockquote id="id103324" style="font-family: arial, helvetica; font-size: 10pt; "&gt;A number of semantic conditions are *not* expressed formally in this schema. These are:&lt;br /&gt;&lt;br /&gt;S12&lt;br /&gt;S13&lt;br /&gt;S14&lt;br /&gt;S27&lt;br /&gt;S36&lt;br /&gt;S46&lt;br /&gt;&lt;br /&gt;For the conditions listed above, rdfs:comments are used to indicate the conditions.&lt;br /&gt;&lt;/blockquote&gt;&lt;p id="id103358" style="font-family: arial, helvetica; font-size: 10pt; "&gt;The comment for &lt;a id="id103361" href="http://www.w3.org/TR/2009/REC-skos-reference-20090818/#L1567"&gt;S13&lt;/a&gt; says that "skos:prefLabel, skos:altLabel and skos:hiddenLabel are pairwise disjoint properties". In plain English, this means that for a given concept, you can't use the same term for any two of these properties. For example, you shouldn't say that "dog" is both the preferred label and the alternate label for a given concept—it should be one or the other.&lt;/p&gt;&lt;p id="id103380" style="font-family: arial, helvetica; font-size: 10pt; "&gt;If these constraints are in the ontology as comments and not as something that can be implemented by executable code, how do you find violations of these constraints? The simplest way I've found is to use SPARQL Constraints (with SPIN). We've built on &lt;a id="id103387" href="http://composing-the-semantic-web.blogspot.com/2010/04/where-owl-fails.html"&gt;Paul Hermans' work&lt;/a&gt; to implement these constraints in the ontology at &lt;a id="id103396" href="http://topbraid.org/spin/skosspin"&gt;http://topbraid.org/spin/skosspin&lt;/a&gt;. It imports the W3C SKOS ontology and adds one rule to the skos:OrderedCollection class for constraint S36 and rules for the other five constraints to the skos:Concept class. For example, it adds the following three rules for constraint S13:&lt;/p&gt;&lt;pre id="id103408"&gt;# Constraint S13: skos:prefLabel, skos:altLabel and skos:hiddenLabel &lt;br /&gt;# are pairwise disjoint properties.&lt;br /&gt;ASK WHERE {&lt;br /&gt;    ?this skos:prefLabel ?label .&lt;br /&gt;    ?this skos:altLabel ?label .&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;ASK WHERE {&lt;br /&gt;    ?this skos:prefLabel ?label .&lt;br /&gt;    ?this skos:hiddenLabel ?label .&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;ASK WHERE {&lt;br /&gt;    ?this skos:hiddenLabel ?label .&lt;br /&gt;    ?this skos:altLabel ?label .&lt;br /&gt;}&lt;/pre&gt;&lt;p id="id103429" style="font-family: arial, helvetica; font-size: 10pt; "&gt;If any of these returns a boolean true, then we know that constraint S13 has been violated. (If you look at the skosspin ontology, you'll see these queries represented as triples, which is more difficult to read but easier to implement than rules expressed as SPARQL queries as shown above. TopBraid Composer can convert between the two formats, and so can a &lt;a id="id103437" href="http://sparqlpedia.org/spinrdfconverter.html"&gt;SPARQL Text to SPIN RDF Syntax Converter&lt;/a&gt; that Holger Knublauch has made available on the web.)&lt;/p&gt;&lt;p id="id103447" style="font-family: arial, helvetica; font-size: 10pt; "&gt;I tested this with the Food and Agriculture Organization of the United Nation's popular &lt;a id="id103451" href="http://aims.fao.org/website/AGROVOC-Thesaurus/sub"&gt;AGROVOC&lt;/a&gt; thesaurus, a vocabulary "designed to cover the terminology of all subject fields in agriculture, forestry, fisheries, food and related domains", and found over 1600 violations of constraint S13. Because this thesaurus has almost 29,000 concepts and preferred and alternate labels in multiple languages for most concepts, it's easier to violate these constraints than you might think, and I never would have found them without the ability to automate this search. For example, concept http://www.fao.org/aos/agrovoc#c_1135 has an English preferred label of "Buds", 14 preferred labels for other languages such as Farsi and Thai, and 24 alternate labels. Among these, the Slovak skos:prefLabel value and the Sloval skos:altLabel value are both "púèiky", so this concept violates constraint S13.&lt;/p&gt;&lt;p id="id103485" style="font-family: arial, helvetica; font-size: 10pt; "&gt;How do we find the violations? I tried it with the free edition of TopBraid Composer, because it has everything you need to define and use SPARQL Rules. (TopBraid Composer Maestro Edition's ability to use these rules from within applications has made it possible for me to add several nice features to applications for some of our clients.)&lt;/p&gt;&lt;p id="id103495" style="font-family: arial, helvetica; font-size: 10pt; "&gt;The screenshot below of TopBraid Composer's &lt;b id="id103498"&gt;Navigator&lt;/b&gt; and &lt;b id="id103502"&gt;Imports&lt;/b&gt; views shows that I created a checkAGROVOC project and added a checkAGROVOC.n3 ontology file to it. This ontology only does two things: it imports the ag_skos_080422.rdf file that I &lt;a id="id103509" href="ftp://ftp.fao.org/gi/gil/gilws/aims/kos/agrovoc_formats/skos/"&gt;downloaded from the fao.org web site&lt;/a&gt; and it imports the skosspin ontology described above for its SPARQL Rules. (It imports a web version of the skosspin ontology and, because of its 62 meg size, the local copy of the actual AGROVOC thesaurus.)&lt;/p&gt;&lt;img id="id103518" src="http://www.snee.com/bobdc.blog/img/tq/agrovoc1.jpg" width="590" /&gt;&lt;p id="id103527" style="font-family: arial, helvetica; font-size: 10pt; "&gt;With these two files imported, I opened TopBraid Composer's &lt;b id="id103530"&gt;Problems&lt;/b&gt; view and clicked that view's "Refresh all problems of current TopBraid file" icon &lt;img id="id103536" src="http://www.snee.com/bobdc.blog/img/tq/agrovoc3.jpg" /&gt;. A "Progress Information" message box told me that TopBraid Composer was "Checking SPIN constraints on skos:Concept", which took a few minutes because there were plenty to check.&lt;/p&gt;&lt;p id="id103546" style="font-family: arial, helvetica; font-size: 10pt; "&gt;After it finished checking, the &lt;b id="id103549"&gt;Problems&lt;/b&gt; view said that there were Warnings and had a plus sign that I expanded to see the first few constraint violations:&lt;/p&gt;&lt;img id="id103557" src="http://www.snee.com/bobdc.blog/img/tq/agrovoc4.jpg" width="590" /&gt;&lt;p id="id103565" style="font-family: arial, helvetica; font-size: 10pt; "&gt;(You may want to play with the column widths a bit, because the &lt;b id="id103567"&gt;Location&lt;/b&gt; column is the one you really want to see.) Double-clicking anywhere on a specific warning line shows the details about that concept on the Resource Form, like this:&lt;/p&gt;&lt;img id="id103572" src="http://www.snee.com/bobdc.blog/img/tq/agrovoc5.jpg" width="590" /&gt;&lt;p id="id103580" style="font-family: arial, helvetica; font-size: 10pt; "&gt;If you don't see the little yellow warning symbols on the Resource Form that show where the problems are, click the little "Display constraint violation warnings" icon at the top of TopBraid Composer &lt;img id="id103586" src="http://www.snee.com/bobdc.blog/img/tq/agrovoc2.jpg" /&gt;. In this case, a bit of scrolling down when viewing concept c_1002 shows that the same term appears as both Hungarian skos:altLabel and skos:prefLabel property values for this concept.&lt;/p&gt;&lt;p id="id103597" style="font-family: arial, helvetica; font-size: 10pt; "&gt;The &lt;b id="id103599"&gt;Problems&lt;/b&gt; view above only shows the first 100 of the 2,972 warnings. Clicking the context menu white triangle in the view's upper-right lets you configure Preferences for the view so that you can reset the number of items to be displayed; I had no problem with a figure of 3,000.&lt;/p&gt;&lt;p id="id103609" style="font-family: arial, helvetica; font-size: 10pt; "&gt;Now that we know what constraint has been violated, there are other ways to list the concepts that need to be corrected. For example, the following query in TopBraid Composer's &lt;b id="id103615"&gt;SPARQL&lt;/b&gt; view lists the identifiers that have the same label for these two properties:&lt;/p&gt;&lt;pre id="id103621" style="margin-top: 14pt; margin-bottom: 14pt; margin-left: 14pt; "&gt;SELECT ?s ?label&lt;br /&gt;WHERE {&lt;br /&gt;  ?s skos:prefLabel ?label . &lt;br /&gt;  ?s skos:altLabel ?label . &lt;br /&gt;}&lt;/pre&gt;&lt;p id="id103628" style="font-family: arial, helvetica; font-size: 10pt; "&gt;Once you execute this query you can export its results to a file and then use that as a reference point to address the issues in the vocabulary.&lt;/p&gt;&lt;p id="id103634" style="font-family: arial, helvetica; font-size: 10pt; "&gt;We could have started off by executing this query on the AGROVOC SKOS file, but remember, at the time we didn't know which constraints had been violated. Using SPARQL Rules as extra metadata for class definitions helps to automate the identification of quality issues with the data, letting us use other techniques to focus on the specific problems and how to fix them.&lt;/p&gt;&lt;p id="id103650" style="font-family: arial, helvetica; font-size: 10pt; "&gt;Are your SKOS vocabularies violating any of the six extra constraints described in the SKOS specification? As I mentioned, this all works with the free version of TopBraid Composer, which is available for Windows, Mac, and Linux, so you can try it yourself to find out. With the TopBraid Composer Maestro edition, you can build applications for end users who can then maintain these vocabularies with a web-based interface instead of using TopBraid Composer. The user interface for notification of constraint violations then becomes one of the many things you can customize to the needs of your end users. You can also define new constraints around your own shop's business rules—for example, to require that all labels begin with an upper-case letter—and you can set TopBraid Composer or your application to highlight these violations as soon as they occur, instead of checking in batch mode like I did above.&lt;/p&gt;&lt;p id="id103677" style="font-family: arial, helvetica; font-size: 10pt; "&gt;To summarize, what we've seen here is really just a starting point, and there are all kinds of places where you can take it to improve the consistency and value of your vocabularies.&lt;/p&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h1&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7507012841435012041-5827900262965295770?l=topquadrantblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://topquadrantblog.blogspot.com/feeds/5827900262965295770/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7507012841435012041&amp;postID=5827900262965295770' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default/5827900262965295770'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default/5827900262965295770'/><link rel='alternate' type='text/html' href='http://topquadrantblog.blogspot.com/2010/08/how-to-find-skos-constraint-violations.html' title='How to: Find SKOS constraint violations in AGROVOC with SPARQL Rules'/><author><name>Bob DuCharme</name><uri>http://www.blogger.com/profile/02742075186312518829</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_13zlUS8aD_8/S0OhTCeBZ8I/AAAAAAAAAAM/cGInR6wDS84/S220/128x128.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7507012841435012041.post-7733149769476142173</id><published>2010-07-27T06:38:00.000-07:00</published><updated>2010-07-27T06:45:36.786-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='debugger'/><category scheme='http://www.blogger.com/atom/ns#' term='SPARQLMotion'/><category scheme='http://www.blogger.com/atom/ns#' term='How to'/><title type='text'>How to: use the SPARQLMotion debugger</title><content type='html'>&lt;span class="Apple-style-span"   style="  ;font-family:Arial, Helvetica, sans-serif;font-size:medium;"&gt;&lt;p style="margin-top: 6pt; margin-right: 0px; margin-bottom: 8pt; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;Since release 3.3, TopBraid Composer has included an interactive debugger for SPARQLMotion scripts that can make your development go much faster. TopQuadrant VP of Product Development Holger Knublauch wrote a nice &lt;a href="http://composing-the-semantic-web.blogspot.com/2010/03/sparqlmotion-debugger.html" style="color: rgb(51, 51, 51); "&gt;overview of the debugger's features&lt;/a&gt; in his blog; below is a short hands-on tutorial in the use of the debugger.&lt;/p&gt;&lt;p style="margin-top: 6pt; margin-right: 0px; margin-bottom: 8pt; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;We're going to put together a short SPARQLMotion script with a problem that prevents it from running properly. Experienced SPARQLMotion developers may notice the problem when we add it, but leave it in there—we'll see how the SPARQLMotion debugger helps us locate it.&lt;/p&gt;&lt;div class="section" style="margin-top: 1em; margin-bottom: 1em; "&gt;&lt;h2 class="sectiontitle" style="font-size: 1.17em; font-weight: bold; color: black; margin-bottom: 0em; padding-bottom: 0px; font-variant: normal; line-height: 22px; margin-top: 1em; padding-top: 0px; "&gt;Creating our script&lt;/h2&gt;&lt;p style="margin-top: 6pt; margin-right: 0px; margin-bottom: 8pt; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;Our script will prompt the user for a string to search for and then list the first and last names of everyone in the sample kennedy data file included with TopBraid Composer who has that string as part of their first name.&lt;/p&gt;&lt;p style="margin-top: 6pt; margin-right: 0px; margin-bottom: 8pt; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;First, create a new SPARQLMotion file and give it a base URI of http://www.topquadrant.com/debugdemo and a file name of debugdemo. (For a more detailed description of how to create a SPARQLMotion file, see the "Creating and running a SPARQLMotion script" chapter of the &lt;a href="http://www.topquadrant.com/docs/tbc/AppDevQuickstartGuide.pdf" style="color: rgb(51, 51, 51); "&gt;TopBraid Application Development Quickstart Guide&lt;/a&gt;.)&lt;/p&gt;&lt;p style="margin-top: 6pt; margin-right: 0px; margin-bottom: 8pt; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;Once your new file is open, create the script by selecting &lt;span class="uicontrol" style="font-weight: bold; "&gt;Create SPARQLMotion Script&lt;/span&gt; from the TopBraid Composer &lt;span class="uicontrol" style="font-weight: bold; "&gt;Scripts&lt;/span&gt; menu, and for its initial module type select sml:EnterLiteral. This is the module that will ask the user to enter a query string, and you'll find it under sml:ImportModules -&gt; sml:ImportFromVariousModules. For the name of your new module instance, enter &lt;kbd class="userinput"&gt;GetQueryString&lt;/kbd&gt;. Click the &lt;span class="uicontrol" style="font-weight: bold; "&gt;OK&lt;/span&gt; button and you'll see your script on the SPARQLMotion workspace with its one module.&lt;/p&gt;&lt;p style="margin-top: 6pt; margin-right: 0px; margin-bottom: 8pt; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;Double-click the GetQueryString module icon and enter &lt;kbd class="userinput"&gt;queryString&lt;/kbd&gt; as the sm:outputVariable value and &lt;kbd class="userinput"&gt;Enter query string&lt;/kbd&gt; as the sml:text value. When the script runs, this module will display a message box that prompts the user with this message. After the user enters a value into the field on that message box, the value will be stored in the variable &lt;tt&gt;queryString&lt;/tt&gt; for use by later modules in the script. You are now done configuring this module.&lt;/p&gt;&lt;p style="margin-top: 6pt; margin-right: 0px; margin-bottom: 8pt; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;There are two more modules to add. Drag an &lt;span class="uicontrol" style="font-weight: bold; "&gt;Import RDF From Workspace&lt;/span&gt; module from the &lt;span class="uicontrol" style="font-weight: bold; "&gt;Import from Local&lt;/span&gt; section of the SPARQLMotion palette onto your workspace and name it &lt;kbd class="userinput"&gt;GetKennedysData&lt;/kbd&gt;. Double-click it to configure it, and set the sml:sourceFilePath value to &lt;kbd class="userinput"&gt;/TopBraid/Examples/kennedys.rdf&lt;/kbd&gt;. For the third and final module, drag an &lt;span class="uicontrol" style="font-weight: bold; "&gt;Apply Construct&lt;/span&gt; module from the &lt;span class="uicontrol" style="font-weight: bold; "&gt;RDF Processing&lt;/span&gt; section of the Palette and name it &lt;kbd class="userinput"&gt;FindMatchingNames&lt;/kbd&gt;. Set its sml:replace value to true so that the module passes along only the triples that it creates. Set its sml:constructQuery property to the following query:&lt;/p&gt;&lt;pre class="pre"&gt;PREFIX k: &amp;lt;http://topbraid.org/examples/kennedys#&gt;&lt;br /&gt;CONSTRUCT {   &lt;br /&gt; ?s k:firstName ?first .   &lt;br /&gt; ?s k:lastName ?last .&lt;br /&gt;} WHERE {   &lt;br /&gt; ?s k:firstName ?first .   &lt;br /&gt; ?s k:lastName ?last .   &lt;br /&gt; FILTER regex(?first, ?searchString, "i") .&lt;br /&gt;} &lt;/pre&gt;&lt;p style="margin-top: 6pt; margin-right: 0px; margin-bottom: 8pt; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;(Instead of setting the prefix for the kennedys data at the beginning of this query, you could also do it on the script file's Ontology Overview screen.) This query passes along the firstName and lastName triples for anyone in the data file who has the value of the &lt;tt&gt;searchString&lt;/tt&gt; as part of their firstName value. (The "i" provided as the third parameter to the regex() function tells it to do a case-insensitive comparison.)&lt;/p&gt;&lt;p style="margin-top: 6pt; margin-right: 0px; margin-bottom: 8pt; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;Connect up the three modules so that the script look like this:&lt;/p&gt;&lt;br /&gt;&lt;img src="http://www.snee.com/bobdc.blog/img/tq/debugger1.jpg" alt="" /&gt;&lt;br /&gt;&lt;p style="margin-top: 6pt; margin-right: 0px; margin-bottom: 8pt; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;To test the script, select the FindMatchingNames module and click the green arrow at the top of your workspace to run all the modules up to the selected one. When the GetQueryString module displays a message box asking you for a query string value, enter &lt;kbd class="userinput"&gt;Carol&lt;/kbd&gt;.When the script finishes running and you see the &lt;span class="uicontrol" style="font-weight: bold; "&gt;SPARQLMotion Script Executed&lt;/span&gt; message box, make sure that the &lt;span class="uicontrol" style="font-weight: bold; "&gt;Display result triples&lt;/span&gt; checkbox is checked before continuing so that you can see what data the script found.&lt;/p&gt;&lt;p style="margin-top: 6pt; margin-right: 0px; margin-bottom: 8pt; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;Although the kennedys data includes a Caroline and a Carolyn, you won't see any triples in the &lt;span class="uicontrol" style="font-weight: bold; "&gt;SPARQLMotion Results&lt;/span&gt; view when the script is finished running. Let's use the debugger to find out why.&lt;/p&gt;&lt;/div&gt;&lt;div class="section" style="margin-top: 1em; margin-bottom: 1em; "&gt;&lt;h2 class="sectiontitle" style="font-size: 1.17em; font-weight: bold; color: black; margin-bottom: 0em; padding-bottom: 0px; font-variant: normal; line-height: 22px; margin-top: 1em; padding-top: 0px; "&gt;Using the debugger&lt;/h2&gt;&lt;p style="margin-top: 6pt; margin-right: 0px; margin-bottom: 8pt; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;The small blue circle icon at the top of your SPARQLMotion workspace &lt;img src="http://www.snee.com/bobdc.blog/img/tq/debugger2.jpg" alt="" /&gt; toggles whether the selected icon is a debug breakpoint. On the SPARQLMotion workspace, make sure that your FindMatchingNames module is selected and then click that small blue circle. This will add a blue circle to the module icon to indicate that it is now a breakpoint. You can set as many modules you like as breakpoints, but for this exercise we'll just set this one.&lt;/p&gt;&lt;p style="margin-top: 6pt; margin-right: 0px; margin-bottom: 8pt; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;Click the green arrow to run the script again, enter "Carol" as the query string. When the script reaches the module with the breakpoint, it displays the debugger window:&lt;/p&gt;&lt;br /&gt;&lt;img src="http://www.snee.com/bobdc.blog/img/tq/debugger3.jpg" width="590" alt="" /&gt;&lt;br /&gt;&lt;p style="margin-top: 6pt; margin-right: 0px; margin-bottom: 8pt; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;The left part of the window has the Execution Plan, which lists the modules in the order that they will be executed, with a check mark next to each module that's been set as a break point. As you debug, you're free to check and uncheck any of these. The bottom of the window displays the arguments to the module and their values, and the top shows three tabs: &lt;span class="uicontrol" style="font-weight: bold; "&gt;Variables&lt;/span&gt;, &lt;span class="uicontrol" style="font-weight: bold; "&gt;Query&lt;/span&gt;, and &lt;span class="uicontrol" style="font-weight: bold; "&gt;Input Graph&lt;/span&gt;. Let's start with the last tab: click &lt;span class="uicontrol" style="font-weight: bold; "&gt;Input Graph&lt;/span&gt;.&lt;/p&gt;&lt;p style="margin-top: 6pt; margin-right: 0px; margin-bottom: 8pt; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;On the tab's &lt;span class="uicontrol" style="font-weight: bold; "&gt;Input Graph&lt;/span&gt; panel, click the plus sign, and you'll see the that kennedys data is definitely being provided as input to the FindMatchingNames module. Click that line, as shown below, and you'll see some of its data appear in the lower panel. Scrolling down there shows that CarolineKennedy and CarolynBessette are in the data being passed along, so we can't blame our script's retrieval of data for its inability to show the expected results.&lt;/p&gt;&lt;br /&gt;&lt;img src="http://www.snee.com/bobdc.blog/img/tq/debugger4.jpg" width="590" alt="" /&gt;&lt;br /&gt;&lt;p style="margin-top: 6pt; margin-right: 0px; margin-bottom: 8pt; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;Now select the debugger window's &lt;span class="uicontrol" style="font-weight: bold; "&gt;Query&lt;/span&gt; tab. This lets you execute test queries on the data passed to the module. Because FindMatchingNames is an Apply Construct module, the default query shown on the Query tab is a SELECT version of the CONSTRUCT query that you entered when you created this module.&lt;/p&gt;&lt;p style="margin-top: 6pt; margin-right: 0px; margin-bottom: 8pt; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;You can enter any SELECT query you want in in this panel of the debugger window and run it without affecting the state of the running script. Commenting and uncommenting lines of this query and then re-running it is a particularly valuable technique for exploring what information is available to your SPARQLMotion script at this point in its execution and what your application logic has done with that data.&lt;/p&gt;&lt;p style="margin-top: 6pt; margin-right: 0px; margin-bottom: 8pt; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;Perhaps the problem is in the query's FILTER expression. Add a pound sign at the beginning of that line to comment it out, and click the green triangle in the upper-right to run the SELECT query shown in the debugger window. You'll see plenty of &lt;tt&gt;s&lt;/tt&gt;, &lt;tt&gt;first&lt;/tt&gt;, and &lt;tt&gt;last&lt;/tt&gt; values appear in the lower panel, including Caroline Kennedy and Carolyn Bessette, so it looks like a problem in the FILTER expression prevented the query from passing along the requested data. The &lt;tt&gt;?first&lt;/tt&gt; variable is clearly being set properly, because we saw plenty of output when we commented out this line, so maybe the problem is with the &lt;tt&gt;?searchString&lt;/tt&gt; variable referenced in the FILTER line's regex() function call.&lt;/p&gt;&lt;p style="margin-top: 6pt; margin-right: 0px; margin-bottom: 8pt; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;Click the debugger window's &lt;span class="uicontrol" style="font-weight: bold; "&gt;Variables&lt;/span&gt; tab to display it, and you'll see the problem: the GetQueryString module stored the entered value in a variable called &lt;tt&gt;queryString&lt;/tt&gt;, and the query's FILTER expression was checking values against a non-existent &lt;tt&gt;searchString&lt;/tt&gt; variable. (In a real debugging session, the &lt;span class="uicontrol" style="font-weight: bold; "&gt;Variables&lt;/span&gt; tab is probably the first one you'd check, which is why it displays first.) Go back to the &lt;span class="uicontrol" style="font-weight: bold; "&gt;Query&lt;/span&gt; tab, uncomment the FILTER line, change ?searchString to ?queryString, and click the green arrow. You should now see Caroline Kennedy and Carolyn Bessette and no one else show up under the query in lower part of the debugger window.&lt;/p&gt;&lt;p style="margin-top: 6pt; margin-right: 0px; margin-bottom: 8pt; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;At this point, you've only fixed the debugger window's temporary query used to explore the workings of the script, and the application itself still needs to be fixed. Click the&lt;span class="uicontrol" style="font-weight: bold; "&gt;Continue&lt;/span&gt; button to resume execution of the script past the breakpoint. If there were more modules and any of them were set as break points, the &lt;span class="uicontrol" style="font-weight: bold; "&gt;Continue&lt;/span&gt; button would stop at each one and display the debugger window, but your script has no more breakpoints. (If there were more modules after FindMatchingNames module, the &lt;span class="uicontrol" style="font-weight: bold; "&gt;Step Into&lt;/span&gt; button would execute them one at a time so that you could review the three debugger tabs for information about those modules as they executed.) Once the script completes, change &lt;tt&gt;?searchString&lt;/tt&gt; to &lt;tt&gt;?queryString&lt;/tt&gt; in the FindMatchingNames module's query, click the debugger breakpoint icon while the FindMatchingNames icon is selected to turn off its breakpoint indicator, and run the query again with the same "Carol" input string. It should run with the expected results appearing in the&lt;span class="uicontrol" style="font-weight: bold; "&gt;SPARQLMotion Results&lt;/span&gt; view.&lt;/p&gt;&lt;/div&gt;&lt;div class="section" style="margin-top: 1em; margin-bottom: 1em; "&gt;&lt;h2 class="sectiontitle" style="font-size: 1.17em; font-weight: bold; color: black; margin-bottom: 0em; padding-bottom: 0px; font-variant: normal; line-height: 22px; margin-top: 1em; padding-top: 0px; "&gt;Debugging your own applications&lt;/h2&gt;&lt;p style="margin-top: 6pt; margin-right: 0px; margin-bottom: 8pt; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;Although we ran this SPARQLMotion script from within the SPARQLMotion editor, you can still set breakpoints and check all the same information about a SPARQLMotion script that is invoked from somewhere else—for example, from a TopBraid Ensemble Application or a from web service. (This assumes that the script is running under the TopBraid Live Personal Edition Server included with the TopBraid Composer Maestro Edition, which you use to develop these scripts.) This makes the debugger invaluable for just about all kinds of TopBraid development, and you'll find more uses for it as you use it more. Again, review &lt;a href="http://composing-the-semantic-web.blogspot.com/2010/03/sparqlmotion-debugger.html" style="color: rgb(51, 51, 51); "&gt;Holger's blog posting&lt;/a&gt; for additional ideas.&lt;/p&gt;&lt;/div&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7507012841435012041-7733149769476142173?l=topquadrantblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://topquadrantblog.blogspot.com/feeds/7733149769476142173/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7507012841435012041&amp;postID=7733149769476142173' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default/7733149769476142173'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default/7733149769476142173'/><link rel='alternate' type='text/html' href='http://topquadrantblog.blogspot.com/2010/07/how-to-use-sparqlmotion-debugger.html' title='How to: use the SPARQLMotion debugger'/><author><name>Bob DuCharme</name><uri>http://www.blogger.com/profile/02742075186312518829</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_13zlUS8aD_8/S0OhTCeBZ8I/AAAAAAAAAAM/cGInR6wDS84/S220/128x128.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7507012841435012041.post-2723130555497896296</id><published>2010-05-07T08:36:00.000-07:00</published><updated>2010-05-13T09:55:11.483-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='topbraid'/><category scheme='http://www.blogger.com/atom/ns#' term='SPARQL'/><category scheme='http://www.blogger.com/atom/ns#' term='SPARQL endpoint'/><category scheme='http://www.blogger.com/atom/ns#' term='How to'/><title type='text'>How to: Publish your Linked Data with TopBraid Live SPARQL Endpoints</title><content type='html'>&lt;div&gt;SPARQL endpoints are an increasingly popular way to expose linked data.  Invoking SPARQL Endpoints from TopBraid Composer's SPARQL view was the subject of a previous &lt;a href="http://topquadrantblog.blogspot.com/2010/02/how-to-get-data-from-sparql-endpoints.html"&gt;TQ blog on SPARQL Endpoints&lt;/a&gt;.In this entry we will discuss how TopBraid Live can be used to &lt;i&gt;implement&lt;/i&gt; a SPARQL Endpoint using TopBraid Live. SPARQL Endpoints are Web services that conform to the &lt;a href="http://www.w3.org/TR/rdf-sparql-protocol/"&gt;SPARQL protocol&lt;/a&gt;. SPARQL queries are passed to a URL where a SPARQL service processes the query and returns results in a defined XML format.  A number of SPARQL Endpoints exist for Web data (see the &lt;a href="http://esw.w3.org/topic/SparqlEndpoints" target="_blank"&gt;W3C list of current SPARQL Endpoints&lt;/a&gt;) and have become important sources for linked data.&lt;br /&gt;&lt;br /&gt;A SPARQL Endpoint service implementation is packaged with TopBraid Live and is available out-of-the box for both TopBraid Live Personal Server (TopBraid Composer-ME running on localhost:8083), and TopBraid Live Enterprise Server (for more information, see &lt;a href="http://www.topquadrant.com/products/TB_Live.html" target="_blank"&gt;TBL Home page&lt;/a&gt;). Creating a SPARQL Endpoint for your data is therefore an easy three-step process:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Load the model you wish to query into your TBL/TBC-ME workspace.&lt;/li&gt;&lt;li&gt;Use the GRAPH SPARQL keyword to access any named graph in the workspace.&lt;/li&gt;&lt;li&gt;Send a SPARQL query in the query string of a url that access the TBL SPARQL endpoint.&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;For example, if you have TBC-ME running, the TopBraid Live Personal Server is automatically available.  Open a browser window and enter the following URL:&lt;/p&gt;&lt;pre&gt;http://localhost:8083/tbl/sparql?query=SELECT DISTINCT ?p WHERE {GRAPH &amp;lt;http://topbraid.org/countries&amp;gt; {?s ?p ?o} }&lt;br /&gt;&lt;/pre&gt;&lt;p&gt;This URL passes a query string that is applied to the specified graph, the countries.owl example included in the  TopBraid library.  The query is passed to TopBraid Live and executed using TBL's SPARQL engine.  The results are converted to the SPARQL Endpoint format and returned via HTTP. The above URL specifies the TBL Personal Server (via TBC-ME's localhost:8083) as the endpoint.   If you have &lt;a href="http://www.topquadrant.com/products/TB_Live.html" target="_blank"&gt;TopBraid Live Enterprise Edition&lt;/a&gt; running on a server, just substitute the server address for your Enterprise server.&lt;/p&gt;&lt;p&gt;To further explore the ease of creating SPARQL Endpoints with TopBraid Live,&lt;br /&gt;&lt;a href="http://www.topquadrant.com/products/FAQ_Examples/LiveSPARQLendpoint.html" target="_blank"&gt;click here&lt;/a&gt; to access a page that defines an HTML form that submits a query to the TBL Personal Server SPARQL Endpoint.  Copy and paste the following queries that use some of the example models included in the TopBraid library.&lt;/p&gt;&lt;p&gt;This query finds all countries and their abbreviations from the countries model in TopBraid/Examples:&lt;br /&gt;&lt;/p&gt;&lt;pre&gt;# Get all countries and abbreviations from countries model&lt;br /&gt;PREFIX countries: &amp;lt;http://topbraid.org/countries#&amp;gt;&lt;br /&gt;PREFIX rdfs: &amp;lt;http://www.w3.org/2000/01/rdf-schema#&amp;gt;&lt;br /&gt;SELECT ?name ?abbrev&lt;br /&gt;WHERE&lt;br /&gt;{ GRAPH &amp;lt;http://topbraid.org/countries&amp;gt;&lt;br /&gt;  {  ?country a countries:Country .&lt;br /&gt;     ?country rdfs:label ?name .&lt;br /&gt;     ?country countries:abbreviation ?abbrev .&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;p&gt;This query finds all children of Joseph Kennedy from the kennedys model in TopBraid/Examples:&lt;br /&gt;&lt;/p&gt;&lt;pre&gt;# Find Joe Kennedy's children in kennedys model&lt;br /&gt;PREFIX k: &amp;lt;http://topbraid.org/examples/kennedys#&amp;gt;&lt;br /&gt;SELECT ?cname&lt;br /&gt;WHERE&lt;br /&gt;{ GRAPH &amp;lt;http://topbraid.org/examples/kennedys&amp;gt;&lt;br /&gt;  {  k:JosephKennedy k:child ?child .&lt;br /&gt;     ?child k:name ?cname .&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;p&gt;Again, substitute your Live server address for "localhost:8083" in the action tag of the HTML file to apply queries to your Live server.&lt;/p&gt;&lt;/div&gt;&lt;div class="section"&gt;&lt;h2 class="sectiontitle"&gt;Using SPIN functions in SPARQL Endpoints&lt;/h2&gt;&lt;p&gt;TopBraid SPARQLMotion Functions and user-defined &lt;a href="http://topquadrant.com/products/SPIN.html"&gt;SPIN&lt;/a&gt; functions registered in a Live workspace can also be used in SPARQL Endpoint queries.  For example, the following  query uses the TopBraid SPARQLMotion Function smf:if() to compute the age of all persons at death or their current age using the example kennedys model.  Instead of returning variable bindings via SELECT, this query returns a RDF graph via CONSTRUCT.  Since the graph is in RDF/XML format, the file returned by the endpoint can easily be imported into existing RDF/OWL models.&lt;br /&gt;&lt;/p&gt;&lt;pre&gt;# infer age at death or age as of 2010&lt;br /&gt;PREFIX k: &amp;lt;http://topbraid.org/examples/kennedys#&amp;gt;&lt;br /&gt;PREFIX smf: &amp;lt;http://topbraid.org/sparqlmotionfunctions#&amp;gt;&lt;br /&gt;CONSTRUCT {?person k:age ?age}&lt;br /&gt;WHERE&lt;br /&gt;{ GRAPH &amp;lt;http://topbraid.org/examples/kennedys&amp;gt;&lt;br /&gt;  {  ?person k:birthYear ?byear .&lt;br /&gt;     OPTIONAL {?person k:deathYear ?dyear}&lt;br /&gt;     LET (?age := smf:if(bound(?dyear), ?dyear-?byear, 2010-?byear))&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;p&gt;Note that the age computation is hardcoded for 2010.  A SPARQL query that returns the current year can be defined with a few statements.  An example is  shown in the kennedysSPIN model in the TopBraid Library, see TopBraid/Examples/kennedysSPIN.rdf in the Composer workspace.  If you look at the SPIN function getCurrentYear (defined as a subclass of spin:Functions, which is a subclass of spin:Modules), it finds the current year as the first four characters returned in xsd:dateTime format returned from the function afn:now().&lt;/p&gt;&lt;p&gt;Instead of copying this code into the query, let's register this as a SPIN function so it can be called by any model in the workspace, including SPARQL Endpoints. Do the following:&lt;/p&gt;&lt;ol&gt;&lt;li&gt;Re-name the file kennedysSPIN.rdf to kennedysSPIN.spin.rdf.  Adding the .spin extension registers all of the SPIN functions in this model with the workspace, allowing SPIN functions to be called without importing or opening the files.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;From the TBC-ME menu, select Scripts &amp;gt; Refresh/Display SPARQLMotion functions...  This will register the functions for the current session.  When Live or Composer is started, the system will scan the files in the workspace for .spin files and register all functions.  The extra step is needed here only if the file name was changed without stopping the Composer session.  A Deploy (Export... Deploy in Composer) to a Live server will automatically refresh scripts.&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;Now try the same query with the following changes:&lt;br /&gt;&lt;/p&gt;&lt;pre&gt;# infer age at death or age from current year&lt;br /&gt;PREFIX k: &amp;lt;http://topbraid.org/examples/kennedys#&amp;gt;&lt;br /&gt;PREFIX smf: &amp;lt;http://topbraid.org/sparqlmotionfunctions#&amp;gt;&lt;br /&gt;&lt;b&gt;PREFIX kspin: &amp;lt;http://topbraid.org/examples/kennedysSPIN#&amp;gt;&lt;/b&gt;&lt;br /&gt;CONSTRUCT {?person k:age ?age}&lt;br /&gt;WHERE&lt;br /&gt;{ GRAPH &amp;lt;http://topbraid.org/examples/kennedys&amp;gt;&lt;br /&gt;  {  ?person k:birthYear ?byear .&lt;br /&gt;     OPTIONAL {?person k:deathYear ?dyear}&lt;br /&gt;     LET (?age := smf:if(bound(?dyear), ?dyear-?byear, &lt;b&gt;kspin:getCurrentYear()&lt;/b&gt;-?byear))&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;p&gt;Note the use of the user-defined SPIN function getCurrentYear().  This feature can be used to call any SPIN function including those  that are defined by SPARQLMotion scripts.  This raises the potential of using SPARQL endpoints for a wide range of processing capabilities, including importing models from outside of a Live workspace, processing triples before querying, applying queries to inference results, integrating models from different file types, and other  kinds of SPARQL and RDFS/OWL processing.  For example, a SPARQL Endpoint request could call a SPARQLMotion script that runs standard RDFS or OWL inferences before submitting  the query, thus  returning results from both inferred and asserted triples.&lt;/p&gt;&lt;/div&gt;&lt;div class="section"&gt;&lt;h2 class="sectiontitle"&gt;Advanced SPARQL Protocol: Federated SPARQL Queries&lt;/h2&gt;&lt;p&gt;The SPARQL SERVICE keyword sends a query to remote service endpoint.  Since TopBraid Live supports the SERVICE keyword, SPARQL endpoint queries to TopBraid Live can call other SPARQL Endpoints!  Try the following query in the &lt;a href="http://www.topquadrant.com/products/FAQ_Examples/LiveSPARQLendpoint.html"target="_blank"&gt;example query form&lt;/a&gt;.&lt;/p&gt;&lt;pre&gt;&lt;br /&gt;PREFIX k: &amp;lt;http://topbraid.org/examples/kennedys#&amp;gt;&lt;br /&gt;PREFIX smf: &amp;lt;http://topbraid.org/sparqlmotionfunctions#&amp;gt;&lt;br /&gt;CONSTRUCT {?child k:birthDate ?birthdate}&lt;br /&gt;WHERE&lt;br /&gt;{ GRAPH &amp;lt;http://topbraid.org/examples/kennedys&amp;gt;&lt;br /&gt;  {  k:RoseFitzgerald k:child ?child .&lt;br /&gt;     ?child k:firstName ?fname .&lt;br /&gt;     ?child k:lastName ?lname .&lt;br /&gt;     ?child k:gender k:female .&lt;br /&gt;     ?child k:spouse ?spouse .&lt;br /&gt;     ?spouse k:lastName ?slname .&lt;br /&gt;     LET (?dbpRsc := smf:buildURI("http://dbpedia.org/resource/{?fname}_{?lname}_{?slname}"))&lt;br /&gt;&lt;br /&gt;     &lt;b&gt;SERVICE &amp;lt;http://dbpedia.org/sparql&amp;gt;&lt;br /&gt;     {  ?dbpRsc &amp;lt;http://dbpedia.org/ontology/Person/birthDate&amp;gt; ?birthdate .&lt;br /&gt;     } .&lt;/b&gt;&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;p&gt;This query is applied to the kennedys example model to query for female children of Rose Fitzgerald and sends a query to the &lt;a href="http://dbpedia.org/"&gt;DBPedia&lt;/a&gt;  SPARQL Endpoint  to find their birth dates.  The buildURI() function will generate a URI that is known in DBPedia, such as  &amp;lt;http://dbpedia.org/resource/Eunice_Kennedy_Shriver&amp;gt;.  The results from DBPedia bind the birth date to ?birthdate, which is returned in the TopBraid Live  SPARQL endpoint response.  As long as DBPedia is up and running, the result federates data from two SPARQL Endpoints, realizing the potential of linked data sources.&lt;/p&gt;&lt;/div&gt;&lt;div class="section"&gt;&lt;h2 class="sectiontitle"&gt;Conclusions&lt;/h2&gt;&lt;p&gt;SPARQL endpoints are a complement to TopBraid Live's ability to create&lt;br /&gt;&lt;a href="http://topquadrantblog.blogspot.com/2010/01/how-to-create-and-run-semantic-web.html"&gt;RESTful Web services&lt;/a&gt;. While Web services are more flexible, allowing data to be returned in any text-based format, SPARQL endpoints can be used in a variety of applications expecting SPARQL result sets in an XML format.  TopBraid Live significantly improves on existing SPARQL Endpoints with capabilities to federate queries and design functions and scripts that process data for external usage.&lt;/p&gt;&lt;p&gt;These examples demonstrate the power of TopBraid Live as an RDF back-end.  Using a straightforward HTML form, one can access to full power of TopBraid Live and advanced SPARQL queries.   These examples can be directly applied against the Personal Server version of TopBraid Live, packaged in TopBraid  Composer-Maestro Edition (TBC-ME), which is freely available for a 30-day trial.  TopBraid Live Enterprise Edition is deployed as a Tomcat servlet for Web-enabled access.  For more information, see the &lt;a href="http://www.topquadrant.com/products/TB_Live.html"&gt;TopBraid Live&lt;/a&gt; web page.&lt;br /&gt;&lt;/p&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7507012841435012041-2723130555497896296?l=topquadrantblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://topquadrantblog.blogspot.com/feeds/2723130555497896296/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7507012841435012041&amp;postID=2723130555497896296' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default/2723130555497896296'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default/2723130555497896296'/><link rel='alternate' type='text/html' href='http://topquadrantblog.blogspot.com/2010/05/how-to-publish-your-linked-data-with.html' title='How to: Publish your Linked Data with TopBraid Live SPARQL Endpoints'/><author><name>scotthenninger</name><uri>http://www.blogger.com/profile/17189585027924210998</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7507012841435012041.post-7196559093703117500</id><published>2010-04-18T14:04:00.000-07:00</published><updated>2010-09-16T08:09:23.703-07:00</updated><title type='text'>TopBraid release 3.3: three things that have already made my application development easier</title><content type='html'>&lt;div id="id103291"&gt;  &lt;p id="id103294"&gt;TopBraid Suite Release 3.3 has &lt;a id="id103298" href="http://topquadrantblog.blogspot.com/2010/04/whats-new-in-topbraid-suite-33.html"&gt;many  features&lt;/a&gt; that let you add new things to the semantic web  applications that you develop. As I've worked lately on some client  application development, three new features in particular have made this  work go more quickly and easily. &lt;/p&gt; &lt;div id="id103311"&gt;   &lt;h2 id="id103314"&gt;SPARQLMotion debugger&lt;/h2&gt; &lt;p id="id103318"&gt;The SPARQLMotion debugger lets you set breakpoints and  examine variables like any other debugger. It also lets you enter SPARQL  queries against the data available to the SPARQLMotion module where you  set the breakpoint, a feature that has made it much easier for me to  understand why a certain module was doing what it was doing instead of  what I thought it would be doing. A future entry in this blog will  describe the SPARQLMotion debugger in more detail; for now you can get a  nice tour from &lt;a id="id103329" href="http://composing-the-semantic-web.blogspot.com/2010/03/sparqlmotion-debugger.html"&gt;Holger  Knublauch's introduction&lt;/a&gt; to it. &lt;/p&gt; &lt;/div&gt; &lt;div id="id103340"&gt;   &lt;h2 id="id103342"&gt;Base URI Management&lt;/h2&gt; &lt;p id="id103346"&gt;Applications typically read and write files, but I  sometimes forget that in semantic web application development, the real  identifier for a resource such as a file is not its filename, but a URI.  After all, you can have several files with the same name in different  folders or directories, so a URI should provide a truly unique  identifier. If you somehow have the same URI representing more than one  file (for example, if you made an alternative copy of your application  development folders and used both in the same workspace), this can lead  to trouble.&lt;/p&gt; &lt;p id="id103359"&gt;Release 3.3's new "Base URI Management" screen for both  the Enterprise Server and Personal Server editions of TopBraid Live  lists the URIs of the files and other data resources being tracked in  each project and puts a warning icon next to any URI being used for more  than one resource. Once you straighten these out by assigning a new  base URI to one of the files (or, more likely, by deleting an old file  that you had forgotten was there) you'll have much better control over  the use of those resources.&lt;/p&gt; &lt;/div&gt; &lt;div id="id103373"&gt;   &lt;h2 id="id103375"&gt;Application Event Dashboard&lt;/h2&gt; &lt;p id="id103379"&gt;I recently needed to use TopBraid Ensemble's drag and  drop capability for an application I was working on. I had never used it  before, but instead of pesteringing co-workers to show me an example of  drag and drop in action, I opened up the Default TBE application with  the kennedys.owl data model, clicked the wrench icon to display the  Application Configuration screen, and went to the new Event Wiring  screen of the Application Configuration dialog box. After clicking its  Display All button, in the top list I saw that for this application the  Graph Editor and Query components had Drop listener events defined, and  in the bottom list I saw that the Grid and Tree components had Dragging  post events defined, so I knew I could drag from a Grid or Tree  component to the Graph Editor and Query components in this TBE  application. I tried dragging a few resources between these components,  and it worked; then I could examine how this was configured and  reproduce it in my own application.  &lt;/p&gt; &lt;p id="id103416"&gt;It's only been a few weeks since release 3.3 has been  out, so I'm sure I'll be growing to appreciate other new features more  in the coming months.&lt;/p&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/7507012841435012041-7196559093703117500?l=topquadrantblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://topquadrantblog.blogspot.com/feeds/7196559093703117500/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7507012841435012041&amp;postID=7196559093703117500' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default/7196559093703117500'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default/7196559093703117500'/><link rel='alternate' type='text/html' href='http://topquadrantblog.blogspot.com/2010/04/topbraid-release-33-three-things-that.html' title='TopBraid release 3.3: three things that have already made my application development easier'/><author><name>Bob DuCharme</name><uri>http://www.blogger.com/profile/02742075186312518829</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_13zlUS8aD_8/S0OhTCeBZ8I/AAAAAAAAAAM/cGInR6wDS84/S220/128x128.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7507012841435012041.post-4340358294432565166</id><published>2010-04-06T16:30:00.000-07:00</published><updated>2010-04-06T16:31:17.011-07:00</updated><title type='text'>What's new in TopBraid Suite 3.3</title><content type='html'>&lt;div id="id103298"&gt;  &lt;p id="id103301"&gt;The new 3.3 release of the TopBraid Suite includes  significant improvements to &lt;a id="id103306" href="http://www.topquadrant.com/products/TB_Composer.html"&gt;TopBraid  Composer&lt;/a&gt;, &lt;a id="id103313" href="http://www.topquadrant.com/products/TB_Ensemble.html"&gt;TopBraid  Ensemble&lt;/a&gt;, and &lt;a id="id103320" href="http://www.topquadrant.com/products/TB_Live.html"&gt;TopBraid Live&lt;/a&gt;.  For more details on the new features, see the &lt;a id="id103328" href="http://www.topquadrant.com/products/release_notes/v3_3_0.html"&gt;Release  Notes&lt;/a&gt; and &lt;a id="id103336" href="http://www.topquadrant.com/docs/versions/changes-3.3.0.txt"&gt;detailed  change list&lt;/a&gt;.&lt;/p&gt;  &lt;div id="id103345"&gt;   &lt;h2 id="id103348"&gt;TopBraid Composer&lt;/h2&gt; &lt;ul id="id103353"&gt;&lt;li id="id103355"&gt;&lt;p id="id103357"&gt;Release 3.2 let you could run a  SPARQLMotion script up to a certain point and then examine the triples  that it would have passed along, which was handy for debugging. Release  3.3 brings a real SPARQLMotion debugger, which lets you examine all  kinds of useful information at the script breakpoint: variable bindings,  the arguments passed to the current module, the result of test queries  entered at the break point, and the engine's execution plan. This will  make development of more sophisticated SPARQLMotion scripts much easier.&lt;/p&gt;&lt;/li&gt;&lt;li id="id103369"&gt;&lt;p id="id103370"&gt;More automated handling of taxonomies  and other controlled vocabularies stored using the &lt;a id="id103375" href="http://www.w3.org/TR/2009/NOTE-skos-primer-20090818/"&gt;SKOS&lt;/a&gt;  standard.&lt;/p&gt;&lt;/li&gt;&lt;li id="id103383"&gt;&lt;p id="id103384"&gt;Improved &lt;a id="id103387" href="http://www.w3.org/TR/2009/REC-owl2-primer-20091027/"&gt;OWL 2&lt;/a&gt;  support.&lt;/p&gt;&lt;/li&gt;&lt;li id="id103396"&gt;&lt;p id="id103397"&gt;The introduction of UISPIN, a  SPARQL-based framework for describing user interfaces. Just as SPIN let  you define business rules and application logic, UISPIN lets you  describe an application's visual presentation, all with RDF and standard  SPARQL underneath, and TopBraid 3.3 lets you see that definition in  action. A &lt;a id="id103405" href="http://composing-the-semantic-web.blogspot.com/2010/04/uispin-example-documenting-spin.html"&gt;recent  blog posting&lt;/a&gt; by Holger Knublauch describes a sample application.&lt;/p&gt;&lt;/li&gt;&lt;li id="id103415"&gt;&lt;p id="id103416"&gt;For customers with complex policies  on the use of open source software, the new TBC Clear and TBC-ME Clear  versions of TopBraid Composer come with open source components (outside  of Eclipse and Jena) unbundled, letting you select the components to add  back in according to your needs and policies. &lt;/p&gt;&lt;/li&gt;&lt;/ul&gt; &lt;/div&gt;  &lt;div id="id103428"&gt;   &lt;h2 id="id103431"&gt;TopBraid Ensemble&lt;/h2&gt; &lt;ul id="id103435"&gt;&lt;li id="id103437"&gt;&lt;p id="id103438"&gt;The new Application Event Dashboard  makes it much easier to track which events are used by which form  components.&lt;/p&gt;&lt;/li&gt;&lt;li id="id103444"&gt;&lt;p id="id103445"&gt;Release 3.3 gives you greater control  over form appearance. You can hide component tabs and resizing  dividers, and new components make it easier to  add white space and  formatted text.&lt;/p&gt;&lt;/li&gt;&lt;li id="id103452"&gt;&lt;p id="id103453"&gt;The form component's "Edit Mode" lets  TopBraid Ensemble application developers offer their end users new  options in how they edit data in forms.&lt;/p&gt;&lt;/li&gt;&lt;li id="id103460"&gt;&lt;p id="id103461"&gt;When SPARQLMotion scripts triggered  from TopBraid Ensemble generate HTML documents, they can be displayed in  the browser automatically.&lt;/p&gt;&lt;/li&gt;&lt;li id="id103467"&gt;&lt;p id="id103468"&gt;When someone is using an Ensemble  application, the displayed URL can be used to record and reproduce the  state of the application at that point.&lt;/p&gt;&lt;/li&gt;&lt;li id="id103474"&gt;&lt;p id="id103476"&gt;A new Flex Developer's Guide shows  how to make your own components to incorporate into your TopBraid  Ensemble applications.&lt;/p&gt;&lt;/li&gt;&lt;li id="id103481"&gt;&lt;p id="id103483"&gt;The new Basket component works like  TopBraid Composer's Basket view, serving as a "scratch pad" for  resources.&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt; &lt;/div&gt;   &lt;div id="id103491"&gt;   &lt;h2 id="id103493"&gt;TopBraid Live&lt;/h2&gt; &lt;p id="id103497"&gt;Release 3.3 of TopBraid Live gives server  administrators greater control over running sessions and the  relationship of file resources to the URIs used to identify with them.  URI conflicts and missing imports are easier to identify and resolve,  and multiuser change propagation and file indexes are also easier to  manage from the Server Administration Console.&lt;/p&gt; &lt;/div&gt;   &lt;div id="id103508"&gt;   &lt;h2 id="id103511"&gt;SPARQLMotion&lt;/h2&gt;  &lt;p id="id103515"&gt;The SPARQLMotion debugger mentioned above is built into  TopBraid Composer. You can execute SPARQLMotion scripts to drive the  execution of application logic on a TopBraid Live server from both  TopBraid Composer and from TopBraid Ensemble, so improvements to  SPARQLMotion capabilities benefit the entire TopBraid Suite. Release 3.3  makes several new things possible with SPARQLMotion scripts:&lt;/p&gt; &lt;ul id="id103525"&gt;&lt;li id="id103528"&gt;&lt;p id="id103529"&gt;A spellchecker accepts blocks of text  and returns triples that identify words not found in its configurable  dictionary, along with suggested corrections.&lt;/p&gt;&lt;/li&gt;&lt;li id="id103535"&gt;&lt;p id="id103537"&gt;For added flexibility in the use of  SPARQLMotion modules, arguments passed to them can now be SPARQL  expressions, SELECT queries, or SPIN templates.&lt;/p&gt;&lt;/li&gt;&lt;li id="id103543"&gt;&lt;p id="id103544"&gt;New SPIN functions let you build  unique URIs and compute AVG, MIN, MAX aggregations and more from the  SPARQL queries in your scripts. &lt;/p&gt;&lt;/li&gt;&lt;li id="id103550"&gt;&lt;p id="id103551"&gt;The cache-all option speeds the use  of queries against disk-based databases. &lt;/p&gt;&lt;/li&gt;&lt;/ul&gt; &lt;p id="id103558"&gt;Considering that it's a minor upgrade, there are a lot  of new toys to play with!&lt;/p&gt; &lt;/div&gt;  &lt;/div&gt; &lt;!--  Centering img: replace align with  style="display: block;margin-left: auto;margin-right: auto " hspace="30px"                ******** don't forget to run checkblogatom.bat ********   --&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7507012841435012041-4340358294432565166?l=topquadrantblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://topquadrantblog.blogspot.com/feeds/4340358294432565166/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7507012841435012041&amp;postID=4340358294432565166' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default/4340358294432565166'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default/4340358294432565166'/><link rel='alternate' type='text/html' href='http://topquadrantblog.blogspot.com/2010/04/whats-new-in-topbraid-suite-33.html' title='What&apos;s new in TopBraid Suite 3.3'/><author><name>Bob DuCharme</name><uri>http://www.blogger.com/profile/02742075186312518829</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_13zlUS8aD_8/S0OhTCeBZ8I/AAAAAAAAAAM/cGInR6wDS84/S220/128x128.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7507012841435012041.post-7836241967782196857</id><published>2010-03-21T08:32:00.000-07:00</published><updated>2010-07-27T07:04:38.138-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='How to'/><title type='text'>How to: deploy your TopBraid applications on a TopBraid Live Enterprise server</title><content type='html'>&lt;div&gt;  &lt;p&gt;&lt;i&gt;An updated version of this blog post is now available as a chapter in the TopBraid &lt;a href="http://www.topquadrant.com/docs/tbc/AppDevQuickstartGuide.pdf"&gt;Application Development Quickstart Guide&lt;/a&gt; (pdf).&lt;/i&gt;&lt;/p&gt;&lt;p&gt;So far, as we've learned how to &lt;a href="http://topquadrantblog.blogspot.com/2010/01/how-to-create-topbraid-ensemble.html"&gt;create  a TopBraid Ensemble application&lt;/a&gt;, how to &lt;a href="http://topquadrantblog.blogspot.com/2010/01/how-to-create-and-run-semantic-web.html"&gt;create  and run a semantic web service&lt;/a&gt;, and how to &lt;a href="http://topquadrantblog.blogspot.com/2010/03/how-to-call-sparqlmotion-script-from.html"&gt;call  a SPARQLMotion script from TopBraid Ensemble&lt;/a&gt;, we've always used the  TopBraid Live (TBL) Personal Server that's built into TopBraid Composer  (TBC) to test our applications. However, the reason developers create  these applications on TBC is for others to use, and that's where the &lt;a href="http://www.topquadrant.com/products/TB_Live.html"&gt;TBL Enterprise  Server&lt;/a&gt; (purchased separately from TBC) comes in.&lt;/p&gt;  &lt;p&gt;When you deploy your TopBraid applications on a Enterprise TBL  Server, many users can use your applications simultaneously, and none of  them need a copy of TopBraid Composer. In this posting, we'll see how  simple it is to copy your applications to a TBL Enterprise Server where  you end users have access to them. (And remember, those "end users"  aren't always people; when you deploy a semantic web service to a TBL  Enterprise Server, it can be a first-class member of any number of  Service-Oriented Architecture applications, serving as a building block  for larger applications by fulfilling requests from automated processes  elsewhere in the architecture.)&lt;/p&gt;   &lt;div class="section"&gt;&lt;h2 class="sectiontitle"&gt;Referencing your server&lt;/h2&gt;    &lt;p&gt;In the following example, I'm going to deploy an application to a TBL  Enterprise Server running on my local machine and configured as a  Tomcat servlet listening to port 8080, making the URL of the server  http://localhost:8080/tbl/tbl. If the Enterprise Server was installed on  a host named www.domain.com and used the same port, the URL would be  http://www.domain.com:8080/tbl/tbl, so you would follow the same steps,  substituting that name. &lt;/p&gt;     &lt;/div&gt;    &lt;div class="section"&gt;&lt;h2 class="sectiontitle"&gt;Deploying apps to the  server&lt;/h2&gt;     &lt;p&gt;If you package all the files needed to run an application in a single  project, which is a root file in TBC's &lt;span class="uicontrol"&gt;Navigator&lt;/span&gt;  view, it's a convenient way to upload a collection of related files to  the TBL Enterprise Server. So, for example, if the &lt;span class="filepath"&gt;personScripts.sms.n3&lt;/span&gt; file that you created in  the &lt;a href="http://topquadrantblog.blogspot.com/2010/03/how-to-call-sparqlmotion-script-from.html"&gt;last  posting&lt;/a&gt; is not in its own project, create one called personProject  and move it there.&lt;/p&gt;  &lt;p&gt;Right-click on the project folder icon in TBC's &lt;span class="uicontrol"&gt;Navigator&lt;/span&gt; view and pick Export. On the &lt;span class="uicontrol"&gt;Export&lt;/span&gt; dialog box, select "Deploy Project to  TopBraid Live Server" from the TopBraid Composer section of the menu and  click the &lt;span class="uicontrol"&gt;Next&lt;/span&gt; button. &lt;/p&gt;  &lt;p&gt;On the &lt;span class="uicontrol"&gt;Deploy Project to TopBraid Live Server&lt;/span&gt;  dialog box that appears, enter the URL of the server where you want to  send your app (for example, http://localhost:8080/tbl/tbl, as described  above) in the &lt;span class="uicontrol"&gt;Server URL&lt;/span&gt; field. The  remaining fields are self-explanatory: enter a user name and password if  the server was set up to require it (always a good idea for serious  production applications) and check "Overwrite existing project with the  same name" if there is any chance that a project with that name already  exists. &lt;/p&gt;   &lt;p&gt;Click the &lt;span class="uicontrol"&gt;Finish&lt;/span&gt; button, and TBC will  show you upload progress and then let you know it's finished:&lt;/p&gt;   &lt;img src="http://www.snee.com/bobdc.blog/img/tq/howtoDeploy1.jpg" alt="" width="340" /&gt;  &lt;p&gt;If you sent a project with the personScripts.sms.n3 file created in  the &lt;a href="http://topquadrantblog.blogspot.com/2010/03/how-to-call-sparqlmotion-script-from.html"&gt;How  to: call a SPARQLMotion script from TopBraid Ensemble&lt;/a&gt; posting to  the Enterprise server, and a different computer can access that one as  http://www.domain.com:8080/tbl/tbl/ or http://192.168.1.2:8080/tbl/tbl/,  then sending a browser on the other computer to one of these URLs will  display the TopBraid Suite Console screen. On that computer you can then  follow all the steps described in that posting's "Testing It" section,  even though you're doing it remotely, right up through the use of the  "Age at Death" menu choice that you implemented. &lt;/p&gt;   &lt;p&gt;You can upload a web service to the Enterprise TBL server the same  way. For example, in &lt;a href="http://topquadrantblog.blogspot.com/2010/01/how-to-create-and-run-semantic-web.html"&gt;How  to: create and run a semantic web service&lt;/a&gt; we saw that after  defining a web service in the file ws1.sms.n3 and registering the  function that invokes the service by selecting "Refresh/Display  SPARQLMotion functions" from the TBC Script menu, you could test this  web service by entering the following URL in a browser:&lt;/p&gt;  &lt;pre class="pre"&gt;http://localhost:8083/tbl/actions?action=sparqlmotion&amp;amp;id=searchKennedys&amp;amp;arg1=Rob&lt;br /&gt;&lt;/pre&gt;  &lt;p&gt;This sent the request to the TBL Personal Server included with TBC.  To deploy the web service on the Enterprise Server, upload the project  that holds the ws1.sms.n3 file file as described above. Then, if the  server is running on the local machine and listening to port 8080, you  can test it with the following URL:&lt;/p&gt;  &lt;pre class="pre"&gt;http://localhost:8080/tbl/tbl/actions?action=sparqlmotion&amp;amp;id=searchKennedys&amp;amp;arg1=Rob&lt;br /&gt;&lt;/pre&gt;  &lt;p&gt;To call this web service from another computer on the same network  (which could be another one on your intranet, or could be a computer on  the public internet if the machine running the TBL Enterprise Server is  accessible there), substitute the appropriate computer name or IP  address for "localhost" in that URL.  &lt;/p&gt;   &lt;/div&gt;   &lt;div class="section"&gt;&lt;h2 class="sectiontitle"&gt;Installing TopBraid  Ensemble Apps on the Enterprise Server&lt;/h2&gt;   &lt;p&gt;As we've seen in an earlier posting, when you &lt;a href="http://topquadrantblog.blogspot.com/2010/01/how-to-create-topbraid-ensemble.html"&gt;create  a TopBraid Ensemble (TBE) application&lt;/a&gt;, you save your screen layout  with the Save App button. After clicking this button, the &lt;span class="uicontrol"&gt;Save To&lt;/span&gt; field on the &lt;span class="uicontrol"&gt;Save  Application As&lt;/span&gt; dialog box shows server.topbraidlive.org as the  default project in which to save the application, but you can select  another one. (You can't create a new project from within TBE, so if you  want to save the application in a particular project, make sure you've  already created that project you need in TBC's &lt;span class="uicontrol"&gt;Navigator&lt;/span&gt;  view.)&lt;/p&gt;  &lt;p&gt;If you named your TBE application MyTBEApp and saved it in the  project MyTBEProj, in TBC's &lt;span class="uicontrol"&gt;Navigator&lt;/span&gt;  view you'll see that it stored &lt;span class="filepath"&gt;MyTBEApp.n3&lt;/span&gt;  in a subdirectory of MyTBEProj named &lt;span class="filepath"&gt;user-applications&lt;/span&gt;.  Once you upload the MyTBEProj project to the TBL Enterprise Server the  same way you uploaded the other projects described above, you'll see  MyTBEApp listed on the right side of TopBraid Live's TopBraid Suite  Console screen at http://localhost:8080/tbl/tbl/ under the column  heading "Applications Under Development":&lt;/p&gt;   &lt;img src="http://www.snee.com/bobdc.blog/img/tq/howtoDeploy2.jpg" alt="" width="590" /&gt;   &lt;p&gt;When you click the application name on the TopBraidSuite Console, if  it wasn't saved with a particular set of data, it will prompt you to  pick one. Once you see the application screen you designed, your  browser's navigation toolbar will show the URL that you would use to  send users directly to that application once you substituted the  computer name for "localhost" as described above. It will be a long URL,  so instead of actually giving that URL to your users, you'd be more  likely to use it as the &lt;tt&gt;href&lt;/tt&gt; value of a link on a web page that  takes them to the application. &lt;/p&gt;   &lt;p&gt;TopBraid Composer puts a lot of capabilities at your fingertips. When  you copy the web services, TBE applications, and any SPARQLMotion  scripts called by those TBE applications from TBC to a TBL Enterprise  Server, you can make the power of your semantic web applications  available to a wide range of people and applications throughout your  enterprise or even throughout the World Wide Web. That's a lot of power.&lt;/p&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/7507012841435012041-7836241967782196857?l=topquadrantblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://topquadrantblog.blogspot.com/feeds/7836241967782196857/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7507012841435012041&amp;postID=7836241967782196857' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default/7836241967782196857'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default/7836241967782196857'/><link rel='alternate' type='text/html' href='http://topquadrantblog.blogspot.com/2010/03/how-to-deploy-your-topbraid.html' title='How to: deploy your TopBraid applications on a TopBraid Live Enterprise server'/><author><name>Bob DuCharme</name><uri>http://www.blogger.com/profile/02742075186312518829</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_13zlUS8aD_8/S0OhTCeBZ8I/AAAAAAAAAAM/cGInR6wDS84/S220/128x128.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7507012841435012041.post-6378755461440346696</id><published>2010-03-05T15:18:00.000-08:00</published><updated>2010-07-27T07:06:02.616-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='How to'/><title type='text'>How to: call a SPARQLMotion script from TopBraid Ensemble</title><content type='html'>&lt;p&gt;&lt;i&gt;An updated version of this blog post is now available as a chapter in the TopBraid &lt;a href="http://www.topquadrant.com/docs/tbc/AppDevQuickstartGuide.pdf"&gt;Application Development Quickstart Guide&lt;/a&gt; (pdf).&lt;/i&gt;&lt;/p&gt;&lt;br /&gt;&lt;a name="smtbe"&gt;&lt;!-- --&gt;&lt;/a&gt;In earlier entries, we've seen how to &lt;a href="http://topquadrantblog.blogspot.com/2010/01/how-to-create-topbraid-ensemble.html"&gt;create a TopBraid Ensemble application&lt;/a&gt; and how to &lt;a href="http://topquadrantblog.blogspot.com/2010/01/how-to-create-and-run-semantic-web.html"&gt;create and run a semantic web service&lt;/a&gt;. When you combine these, the user interface that you create with TopBraid Ensemble (TBE) can take advantage of all the power of SPARQLMotion scripts, which can accept parameters from a TBE app, run in the background, and pass the results back to be incorporated into the TBE user interface. &lt;div&gt;  &lt;p&gt;In this posting, we'll see how to add an "Age at death" choice to the TBE gear menu, which triggers SPARQLMotion scripts. When your end user selects a person in the kennedy data and picks this menu choice, a SPARQLMotion script will return either a message about the person's age at death (assuming that they've already had their birthday in the year of their death) or the phrase "Still alive" for display in TBE. &lt;/p&gt;   &lt;div class="section"&gt;&lt;h2 class="sectiontitle"&gt;Defining the function to call&lt;/h2&gt; &lt;p&gt;As we saw in the posting on creating web services, the first step is to define a SPIN function that points to a SPARQLMotion script, and then we create the script. (The following description assumes that you've read the more detailed description of the same steps in &lt;a href="http://topquadrantblog.blogspot.com/2010/01/how-to-create-and-run-semantic-web.html"&gt;How to: create and run a semantic web service&lt;/a&gt;.) Start by creating a new SPARQLMotion file called personScripts, and remember to check "Script will declare (Web) Services or Functions (.sms extension)" on the &lt;span class="uicontrol"&gt;Create SPARQLMotion File&lt;/span&gt; dialog box. &lt;/p&gt;  &lt;p&gt;Next, in the &lt;span class="uicontrol"&gt;Classes&lt;/span&gt; view, create a subclass of &lt;tt&gt;spin:Functions&lt;/tt&gt; called &lt;tt&gt;AgeAtDeath&lt;/tt&gt;. The &lt;tt&gt;rdfs:label&lt;/tt&gt; value for this function is important, because that's the text that will appear on the TBE gear menu; drag this property from the &lt;span class="uicontrol"&gt;Properties&lt;/span&gt; view onto the class form for your new function and enter "Age at death" there. &lt;/p&gt;  &lt;p&gt;The next step is to use the function's &lt;tt&gt;spin:constraint&lt;/tt&gt; property to identify the argument being passed to the function. For our new application, we want the argument to be the identifier for the currently selected member of the Kennedy family in the TBE application—or, in TBE development terms, the URI for the selected resource—so that the function knows whose age at death to calculate. To make the selected resource the argument, on the &lt;tt&gt;AgeAtDeath&lt;/tt&gt; class form click the &lt;tt&gt;spin:constraint&lt;/tt&gt; property's white triangle context menu and pick "Create from SPIN template". On the &lt;span class="uicontrol"&gt;Create from SPIN template&lt;/span&gt; dialog box, pick &lt;tt&gt;sml:SelectedResourceArgument&lt;/tt&gt; from the selection of "Available Ask/Construct Templates". Click the plus sign next to the &lt;tt&gt;predicate&lt;/tt&gt; field and pick &lt;tt&gt;sml:selectedResource&lt;/tt&gt;.   You're now finished specifying the &lt;tt&gt;spin:constraint&lt;/tt&gt;.&lt;/p&gt;  &lt;p&gt;Remember, a SPIN function identifies the SPARQLMotion script to call by naming the script's last module in the function's &lt;tt&gt;sm:returnModule&lt;/tt&gt; property. The module that we need to point to doesn't exist yet, so pick "Create and add..." from this property's context menu, and then pick sml:ReturnText from the sml:ExportToRemoteModules section of the sml:ExportModules choices and name your new module ReturnComputedAge. It's exporting to a remote module because a script on the server is returning the value to a calling process on the client, and when a TBE application gets text passed by a Return Text module, it displays that text in a message box, which is what we want for this application. &lt;/p&gt;  &lt;/div&gt;  &lt;div class="section"&gt;&lt;h2 class="sectiontitle"&gt;Creating the SPARQLMotion script&lt;/h2&gt;  &lt;p&gt;You don't need to create a new SPARQLMotion script, because when you defined the &lt;tt&gt;sml:selectedResource&lt;/tt&gt; and &lt;tt&gt;sm:returnModule&lt;/tt&gt; modules as part of the &lt;tt&gt;AgeAtDeath&lt;/tt&gt; function, TopBraid Composer put them into a new script for you. Select "Edit SPARQLMotion Script" from the Scripts menu, and you'll see see this script with icons representing these two modules waiting for you to add new modules and connect them up. &lt;/p&gt;  &lt;p&gt;Drag the Selected Resource icon to the top of the screen, because it will be the beginning of your script. Under it, create a new module to perform the query that will compute the age at death of the selected resource by dragging a Bind by select icon from the Control Flow section of the SPARQLMotion workspace palette onto the workspace. Name this module ComputeAge and set its &lt;tt&gt;sml:selectQuery&lt;/tt&gt; property to the following SPARQL query:&lt;/p&gt;  &lt;pre class="pre"&gt;PREFIX k: &amp;lt;http://topbraid.org/examples/kennedys#&gt;&lt;br /&gt;SELECT ?deathAge&lt;br /&gt;WHERE {&lt;br /&gt;  ?selectedResource k:birthYear ?birthYear .&lt;br /&gt;  OPTIONAL {&lt;br /&gt;      ?selectedResource k:deathYear ?deathYear .&lt;br /&gt;  } .&lt;br /&gt;  LET (?deathAge := smf:if(bound(?deathYear),&lt;br /&gt;                           (?deathYear - ?birthYear),&lt;br /&gt;                           "Still alive")) .&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;  &lt;p&gt;It uses the SPARQLMotion extension function &lt;tt&gt;sml:if&lt;/tt&gt; to calculate and return the person's age at death if the &lt;tt&gt;?deathYear&lt;/tt&gt; variable is bound and to return the string "Still alive" if it's not bound. &lt;/p&gt;  &lt;p&gt;The &lt;tt&gt;sml:selectQuery&lt;/tt&gt; property is the only one to set for this module, so you're ready to add a connection from the Selected Resource module icon to the ComputeAge one. &lt;/p&gt;  &lt;p&gt;The ComputeAge module knows what SPARQL query to execute, but it doesn't know what data to execute it with. Drag an Import current RDF module, which passes all of the triples of the currently open model to the script, from the Import from Various section of the palette to the workspace. Name it ImportTBETriples and add a connection from this module to the ComputeAge one. You don't need to set any of its properties; it will know what to do. &lt;/p&gt;    &lt;p&gt;The query above binds the computed answer to the variable &lt;tt&gt;?deathAge&lt;/tt&gt;. This is what we want to return to the TBE application that calls the &lt;tt&gt;AgeAtDeath&lt;/tt&gt; function, so set the &lt;tt&gt;sml:text&lt;/tt&gt; property of the returnComputedAge module that's been waiting for you to use it to {?deathAge} and connect the ComputeAge module icon to the returnComputedAge one. Your completed script should look like this:&lt;/p&gt;  &lt;img src="http://www.snee.com/bobdc.blog/img/tq/howtoSMTBE1.jpg" alt="" /&gt;  &lt;p&gt;The gear menu in TBE won't know about the &lt;tt&gt;AgeAtDeath&lt;/tt&gt; function until you register it with the server, so select "Refresh/Display SPARQLMotion functions..." from from the TopBraid Composer &lt;span class="uicontrol"&gt;Script&lt;/span&gt; menu, and after a few seconds you'll see the updated list of registered functions on the &lt;span class="uicontrol"&gt;Console&lt;/span&gt; view.&lt;/p&gt;  &lt;/div&gt;   &lt;div class="section"&gt;&lt;h2 class="sectiontitle"&gt;Testing it&lt;/h2&gt;   &lt;p&gt;From the TBL main screen, pick "Default Application (configurable)," and on the "TopBraid Live Data Selection" screen pick kennedys from the "Data from Project TopBraid" section. When the application appears, click Person in the &lt;span class="uicontrol"&gt;Tree&lt;/span&gt; component in the upper-left to list data about members of the Person class on the &lt;span class="uicontrol"&gt;Results Grid&lt;/span&gt;. Once they appear there, click a row that includes both a "Year of birth" and a "Year of death" value to select it. &lt;/p&gt;   &lt;p&gt;Click the gear menu in the upper-right, and you should see your new "Age at death" menu choice:&lt;/p&gt;    &lt;img src="http://www.snee.com/bobdc.blog/img/tq/howtoSMTBE2.jpg" alt="" width="590" /&gt;  &lt;p&gt;Select it, and you'll see a message box showing the result of the calculation from the SPARQLMotion script:&lt;/p&gt;   &lt;img src="http://www.snee.com/bobdc.blog/img/tq/howtoSMTBE3.jpg" alt="" /&gt;  &lt;p&gt;Try again with a row of the &lt;span class="uicontrol"&gt;Results Grid&lt;/span&gt; that has a "Year of birth" but no "Year of death" value, and you should see a similar message box appear with the "Still alive" message.&lt;/p&gt;  &lt;/div&gt;   &lt;div class="section"&gt;&lt;h2 class="sectiontitle"&gt;Taking it further&lt;/h2&gt; &lt;p&gt;If you created ten different applications like this, the menu choices for all ten would appear on all gear menus in all of your TBE applications. To limit the menu choice to only appear on the gear menu for applications showing instances of a particular class, such as members of the Person class from the kennedys data, you can name that class in the ValueType property of the sml:SelectedResourceArgument when you configure the constraint in the function you're defining.&lt;/p&gt;  &lt;p&gt;The SPARQL query used in your SPARQLMotion script set the return value of &lt;tt&gt;?deathAge&lt;/tt&gt; to a very simple value: either &lt;tt&gt;(?deathYear - ?birthYear)&lt;/tt&gt; or the string "Still alive". Browse through the "TopBraid SPARQLMotion Functions Library" help panel and you'll see an extensive choice of functions that you can use to assemble a much more complex string to return, with substring and case manipulation functions, regular expression matching, concatenation functions to assemble multiple pieces together, and more. &lt;/p&gt;   &lt;p&gt;This SPARQLMotion script also had very limited input: the URI of the resource to query about and the data from the kennedys file. As we've seen in other postings, a SPARQLMotion script can open up many other kinds of both local and remote data, so the URI passed from TBE can be used in much more sophisticated kinds of processing. And, as we saw in &lt;a href="http://topquadrantblog.blogspot.com/2010/01/how-to-create-topbraid-ensemble.html"&gt;How to: create a TopBraid Ensemble application&lt;/a&gt;, you can custom-design your own TBE screens to be the front end of your application. It's a great combination of front end client-side design flexibility and back end server-side scripting capabilities. &lt;/p&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/7507012841435012041-6378755461440346696?l=topquadrantblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://topquadrantblog.blogspot.com/feeds/6378755461440346696/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7507012841435012041&amp;postID=6378755461440346696' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default/6378755461440346696'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default/6378755461440346696'/><link rel='alternate' type='text/html' href='http://topquadrantblog.blogspot.com/2010/03/how-to-call-sparqlmotion-script-from.html' title='How to: call a SPARQLMotion script from TopBraid Ensemble'/><author><name>Bob DuCharme</name><uri>http://www.blogger.com/profile/02742075186312518829</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_13zlUS8aD_8/S0OhTCeBZ8I/AAAAAAAAAAM/cGInR6wDS84/S220/128x128.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7507012841435012041.post-3758480027332703860</id><published>2010-02-19T06:36:00.000-08:00</published><updated>2010-07-27T07:07:30.617-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='How to'/><title type='text'>How to: use XSLT in a semantic web application</title><content type='html'>&lt;p&gt;&lt;i&gt;An updated version of this blog post is now available as a chapter in the TopBraid &lt;a href="http://www.topquadrant.com/docs/tbc/AppDevQuickstartGuide.pdf"&gt;Application Development Quickstart Guide&lt;/a&gt; (pdf).&lt;/i&gt;&lt;/p&gt;&lt;a name="xsltsemweb"&gt;&lt;!-- --&gt;&lt;/a&gt;XML-based tools form the plumbing of modern electronic publishing systems, so when your semantic web application can create XML, it can easily feed content into one of these systems. The W3C standard XSLT is the most popular tool for converting one kind of XML into another, so in this posting we'll see how SPARQLMotion scripts can use XSLT to create customized XML from your triples. (TopBraid Suite is also very good at reading XML; see the TopBraid Composer help panel "Creating, Importing, Querying, Saving XML documents with Semantic XML" for more on this.) Our example script will save its output as an XHTML file, but you can create XML conforming to any DTD or schema you like and save it as a file or &lt;a href="http://topquadrantblog.blogspot.com/2010/01/how-to-create-and-run-semantic-web.html"&gt;return it via a web service&lt;/a&gt;.  &lt;div&gt;   &lt;div class="section"&gt;&lt;h2 class="sectiontitle"&gt;Creating XML&lt;/h2&gt;  &lt;p&gt;TopBraid offers several ways to create XML. The Semantic XML feature lets you read arbitrary XML and gives you fine-grained control over XML that you create, but for a quick conversion of data to XML, there are simpler options. The W3C's RDF/XML serialization standard is the most well-known (if not the most popular) format for representing triples in XML, but its flexibility in the representation of triples can add complexity to the XSLT stylesheet, which must account for several possible locations of a given triple's subject, predicate, and object in various combinations of XML elements and attributes. &lt;/p&gt;  &lt;p&gt;The simplest, most straightforward XML format that a semantic web application can create is the W3C standard &lt;a href="http://www.w3.org/TR/2008/REC-rdf-sparql-XMLres-20080115/"&gt;SPARQL Query Results XML Format&lt;/a&gt;. For example, with the following query against the kennedys.owl file included with TopBraid Composer,   &lt;/p&gt;  &lt;pre class="pre"&gt;PREFIX k: &amp;lt;http://topbraid.org/examples/kennedys#&gt;&lt;br /&gt;SELECT ?last ?first ?birth&lt;br /&gt;WHERE {&lt;br /&gt;?s k:lastName ?last .&lt;br /&gt;?s k:firstName ?first .&lt;br /&gt;?s k:birthYear ?birth .&lt;br /&gt;}&lt;br /&gt;ORDER BY (?birth)&lt;/pre&gt;  &lt;p&gt;the XML representation of the result will have the following structure, with a &lt;tt&gt;head&lt;/tt&gt; element listing the variables followed by a &lt;tt&gt;results&lt;/tt&gt; element that contains a &lt;tt&gt;result&lt;/tt&gt; child for each row of results returned by the SPARQL engine:&lt;/p&gt;  &lt;pre class="pre"&gt;&lt;br /&gt;&amp;lt;sparql xmlns="http://www.w3.org/2005/sparql-results#"&amp;gt;&lt;br /&gt;&lt;strong&gt;&amp;lt;head&amp;gt;&lt;/strong&gt;&lt;br /&gt;&amp;lt;variable name="&lt;strong&gt;last&lt;/strong&gt;"/&amp;gt;&lt;br /&gt;&amp;lt;variable name="&lt;strong&gt;first&lt;/strong&gt;"/&amp;gt;&lt;br /&gt;&amp;lt;variable name="&lt;strong&gt;birth&lt;/strong&gt;"/&amp;gt;&lt;br /&gt;&lt;strong&gt;&amp;lt;/head&amp;gt;&lt;/strong&gt;&lt;br /&gt;&amp;lt;results&amp;gt;&lt;br /&gt;&lt;strong&gt;&amp;lt;result&amp;gt;&lt;/strong&gt;&lt;br /&gt;  &amp;lt;binding name="last"&amp;gt;&lt;br /&gt;    &amp;lt;literal&amp;gt;&lt;strong&gt;Kennedy&lt;/strong&gt;&amp;lt;/literal&amp;gt;&lt;br /&gt;  &amp;lt;/binding&amp;gt;&lt;br /&gt;  &amp;lt;binding name="first"&amp;gt;&lt;br /&gt;    &amp;lt;literal&amp;gt;&lt;strong&gt;Joseph&lt;/strong&gt;&amp;lt;/literal&amp;gt;&lt;br /&gt;  &amp;lt;/binding&amp;gt;&lt;br /&gt;  &amp;lt;binding name="birth"&amp;gt;&lt;br /&gt;    &amp;lt;literal datatype="http://www.w3.org/2001/XMLSchema#integer"&amp;gt;&lt;strong&gt;1888&lt;/strong&gt;&amp;lt;/literal&amp;gt;&lt;br /&gt;  &amp;lt;/binding&amp;gt;&lt;br /&gt;&lt;strong&gt;&amp;lt;/result&amp;gt;&lt;br /&gt;&amp;lt;result&amp;gt;&lt;/strong&gt;&lt;br /&gt;  &amp;lt;binding name="last"&amp;gt;&lt;br /&gt;    &amp;lt;literal&amp;gt;&lt;strong&gt;Fitzgerald&lt;/strong&gt;&amp;lt;/literal&amp;gt;&lt;br /&gt;  &amp;lt;/binding&amp;gt;&lt;br /&gt;  &amp;lt;binding name="first"&amp;gt;&lt;br /&gt;    &amp;lt;literal&amp;gt;&lt;strong&gt;Rose&lt;/strong&gt;&amp;lt;/literal&amp;gt;&lt;br /&gt;  &amp;lt;/binding&amp;gt;&lt;br /&gt;  &amp;lt;binding name="birth"&amp;gt;&lt;br /&gt;    &amp;lt;literal datatype="http://www.w3.org/2001/XMLSchema#integer"&amp;gt;&lt;strong&gt;1890&lt;/strong&gt;&amp;lt;/literal&amp;gt;&lt;br /&gt;  &amp;lt;/binding&amp;gt;&lt;br /&gt;&lt;strong&gt;&amp;lt;/result&amp;gt;&lt;/strong&gt;&lt;br /&gt;&amp;lt;!-- more result elements --&amp;gt;&lt;br /&gt;&amp;lt;/results&amp;gt;&lt;br /&gt;&amp;lt;/sparql&amp;gt;&lt;br /&gt;&lt;/pre&gt;As we'll see, a very brief XSLT stylesheet can handle this.  &lt;/div&gt;   &lt;div class="section"&gt;&lt;h2 class="sectiontitle"&gt;Creating an XML version of SPARQL query results in a SPARQLMotion script&lt;/h2&gt; &lt;p&gt;In our sample application, the XSLT stylesheet will create an XHTML version of the data returned by the query above.&lt;/p&gt;  &lt;p&gt;Start by creating a SPARQLMotion File in TopBraid Composer file called xsltdemo. Create a SPARQLMotion script in this file with an ImportRDFFromWorkspace initial module named GetKennedyData, and set its &lt;tt&gt;sml:sourceFilePath&lt;/tt&gt; property to /TopBraid/Examples/kennedys.owl.  (For more details on following these steps, see  &lt;a href="http://topquadrantblog.blogspot.com/2010/01/how-to-create-and-run-sparqlmotion.html"&gt;How to: create and run a SPARQLMotion script&lt;/a&gt;.) &lt;/p&gt;  &lt;p&gt;For your script's second module, drag a SerializeSPARQLResults module from the SPARQLMotion palette's Text Processing section onto the workspace and name it SelectRptData. Set the following three properties to configure it:&lt;/p&gt;  &lt;ul&gt;&lt;li&gt;&lt;p&gt;Set its &lt;tt&gt;sml:selectQuery&lt;/tt&gt; property to the SPARQL query shown above.&lt;/p&gt; &lt;/li&gt;&lt;li&gt;&lt;p&gt;Set &lt;tt&gt;sm:outputVariable&lt;/tt&gt;, a property that names the variable that will hold the results of the query, to queryResults.&lt;/p&gt; &lt;/li&gt;&lt;li&gt;&lt;p&gt;For the &lt;tt&gt;sml:serialization&lt;/tt&gt; property, click the white triangle to display the context menu and select Add Existing, because you want to pick from the predefined list of legal values. On the &lt;span class="uicontrol"&gt;Add existing&lt;/span&gt; dialog box, select sm:XML on the right. (If you click on sml:RDFSerialization on the left of this dialog box, you'll see that this module can also output N3, NTriples, RDF/XML, and Turtle RDF.) &lt;/p&gt; &lt;/li&gt;&lt;/ul&gt;  &lt;p&gt;Close the &lt;span class="uicontrol"&gt;Edit SelectRptData&lt;/span&gt; dialog box and connect the GetKennedyData module's icon to the SelectRptData one. &lt;/p&gt;  &lt;p&gt;When you develop an XSLT stylesheet, you want some sample input XML data handy to test it, so let's have this script create a file for this. Add an Export to XML File icon from the Export to Local section of the palette and call it SaveTestXML. Set its &lt;tt&gt;sml:xml&lt;/tt&gt; property to {?queryResults} to get the data that your SelectRptData module stored in this variable, and set sml:targetFilePath to testdata.xml. That's all you need to set, so connect your SelectRptData icon to it as shown here:&lt;/p&gt;  &lt;img src="http://www.snee.com/bobdc.blog/img/tq/howtoxslt1.jpg" alt="" /&gt; &lt;p&gt;Select that third icon and click the debug icon at the top of the SPARQLMotion workspace to run it, and you should see a testdata.xml file appear in the same directory as your script. This file will have XML that follows the structure of the example shown above. &lt;/p&gt;  &lt;/div&gt;  &lt;div class="section"&gt;&lt;h2 class="sectiontitle"&gt;Applying an XSLT stylesheet in a SPARQLMotion script&lt;/h2&gt; &lt;p&gt;First, you need to create the XSLT stylesheet file. If you're using an Eclipse-based XML editor such as oXygen or XML Spy, go ahead and use one of those editors. Otherwise, after selecting the folder in the &lt;span class="uicontrol"&gt;Navigator&lt;/span&gt; view where you want to store the file, pick New from the File menu. Because you're not creating one of the specialized files that TopBraid Composer typically deals with, pick Other from the cascade menu. Pick XML from the XML section of the &lt;span class="uicontrol"&gt;New&lt;/span&gt; dialog box and click next. Call the file createKennedyHTMLRpt.xsl, and click Finish on the &lt;span class="uicontrol"&gt;New XML File&lt;/span&gt; dialog box. (Clicking Next on that dialog would lead to wizards that make the process more complicated than this example requires.) Paste the following stylesheet, which I wrote to process the testdata.xml file created above, onto the editor and save the stylesheet:&lt;/p&gt;  &lt;pre class="pre"&gt;&lt;br /&gt;&amp;lt;xsl:stylesheet version="1.0"&lt;br /&gt;    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&lt;br /&gt;    xmlns:sp="http://www.w3.org/2005/sparql-results#"&lt;br /&gt;    xmlns="http://www.w3.org/1999/xhtml"&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;xsl:template match="sp:sparql"&amp;gt;&lt;br /&gt;  &amp;lt;html&amp;gt;&lt;br /&gt;    &amp;lt;head&amp;gt;&amp;lt;title&amp;gt;XSLT demo&amp;lt;/title&amp;gt;&amp;lt;/head&amp;gt;&lt;br /&gt;    &amp;lt;body&amp;gt;&lt;br /&gt;      &amp;lt;table border="1"&amp;gt;&lt;br /&gt;        &amp;lt;tr&amp;gt;&lt;br /&gt;          &amp;lt;th&amp;gt;Last Name&amp;lt;/th&amp;gt;&lt;br /&gt;          &amp;lt;th&amp;gt;First Name&amp;lt;/th&amp;gt;&lt;br /&gt;          &amp;lt;th&amp;gt;Birth&amp;lt;/th&amp;gt;&lt;br /&gt;        &amp;lt;/tr&amp;gt;&lt;br /&gt;        &amp;lt;xsl:apply-templates/&amp;gt;&lt;br /&gt;      &amp;lt;/table&amp;gt;&lt;br /&gt;    &amp;lt;/body&amp;gt;&lt;br /&gt;  &amp;lt;/html&amp;gt;&lt;br /&gt;&amp;lt;/xsl:template&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;xsl:template match="sp:result"&amp;gt;&lt;br /&gt;  &amp;lt;tr&amp;gt;&lt;br /&gt;    &amp;lt;td&amp;gt;&amp;lt;xsl:value-of select="sp:binding[@name='last']"/&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;    &amp;lt;td&amp;gt;&amp;lt;xsl:value-of select="sp:binding[@name='first']"/&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;    &amp;lt;td&amp;gt;&amp;lt;xsl:value-of select="sp:binding[@name='birth']"/&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;  &amp;lt;/tr&amp;gt;&lt;br /&gt;&amp;lt;/xsl:template&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/xsl:stylesheet&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;(If you create the stylesheet outside of TopBraid Composer, make sure to put it in the same folder as your script, then right-click the folder's icon in the &lt;span class="uicontrol"&gt;Navigator&lt;/span&gt; view and select Refresh so that Eclipse knows that the new file is there.) The stylesheet converts the XML into an XHTML file with a table that has a row for each row of the result set.  &lt;p&gt;The next module to add to the SPARQLMotions script is the one that applies the stylesheet to the XML. Drag a Convert XML by XSLT module from the XML Processing section of the palette, name it CreateHTML, and configure it by setting the following three properties:&lt;/p&gt;  &lt;ul&gt;&lt;li&gt;&lt;p&gt;Set &lt;tt&gt;sm:outputVariable&lt;/tt&gt; to HTMLResult. This variable will store the result of the XSLT transformation.&lt;/p&gt; &lt;/li&gt;&lt;li&gt;&lt;p&gt;Set &lt;tt&gt;sml:template&lt;/tt&gt; to {?stylesheet}. We haven't added the script module that sets this variable yet, but will soon.&lt;/p&gt; &lt;/li&gt;&lt;li&gt;&lt;p&gt;Set &lt;tt&gt;xml:xml&lt;/tt&gt; to {?queryResults}. As we saw above, the SelectRptData module stores the XML of the query results in this variable; the SaveTestXML module also used the contents of this variable.&lt;/p&gt; &lt;/li&gt;&lt;/ul&gt;  &lt;p&gt;Connect the SelectRptData module to your new CreateHTMLRpt module. SelectRptData is already connected to SaveTestXML, but sending a module's output to multiple modules is a common technique in SPARQLMotion scripts.&lt;/p&gt;   &lt;p&gt;To read the createKennedyHTMLRpt.xsl stylesheet disk file and send its contents to the CreateHTMLRpt module for use in the XSLT transformation, drag an ImportTextFile module from the Import from Local section of the palette and name it ReadXSLTStylesheet. Tell it where to find the stylesheet file by setting its &lt;tt&gt;sml:sourceFilePath&lt;/tt&gt; property to createKennedyHTMLRpt.xsl, and then set its sm:outputVariable property to stylesheet—the variable that the CreateHTMLRpt module will expect to find the text of the stylesheet that it applies to the output of the SelectRptData module. Connect the ReadXSLTStylesheet module to the CreateHTMLRpt module.&lt;/p&gt;  &lt;p&gt;The last module will save the results of the XSLT transformation in a disk file. Drag another ExportToXMLFile module from the Export to Local section of the palette and name it SaveHTMLFile. Set its &lt;tt&gt;sml:xml&lt;/tt&gt; property to {?HTMLResult} so that it reads the variable set by the CreateHTML module, and then indicate where to save this variable's value by setting the module's &lt;tt&gt;sml:targetFilePath&lt;/tt&gt; property to KennedyRpt.html. Connect the CreateHTML module to the new SaveHTMLFile module. Your completed script should look something like this: &lt;/p&gt;  &lt;img src="http://www.snee.com/bobdc.blog/img/tq/howtoxslt2.jpg" alt="" /&gt; &lt;p&gt;To test it, select the CreateHTML icon and click the debug icon. You should see a KennedyRpt.html file appear in the same directory as your xsltdemo script; in a browser, this HTML file will look like this: &lt;/p&gt;  &lt;img src="http://www.snee.com/bobdc.blog/img/tq/howtoxslt3.jpg" alt="" width="590" /&gt;    &lt;p&gt;Now that the script is applying the XSLT stylesheet to the XML and creating the HTML, you can right-click your SaveTestXML script module and select Delete to remove it from your script if you want to, but maybe you don't want to—if you ever need to refine the SELECT query in the SelectRptData module or the XSLT stylesheet that the ReadXSLTStylesheet module feeds to the CreateHTML module, the ability to create another disk file of test data may prove handy in the future.&lt;/p&gt;  &lt;p&gt;This also demonstrates another technique of sophisticated SPARQLMotion scripts: the ability to share common processing modules for different output modules. You essentially have two SPARQLMotion scripts here—SaveTestXML and SaveHTMLFile—which share several modules. That's why, when you pick Edit SPARQLMotion Script or Execute SPARQLMotion Modules from the Scripts menu, you'll see these two "scripts" listed as choices, even though they're graphically represented as a single flow chart with a choice of end points.&lt;/p&gt;   &lt;/div&gt;  &lt;div class="section"&gt;&lt;h2 class="sectiontitle"&gt;Taking it further&lt;/h2&gt;  &lt;p&gt;If you had created this script as a web service, then instead of ending with an Export to XML File module from the Export to Local section of the palette, you could route the XML from the Convert XML by XSLT module to a Return XML module from the Export to Remote section of the palette. (Or, that could be a third endpoint added to the two discussed above!) If you set the Return XML module's &lt;tt&gt;sml:mimetype&lt;/tt&gt; property to text/html and had it return XHTML like the xsltdemo script above does, you'd be setting up the dynamic creation of a web page, so that users browsing to the URL that invokes the service would think that they were just linking to a web page.&lt;/p&gt;  &lt;p&gt;Of course, it doesn't have to return HTML. It can return anything that an XSLT script can create, and you can set &lt;tt&gt;sml:mimetype&lt;/tt&gt; to any valid HTTP MIME type, and any application that can do an HTTP GET can request delivery of this data, which opens up a wide range of possibilities for the contributions that this application can make to a larger system.&lt;/p&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/7507012841435012041-3758480027332703860?l=topquadrantblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://topquadrantblog.blogspot.com/feeds/3758480027332703860/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7507012841435012041&amp;postID=3758480027332703860' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default/3758480027332703860'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default/3758480027332703860'/><link rel='alternate' type='text/html' href='http://topquadrantblog.blogspot.com/2010/02/how-to-use-xslt-in-semantic-web.html' title='How to: use XSLT in a semantic web application'/><author><name>Bob DuCharme</name><uri>http://www.blogger.com/profile/02742075186312518829</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_13zlUS8aD_8/S0OhTCeBZ8I/AAAAAAAAAAM/cGInR6wDS84/S220/128x128.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7507012841435012041.post-8705467634448680830</id><published>2010-02-12T08:23:00.000-08:00</published><updated>2010-07-27T07:08:12.285-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='How to'/><title type='text'>How to: read triples from a relational database</title><content type='html'>&lt;a name="readmysql"&gt;&lt;!-- --&gt;&lt;/a&gt;     &lt;div&gt;&lt;p&gt;&lt;i&gt;An updated version of this blog post is now available as a chapter in the TopBraid &lt;a href="http://www.topquadrant.com/docs/tbc/AppDevQuickstartGuide.pdf"&gt;Application Development Quickstart Guide&lt;/a&gt; (pdf).&lt;/i&gt;&lt;/p&gt;&lt;p&gt;TopBraid includes the  &lt;a href="http://www.wiwiss.fu-berlin.de/suhl/bizer/D2RQ/"&gt;D2RQ&lt;/a&gt; interface to relational database management systems and automates most of the configuration for you, giving your TopBraid applications easy access to relational data. In this entry, we'll see how easily a SPARQLMotion script can use data stored in a MySQL database. You would use a similar process to get at data stored using Oracle, Sybase, SQL Server, and PostgreSQL. Our sample uses MySQL's sample "world" database, a collection of data about countries around the world. See the &lt;a href="http://dev.mysql.com/doc/index-other.html"&gt;Other MySQL Documentation&lt;/a&gt; page to download the database and for information on installing it.&lt;/p&gt;   &lt;div class="section"&gt;&lt;h2 class="sectiontitle"&gt;Configuring TopBraid to read a MySQL database&lt;/h2&gt; &lt;p&gt;Once you have a running copy of MySQL with the world database installed, the next step is to tell TopBraid Composer to create the configuration files that let you treat this relational database as a virtual triplestore. Start by selecting the project or folder in the Navigator window where you want TBC to put these files, and then select Import from the File menu and pick "RDF/OWL View on Relational Database via D2RQ" from the list of formats that can be imported. Click the Next button, and you'll see the &lt;span class="uicontrol"&gt;Specify database connection&lt;/span&gt; dialog box.&lt;/p&gt;  &lt;p&gt;For the database connection file name, enter worlddb, and then change the Base URI of each of the configuration files to something that reflects this filename, as shown in the screen shot below.&lt;/p&gt;   &lt;p&gt;The last four fields are where you specify the key information for giving TopBraid access to the database. The drop-down list for the Database URL field offers a choice of templates for different RDBMS systems; for our MySQL database, select jdbc:mysql://&amp;lt;server&gt;/&amp;lt;database&gt; and change it to jdbc:mysql://localhost/world. (This assumes that MySQL is running on the same machine as your copy of TBC. If not, substitute the appropriate name for localhost. The part after the last slash is the database that you want to read from the MySQL server on that system.) In the next two fields, enter a user name and password for an account that has access to the worlddb database when using MySQL tools, and then in the Driver Class field select com.mysql.jdbc.Driver.&lt;/p&gt;  &lt;p&gt;Click the Finish button, and TBC will create the configuration files and display a message box about it:&lt;/p&gt;   &lt;img src="http://www.snee.com/bobdc.blog/img/tq/howtordngmysql1.jpg" alt="" width="590" /&gt;  &lt;p&gt;The "Importing Relational Databases with D2RQ" online help panel has good background on this whole process, especially on the role that each of these configuration files play. Among other things, it points out that the property names assigned to the columns of the relational database tables are just a starting point that can be reconfigured by editing these files. For example, the tableName_columnName format of the property names that you use to access the data is only a default and can be changed. &lt;/p&gt;  &lt;/div&gt;  &lt;div class="section"&gt;&lt;h2 class="sectiontitle"&gt;Reading the data from a SPARQLMotion script&lt;/h2&gt; &lt;p&gt;To see how SPARQLMotion can use this data, we're going to create a simple script that gets the database's value for the president of the United States. After running it, we'll update the data using a MySQL tool and then run the SPARQLMotion script again to see the update reflected in the data that TopBraid is using. &lt;/p&gt;   &lt;p&gt;Start by creating a new SPARQLMotion file as described at &lt;a href="http://topquadrantblog.blogspot.com/2010/01/how-to-create-and-run-sparqlmotion.html"&gt;How to: create and run a SPARQLMotion script&lt;/a&gt; and call it mysqltest. Create a new SPARQLMotion script for this file, and for its initial module pick sml:ImportRDFFromWorkspace from the sml:ImportFromLocalModules section of the sml:ImportModules category. Call it GetWorldData, and when its icon appears, set this module's sml:sourceFilePath property to worlddb-Test.owl. This was one of the files created earlier by the configuration process, and it imports two others: the worlddb-Schema.owl schema file and the worlddb.d2rq file that serves as a placeholder for the actual data in the MySQL world database. This is the only property that you need to set for this module.&lt;/p&gt;  &lt;p&gt;Next, we'll add a module that queries the database for the name of the president of the United States. Add a &lt;span class="uicontrol"&gt;Bind by select&lt;/span&gt; module from the Control Flow section of the SPARQLMotion palette and call it PresidentQuery. Set its sml:selectQuery property to the following query (note how the namespace for the property names is the "Base URI of generated Schema file" value you assigned when configuring how TopBraid would import the MySQL data):&lt;/p&gt;  &lt;pre class="pre"&gt;PREFIX w: &amp;lt;http://example.org/worlddb/myschema.owl#&gt;&lt;br /&gt;SELECT ?headOfState&lt;br /&gt;WHERE {&lt;br /&gt; ?s w:country_Name "United States" .&lt;br /&gt; ?s w:country_HeadOfState ?headOfState .&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;  &lt;p&gt;That's the only property to set for this module, so close the &lt;span class="uicontrol"&gt;Edit PresidentQuery&lt;/span&gt; dialog box, click Add connect on the SPARQLMotion palette, and connect the GetWorldData module icon to the new icon.&lt;/p&gt;  &lt;p&gt;When you work with a database like this, TopBraid keeps cached copies of the data to speed up later queries on the same data. This has obvious advantages, but it can be a disadvantage if you're more interested in data currency than in quick retrieval times. Our database is small, and we want to see changes reflected as soon as possible, so we're going to add a module that clears out this cache each time the script is run.&lt;/p&gt;  &lt;p&gt;Drag a &lt;span class="uicontrol"&gt;Collect garbage&lt;/span&gt; module from the Control Flow section of the palette to your workspace and name it EmptyCache. Set its sml:baseURI property to the URI for the database you want to clear from the cache: http://example.org/worlddb/myDatabase.owl, which is the base URI for the worlddb.d2rq placeholder file. (This is the URI you entered in the "Base URI of Instances (Database)" field when you set up the initial import and configuration.) After configuring this one property, connect the President query module icon to the Empty cache icon.&lt;/p&gt;  &lt;p&gt;Select the Empty cache icon and click the debug icon to run this short script. You'll see in the &lt;span class="uicontrol"&gt;Console&lt;/span&gt; view (a handy view when developing and debugging scripts) that the headOfState property has the value "George W. Bush", so the MySQL sample database is a bit out of date:&lt;/p&gt;   &lt;img src="http://www.snee.com/bobdc.blog/img/tq/howtordngmysql2.jpg" alt="" /&gt;  &lt;p&gt;Let's fix this. Update the data using your favorite MySQL tool. For example, from MySQL's command line interface, you could enter this:&lt;/p&gt;  &lt;pre class="pre"&gt;mysql&gt; USE world&lt;br /&gt;Database changed&lt;br /&gt;mysql&gt; UPDATE country SET HeadOfState="Barack Obama"&lt;br /&gt; -&gt; WHERE HeadOfState="George W. Bush";&lt;br /&gt;&lt;/pre&gt;  &lt;p&gt;Run the SPARQLMotion script again, and you should see the update reflected in the &lt;span class="uicontrol"&gt;Console&lt;/span&gt; view. If it wasn't for the script's Empty cache icon, your SPARQL query might have used a cached copy of the data that did not include this updated value.&lt;/p&gt;  &lt;p&gt;As the online help tells us, it's a good idea to be careful with the sml:CollectGarbage module, especially if you're developing a multi-user application where data is frequently updated. If quick access to updated data is not a priority in your application, omitting this module will mean faster response times for your users. It's up to the needs of your application, and it's good to know that you can have it either way.&lt;/p&gt;   &lt;p&gt;Instead of opening the worlddb-Test.owl file with your application, you're more likely to open a file that you created that imports one or more of the configuration files generated above (again, read the "Importing Relational Databases with D2RQ" help panel to learn more about what each file can contribute to your application) and perhaps some other files as well. You could add additional data files and RDFS or OWL files describing relationships between the various imported files so that you can do interesting things with the combinations. For example, you could declare the properties that reference MySQL database columns to be subproperties of others declared for your application or declared in a standard vocabulary such as Dublin Core.&lt;/p&gt;  &lt;p&gt;Something else that can make your script development easier is importing the generated schema into your script—in this case, dragging the worlddb-Schema.owl file onto the &lt;span class="uicontrol"&gt;Import&lt;/span&gt; view of the mysqltest file. This way, the namespace prefixes will already be defined for you and you can use autocompletion when you enter class and property names in your SPARQL queries.&lt;/p&gt;  &lt;p&gt;The sample application here didn't do much on its own, but when you combine the imported data with other data and metadata and take advantage of the other techniques described in this How-to series, the ability to incorporate live relational data in your semantic web applications adds some great possibilities to what your applications can do. &lt;/p&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/7507012841435012041-8705467634448680830?l=topquadrantblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://topquadrantblog.blogspot.com/feeds/8705467634448680830/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7507012841435012041&amp;postID=8705467634448680830' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default/8705467634448680830'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default/8705467634448680830'/><link rel='alternate' type='text/html' href='http://topquadrantblog.blogspot.com/2010/02/how-to-read-triples-from-relational.html' title='How to: read triples from a relational database'/><author><name>Bob DuCharme</name><uri>http://www.blogger.com/profile/02742075186312518829</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_13zlUS8aD_8/S0OhTCeBZ8I/AAAAAAAAAAM/cGInR6wDS84/S220/128x128.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7507012841435012041.post-8452083278622667434</id><published>2010-02-06T09:04:00.000-08:00</published><updated>2010-07-27T07:09:08.096-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='How to'/><title type='text'>How to: get data from SPARQL endpoints and save data in a spreadsheet</title><content type='html'>&lt;p&gt;&lt;i&gt;An updated version of this blog post is now available as a chapter in the TopBraid &lt;a href="http://www.topquadrant.com/docs/tbc/AppDevQuickstartGuide.pdf"&gt;Application Development Quickstart Guide&lt;/a&gt; (pdf).&lt;/i&gt;&lt;/p&gt;This entry covers two useful SPARQLMotion techniques: how to retrieve and use data from SPARQL endpoints, and how to save data so that you can open it with a spreadsheet program such as Excel or OpenOffice Calc. While this may look like a lot of material to cover, both techniques are so simple that this is the shortest &lt;a href="http://topquadrantblog.blogspot.com/search/label/How%20to"&gt;How to&lt;/a&gt; blog entry yet. &lt;div&gt;   &lt;div class="section"&gt;&lt;h2 class="sectiontitle"&gt;Retrieving data from a SPARQL endpoint&lt;/h2&gt; &lt;p&gt;A SPARQL endpoint is a server that accepts SPARQL queries and returns the result using the SPARQL Protocol for RDF, a &lt;a href="http://www.w3.org/TR/rdf-sparql-protocol/"&gt;W3C standard&lt;/a&gt; XML-based format that is much simpler than RDF/XML. This endpoint can be part of your intranet, providing access for others there to data behind your firewall, but more and more SPARQL endpoints are available on the public internet to provide you with data to use in your applications, and excitement about the new possibilities provided by this data is a big driver of the &lt;a href="http://linkeddata.org/"&gt;Linked Data&lt;/a&gt; movement. (In a future entry, we'll see how you can create your own SPARQL endpoint with TopBraid Live.) &lt;/p&gt;  &lt;p&gt;The ability to retrieve SPARQL endpoint data from within a SPARQLMotion script is not a feature specific to SPARQLMotion, but actually an extension to the Jena framework that will hopefully &lt;a href="http://www.slideshare.net/LeeFeigenbaum/sparql2-status/15"&gt;become part of SPARQL 1.1&lt;/a&gt;: the SERVICE keyword. This lets you name a data source right in your query, and the source can be a remote SPARQL endpoint. &lt;/p&gt;   &lt;p&gt;To try it out, enter the following query into TopBraid Composer's SPARQL view and execute it. Instead of pulling data from the currently open data graph, it gets it from the SPARQL endpoint specified by the URI http://dbpedia.org/sparql, which is the endpoint for the huge &lt;a href="http://www.slideshare.net/LeeFeigenbaum/sparql2-status/15"&gt;DBpedia&lt;/a&gt; collection of triples harvested from the structured infobox data in Wikipedia pages: &lt;/p&gt;  &lt;pre class="pre"&gt;&lt;br /&gt;SELECT ?subsidiaryName ?description&lt;br /&gt;WHERE {&lt;br /&gt; {&lt;br /&gt;     SERVICE &amp;lt;http://dbpedia.org/sparql&gt; {&lt;br /&gt;         &amp;lt;http://dbpedia.org/resource/IBM&gt; &amp;lt;http://dbpedia.org/ontology/Company/subsidiary&gt; ?ibmSub .&lt;br /&gt;         ?ibmSub &amp;lt;http://dbpedia.org/property/abstract&gt; ?description .&lt;br /&gt;         ?ibmSub rdfs:label ?subsidiaryName .&lt;br /&gt;         FILTER (lang(?description) = "en")&lt;br /&gt;         FILTER (lang(?subsidiaryName) = "en")&lt;br /&gt;     }&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;http: org="" sparql=""&gt;&lt;http: org="" resource="" ibm=""&gt;&lt;http: org="" ontology="" company="" subsidiary=""&gt;&lt;http: org="" property="" abstract=""&gt;&lt;br /&gt;&lt;/http:&gt;&lt;/http:&gt;&lt;/http:&gt;&lt;/http:&gt;&lt;/pre&gt;  &lt;p&gt;This query retrieves names and descriptions of IBM subsidiaries from DBpedia and only passes along the English language ("en") ones.&lt;/p&gt;  &lt;p&gt;You can use this technique anywhere that you can use a SPARQL SELECT query in your TopBraid development—including in the sml:selectQuery property of a SPARQLMotion &lt;span class="uicontrol"&gt;Create Spreadsheet&lt;/span&gt; module, as we'll see. &lt;/p&gt;  &lt;/div&gt;   &lt;div class="section"&gt;&lt;h2 class="sectiontitle"&gt;Saving data in a spreadsheet&lt;/h2&gt;  &lt;p&gt;If you search the TopBraid Composer online help for the word "spreadsheet," you'll see that TopBraid offers a variety of ways to read and write spreadsheet data. The simplest way to create a spreadsheet from a SPARQLMotion script is the &lt;span class="uicontrol"&gt;Create Spreadsheet&lt;/span&gt; module. After you enter a SELECT query in its sml:selectQuery property, it sends a tab-delimited spreadsheet to the next SPARQLMotion module with a column for each variable in the select query. (Any spreadsheet program can read a tab-delimited file. OpenOffice Calc doesn't offer "tab-delimited file" as a choice of file format to open, but if you tell it to open a "Text CSV" file and point it at a tab-delimited file, it will find that tab characters are the delimiters and import it properly.) For example, with the SELECT query shown above, this module will create a two-column spreadsheet with subsidiaryName values in the first column and description values in the second.&lt;/p&gt;   &lt;p&gt;Let's create a SPARQLMotion script that does this.  Create a new SPARQLMotion file as described at &lt;a href="http://topquadrantblog.blogspot.com/2010/01/how-to-create-and-run-sparqlmotion.html"&gt;How to: create and run a SPARQLMotion script&lt;/a&gt;, calling the file endpointtsv. Next, select Create SPARQLMotion script from the Scripts menu, and when it asks you to select an initial module type, select sml:CreateSpreadsheet from the sml:TextProcessing modules choices under sml:ProcessingModules. Name the module GetIBMSubs and click OK.&lt;/p&gt;   &lt;p&gt;When the icon for your new module appears on the SPARQLMotion workspace, double-click it to configure it and set sml:selectQuery to the query shown above. The sml:CreateSpreadsheet module creates a spreadsheet in memory, not on disk, to provide you with the flexibility of doing other things with its output before you send it to a specific output destination such as a disk file, so set the sm:outputVariable property to the name spreadsheetData so that subsequent modules can reference it. You're finished configuring this module, so click the Close button. &lt;/p&gt;  &lt;p&gt;Our SPARQLMotion script will only have one subsequent module: the one that saves the spreadsheet to a disk file. Drag an &lt;span class="uicontrol"&gt;Export to text file&lt;/span&gt; module from the Export to local section of the palette onto the workspace and name it SaveSpreadsheet. Double-click its icon to configure it and set the following properties:&lt;/p&gt;  &lt;ul&gt;&lt;li&gt;&lt;p&gt;Set sml:targetFilePath to ibmsubs.txt.&lt;/p&gt; &lt;/li&gt;&lt;li&gt;&lt;p&gt;The sml:text property is where you assign the text to store in the file being created; set it to {?spreadsheetData} so that it uses the value of the variable being set in the GetIBMSubs module. &lt;/p&gt; &lt;/li&gt;&lt;li&gt;&lt;p&gt;Set sml:replace to true so that running the script more than once replaces the existing disk file instead of appending the data on as new lines. (Of course, setting sml:replace to false can be very handy in other scripts that you write.) &lt;/p&gt; &lt;/li&gt;&lt;/ul&gt;   &lt;img src="http://www.snee.com/bobdc.blog/img/tq/howtoeptsv1.jpg" alt="" width="590" /&gt;  &lt;p&gt;Click the Close button, and then click on Add connection on the palette. Connect your two icons, and you're finished with your simple little script: &lt;/p&gt;   &lt;img src="http://www.snee.com/bobdc.blog/img/tq/howtoeptsv2.jpg" alt="" /&gt;  &lt;p&gt;Save it, select the SaveSpreadsheet icon, and click the debug icon to run your script. You should see an ibmsubs.txt file appear in the same directory as the script itself, because you didn't specify a path name when you configured the sml:targetFilePath property. (You're welcome to include a pathname with the file in that property.) &lt;/p&gt;  &lt;p&gt;Open up this new file in a spreadsheet program, and then you can use any of the program's formatting features that you like before saving the spreadsheet using the program's native format. Here are the first few rows of the spreadsheet in Microsoft Excel:&lt;/p&gt;   &lt;img src="http://www.snee.com/bobdc.blog/img/tq/howtoeptsv3.jpg" alt="" width="590" /&gt;  &lt;p&gt;If you combine these two techniques with others covered in this How-to series, you could have all of this triggered by a web service call, or the script could combine the data retrieved from a SPARQL endpoint with other data from other sources before saving the spreadsheet, or it might output the data in another of the destinations available in the "Export to" sections of the SPARQLMotion workspace palette. Take another look at those palette choices, or better yet, review the help page for them; I'm sure you'll get some great ideas.&lt;/p&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/7507012841435012041-8452083278622667434?l=topquadrantblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://topquadrantblog.blogspot.com/feeds/8452083278622667434/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7507012841435012041&amp;postID=8452083278622667434' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default/8452083278622667434'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default/8452083278622667434'/><link rel='alternate' type='text/html' href='http://topquadrantblog.blogspot.com/2010/02/how-to-get-data-from-sparql-endpoints.html' title='How to: get data from SPARQL endpoints and save data in a spreadsheet'/><author><name>Bob DuCharme</name><uri>http://www.blogger.com/profile/02742075186312518829</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_13zlUS8aD_8/S0OhTCeBZ8I/AAAAAAAAAAM/cGInR6wDS84/S220/128x128.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7507012841435012041.post-4810090062139555765</id><published>2010-01-29T12:06:00.000-08:00</published><updated>2010-07-27T07:10:18.663-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='How to'/><title type='text'>How to: create a TopBraid Ensemble application</title><content type='html'>&lt;a name="howtotbe1"&gt;&lt;!-- --&gt;&lt;/a&gt;         &lt;div&gt;&lt;p&gt;&lt;i&gt;An updated version of this blog post is now available as a chapter in the TopBraid &lt;a href="http://www.topquadrant.com/docs/tbc/AppDevQuickstartGuide.pdf"&gt;Application Development Quickstart Guide&lt;/a&gt; (pdf).&lt;/i&gt;&lt;/p&gt;      &lt;p&gt;TopBraid Ensemble (TBE) is a Flex-based web application for assembling and displaying TopBraid applications. The user interface runs on web browsers with Adobe Flash installed. When developing applications, the data behind the application is hosted by the TopBraid Live Personal Server included with TopBraid Composer Maestro Edition (TBC-ME); applications can then be deployed for multi-user use on a server running the TopBraid Live Enterprise Server product. &lt;/p&gt;      &lt;p&gt;Today we're going to see how to use TBE to create an editor that lets an end user edit a thesaurus using the &lt;a href="http://www.w3.org/2004/02/skos/"&gt;SKOS&lt;/a&gt; vocabulary management ontology. This exercise is excerpted from the TopBraid Ensemble Application Development and Reference Guide (&lt;a href="http://www.topquadrant.com/products/TBE-Application-Development-Guide.pdf"&gt;pdf&lt;/a&gt;), which you can download and use to find more detailed background on TBE's features and architecture.&lt;/p&gt;       &lt;div class="section"&gt;&lt;h2 class="sectiontitle"&gt;TopBraid Ensemble: the basics&lt;/h2&gt;      &lt;p&gt;TBE lets developers quickly configure applications around semantic web models by:&lt;/p&gt;      &lt;ul&gt;&lt;li&gt;         &lt;p&gt;Assembling pre-packaged graphical user interface components such as search forms and tree-based displays into desired configurations that let the end user view or edit data&lt;/p&gt;        &lt;/li&gt;&lt;li&gt;         &lt;p&gt;Adding custom business actions through SPARQLMotion scripts&lt;/p&gt;        &lt;/li&gt;&lt;li&gt;         &lt;p&gt;Building and using new custom components&lt;/p&gt;        &lt;/li&gt;&lt;/ul&gt;      &lt;p&gt;Once the application developer designs forms and event logic around a data model and deploys this TBE application on a server running the Enterprise edition of TopBraid Live, the developer's end users can use this application with any web browser that supports Adobe Flash.&lt;/p&gt;       &lt;p&gt;The nine user interface component types offered in release 3.2 include trees, grids, forms and maps. A developer can arrange these across multiple pages that function like a tabbed interface to reduce the clutter than can result from squeezing too much onto a single screen. &lt;/p&gt;      &lt;p&gt;Each UI component can:&lt;/p&gt;      &lt;ul&gt;&lt;li class="db.listitem"&gt;         &lt;p&gt;Contain one or more widgets that can display or provide an edit mode for information from the connected information source&lt;/p&gt;        &lt;/li&gt;&lt;li class="db.listitem"&gt;         &lt;p&gt;Include its own menu actions and icons&lt;/p&gt;        &lt;/li&gt;&lt;li class="db.listitem"&gt;         &lt;p&gt;Broadcast events to other components and listen for and react to events broadcast by other components&lt;/p&gt;        &lt;/li&gt;&lt;/ul&gt;      &lt;p&gt;TBE also provides non-UI, or invisible components, which work behind the scenes to perform data transformation and to relay events.&lt;/p&gt;       &lt;p&gt;A developer designs one or more input screens with TBE components and specifies the data graph that it will work with. These applications can call SPARQLMotion scripts, combining sophisticated back-end triples processing with quick development of application user interfaces to create powerful, intuitive semantic web applications.&lt;/p&gt;      &lt;p&gt;Creating an application consists of four basic steps:&lt;/p&gt;      &lt;ol class="db.orderedlist"&gt;&lt;li class="db.listitem"&gt;         &lt;p&gt;Select whether you want to begin with a New Application or a Default Application&lt;/p&gt;        &lt;/li&gt;&lt;li class="db.listitem"&gt;         &lt;p&gt;Identify the data to use with your application&lt;/p&gt;        &lt;/li&gt;&lt;li class="db.listitem"&gt;         &lt;p&gt;Select and configure the components to go on your screens&lt;/p&gt;        &lt;/li&gt;&lt;li class="db.listitem"&gt;         &lt;p&gt;Test your application&lt;/p&gt;        &lt;/li&gt;&lt;/ol&gt;      &lt;p&gt;Starting with a New Application means starting with a blank form and then adding and configuring the components that you need. This is especially useful for experienced TBE developers creating simple applications. New TBE developers often find it easier to begin with a Default Application, which includes several components arranged in a default layout that you can modify by deleting, adding, moving, and reconfiguring the components. &lt;/p&gt;      &lt;p&gt;The following shows a Default Application before any modifications have been made, with kennedyfamily.owl specified as the data to use with it: &lt;/p&gt;      &lt;img src="http://www.snee.com/bobdc.blog/img/tq/tbe03A9000001F5721AD4B6.png" alt="" width="590" /&gt;      &lt;p&gt;A configured TBE application specifies what components are shown when it is launched, how components are arranged, and how they interact with each other. Each application also defines what data to use with it. Some applications, such as the default apps and the new app, are configured to work with any data. Other applications are configured to work with specific datasets.&lt;/p&gt;      &lt;p&gt;When creating a TBE application, components can be rearranged, resized, removed and added. For example, you can have have two Results Grid components on the screen instead of one, like the default applications have. You can also customize the menu options for each component and the way the components interact with each other.&lt;/p&gt;      &lt;p&gt;TopBraid Ensemble's Default configurations are general TBE applications included in your installation. These configurations include most of the built-in components, laid out and wired for interaction with each other so that when an event such as a resource selection happens in one component, information displayed in some of the other components changes. For example, when you select a class in the tree, the members of the class appear in the grid, and when you select a resource in the grid, it populates the form with information about that resource.&lt;/p&gt;      &lt;p&gt;You can learn a lot about the potential power of these forms by studying how the components in the default configurations generate and listen to the events that make this kind of component interaction possible. &lt;/p&gt;    &lt;/div&gt;     &lt;div class="section"&gt;&lt;h2 class="sectiontitle"&gt;Creating the sample application&lt;/h2&gt;    &lt;p&gt;Our sample SKOS thesaurus editing application will have only two components:&lt;/p&gt;    &lt;ul&gt;&lt;li&gt;       &lt;p&gt;A tree displaying resources connected by skos:broader property.&lt;/p&gt;      &lt;/li&gt;&lt;li&gt;       &lt;p&gt;A form showing details of each resource. When the end-user clicks a node of the tree or a class name on the form, the form will refresh to display all the details about that class.&lt;/p&gt;      &lt;/li&gt;&lt;/ul&gt;     &lt;p&gt;TBE applications typically work with ontologies created using TBC, so before creating our TBE app, we need to create the data model.&lt;/p&gt;     &lt;p&gt;&lt;strong&gt;Step 1: Create Ontology&lt;/strong&gt;&lt;/p&gt;    &lt;p&gt;In TBC, create a new RDF/OWL file called thes1 and import skos-core.rdf from the Common folder of the TopBraid library into your new model. Create an instance of skos:Concept (a subclass of owl:Thing) in this model and call it Taxonomy Root. Remember which project it's stored in; we will need it as a root resource for the tree created on your TBE form.&lt;/p&gt;    &lt;p&gt;Save your work.&lt;/p&gt;     &lt;p&gt;&lt;strong&gt;Step 2: Create New Application&lt;/strong&gt;&lt;/p&gt;     &lt;p&gt;To get started with developing and configuring a TBE application, first send your browser to the TopBraid Suite Console, which can be accessed at http://localhost:8083/tbl when running the TopBraid Live Personal Server included with TBC Maestro Edition. This will take you to the TopBraid Administration Console.&lt;/p&gt;     &lt;p&gt;In the TBS Administration Console, select "New Application".&lt;/p&gt;    &lt;p&gt;On the "Data Graphs Compatible With New Application" screen, select the thes1 model that you just created from the project where it was stored.&lt;/p&gt;    &lt;p&gt;&lt;strong&gt;Step 3: Select Components&lt;/strong&gt;&lt;/p&gt;          &lt;p&gt;In TBE, click the plus sign icon and select Add Components to add each of two new components to the application: tree and form. Drag their tabs to lay them out side by side as shown in the following: &lt;/p&gt;    &lt;img src="http://www.snee.com/bobdc.blog/img/tq/tbe034C0000017177C42512.png" alt="" width="590" /&gt;    &lt;p&gt;Note how the default configuration of the tree component is to show the class structure of the data model; you'll be reconfiguring it to show the tree of taxonomy terms being edited by your new application's end user.&lt;/p&gt;    &lt;p&gt;&lt;strong&gt;Step 4: Configure Application&lt;/strong&gt;&lt;/p&gt;    &lt;p&gt;Launch the configuration console by clicking the wrench icon or pressing F2. You began with a copy of "New Application"; Click on "New Application" at the top of the navigation pane on the left, and then under General on the right change the application label to be "SKOS Editor". (Hover to the left of the existing value and click the "edit" button that appears there to change the value. )&lt;/p&gt;    &lt;p&gt;&lt;strong&gt;Step 5: Configure Tree&lt;/strong&gt;&lt;/p&gt;          &lt;p&gt;Now click on the Tree component on the left side of the Application Configuration console (you may need to first click the Components node of the tree to expand it into a list of available components) and make the following modifications:&lt;/p&gt;    &lt;ul&gt;&lt;li&gt;       &lt;p&gt;Rename the Tree's label to read Concept Hierarchy.&lt;/p&gt;      &lt;/li&gt;&lt;li&gt;       &lt;p&gt;Under Tree/Attributes, change the "Show the root of the tree in the display" setting to true.&lt;/p&gt;      &lt;/li&gt;&lt;li&gt;       &lt;p&gt;Change the Root Node to the Taxonomy Root (the new resource you created in TBC).&lt;/p&gt;      &lt;/li&gt;&lt;li&gt;             &lt;p&gt;Change the Transitive Property that identifies tree node child/parent relationships to "has broader" (the label assigned to the skos:broader property).&lt;/p&gt;      &lt;/li&gt;&lt;li&gt;             &lt;p&gt;Under Events, create a new Post Event for Single-click Selection and call it Tree Selection.&lt;/p&gt;      &lt;/li&gt;&lt;/ul&gt;    &lt;p&gt;Your configuration should look similar to the one shown here:&lt;/p&gt;    &lt;img src="http://www.snee.com/bobdc.blog/img/tq/tbe02B70000023FD7CBD740.png" alt="" width="590" /&gt;    &lt;p&gt;&lt;strong&gt;Step 6: Configure Form&lt;/strong&gt;&lt;/p&gt;    &lt;p&gt;Now select the Form component on the left of the Application Configuration console and make the following modifications:&lt;/p&gt;    &lt;ul&gt;&lt;li&gt;       &lt;p&gt;Wire the Form to listen to the Tree Selection event. Click on Add existing entry next to Refresh Display (Listen Event) and start typing "Tree". When "Tree Selection" shows up in the drop down, select it and click OK.&lt;/p&gt;      &lt;/li&gt;&lt;li&gt;       &lt;p&gt;Create a new Post Event for the Request Resource Navigation listener. Call it Form Selection.&lt;/p&gt;      &lt;/li&gt;&lt;li&gt;       &lt;p&gt;The form is already configured to refresh when the end user clicks on a tree node, which sends a Tree Selection event. You also want the form to refresh if the end user clicks on the name of a concept on the currently displayed form. For example, if the form for the concept Sparrow shows that Sparrow's broader term is Bird, and the end user clicks on Bird, you want it to display data for the concept Bird. Click on Add existing entry next to the Refresh Display listen even and start typing Form. When "Form Selection" shows up in the drop down list, select it. It will join Tree Selection as the second value for the Tree's Refresh Display listen event.&lt;/p&gt;      &lt;/li&gt;&lt;/ul&gt;    &lt;p&gt;Your configuration should look similar to the one shown here:&lt;/p&gt;       &lt;img src="http://www.snee.com/bobdc.blog/img/tq/tbeStep6.jpg" alt="" width="590" /&gt;     &lt;p&gt;&lt;strong&gt;Step 7: Test and Save&lt;/strong&gt;&lt;/p&gt;    &lt;p&gt;Your new application is done.&lt;/p&gt;    &lt;p&gt;You can close the configuration console by clicking the X at the upper right and test your new application by creating new nodes in the tree with the buttons in the upper-right of the tree component and entering additional information in the forms as shown here: &lt;/p&gt;    &lt;img src="http://www.snee.com/bobdc.blog/img/tq/tbe033000000161D3B5C051.png" alt="" width="590" /&gt;    &lt;p&gt;As you add and select nodes in the Concept Hierarchy, the tab title and many of the fields in the form on the right will update automatically to provide information about the selected tree node.&lt;/p&gt;    &lt;p&gt;To save your application, click the Save App button. On the Save Application As dialog box, enter new values for Application Name and Application Base URI. (If this is not the first time you've saved this application, you'll also want to click the Overwrite check box.) The next time you go to the TopBraid Suite Console, you'll see your new application listed where you earlier saw New Application, Default Application, and the other choices.&lt;/p&gt;   &lt;p&gt;To save the data you've created using your new editor, such as the bird information shown in the screen shots, you or your application's end users would click the Save Data button. &lt;/p&gt;  &lt;p&gt;Applications like this can be hosted on the TopBraid Live server, where any users with browser access to that server can run your application and browse and edit the data you choose to make available. They don't need TopBraid Composer, and they don't need to know about RDF or any data modeling issues; they only need to know how to use the graphical, interactive application that you design for them using TopBraid Ensemble.&lt;/p&gt;   &lt;p&gt;So far, we've only seen a small part of what a TBE application can do for your end users. Take a look at the TopBraid Ensemble Application Development and Reference Guide (&lt;a href="http://www.topquadrant.com/products/TBE-Application-Development-Guide.pdf"&gt;pdf&lt;/a&gt;) to learn more.&lt;/p&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/7507012841435012041-4810090062139555765?l=topquadrantblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://topquadrantblog.blogspot.com/feeds/4810090062139555765/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7507012841435012041&amp;postID=4810090062139555765' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default/4810090062139555765'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default/4810090062139555765'/><link rel='alternate' type='text/html' href='http://topquadrantblog.blogspot.com/2010/01/how-to-create-topbraid-ensemble.html' title='How to: create a TopBraid Ensemble application'/><author><name>Bob DuCharme</name><uri>http://www.blogger.com/profile/02742075186312518829</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_13zlUS8aD_8/S0OhTCeBZ8I/AAAAAAAAAAM/cGInR6wDS84/S220/128x128.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7507012841435012041.post-1711780531374970987</id><published>2010-01-22T07:49:00.000-08:00</published><updated>2010-07-27T07:10:49.727-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='How to'/><title type='text'>How to: create and run a semantic web service</title><content type='html'>&lt;a name="howtowebsvc"&gt;&lt;!-- --&gt;&lt;/a&gt;&lt;p&gt;&lt;i&gt;An updated version of this blog post is now available as a chapter in the TopBraid &lt;a href="http://www.topquadrant.com/docs/tbc/AppDevQuickstartGuide.pdf"&gt;Application Development Quickstart Guide&lt;/a&gt; (pdf).&lt;/i&gt;&lt;/p&gt;When you know how to &lt;a href="http://topquadrantblog.blogspot.com/2010/01/how-to-write-new-sparql-functions-with.html"&gt;define a new function&lt;/a&gt; and &lt;a href="http://topquadrantblog.blogspot.com/2010/01/how-to-create-and-run-sparqlmotion.html"&gt;create a SPARQLMotion script&lt;/a&gt; in TopBraid Composer, you can put these two skills together to create a RESTful web service that can be called from any computer with HTTP access to the server running your web service. In a production environment where many people and systems might call your web service, TopBraid Live would be the best way to host it, but for developing and testing you can use the HTTP server built into TopBraid Composer Maestro Edition. Today we're going to see how to create a web service that searches the database about the Kennedy family included with TopBraid Composer and returns RDF/XML that lists everyone with a particular first name.&lt;div&gt;&lt;div class="section"&gt;  &lt;p&gt;But first, what makes this a "semantic" web service? TopBraid Composer puts all the power of semantic web technology, such as SPARQL, OWL, and more, behind your development efforts, and it lets you read and write both semantic web data formats and more traditional ones. By delivering RDF, your web service can plug into other semantic web applications, although you're certainly not limited to RDF as a delivery format—you can deliver XML, a spreadsheet, or even HTML, so that a browser hitting the URI you designate for your service would actually be displaying a dynamically generated web page. &lt;/p&gt;  &lt;p&gt;If you've never defined your own functions or created a SPARQLMotion script in TopBraid Composer, you'll want to review the earlier entries &lt;a href="http://topquadrantblog.blogspot.com/2010/01/how-to-write-new-sparql-functions-with.html"&gt;How to: write new SPARQL functions with SPIN&lt;/a&gt; and &lt;a href="http://topquadrantblog.blogspot.com/2010/01/how-to-create-and-run-sparqlmotion.html"&gt;How to: create and run a SPARQLMotion script&lt;/a&gt; before continuing.&lt;/p&gt;  &lt;/div&gt;  &lt;div class="section"&gt;&lt;h2 class="sectiontitle"&gt;Creating your script&lt;/h2&gt;  &lt;p&gt;Start by creating a SPARQLMotion File, but on the &lt;span class="uicontrol"&gt;Create SPARQLMotion File&lt;/span&gt; dialog box, remember to check the "Script will declare (Web) Services or Functions (.sms extension)" checkbox. If you name your file ws1, you'll see that TopBraid Composer then saves it with the full name ws1.sms.n3.&lt;/p&gt;  &lt;p&gt;Once you've created this file, turning it into a web service script involves two steps:&lt;/p&gt;   &lt;ol&gt;&lt;li&gt;Defining the function that the web service URI will call.&lt;/li&gt;&lt;li&gt;Defining the script that will be triggered by the function call.&lt;/li&gt;&lt;/ol&gt;  &lt;/div&gt;   &lt;div class="section"&gt;&lt;h2 class="sectiontitle"&gt;Defining the function to call&lt;/h2&gt;     &lt;p&gt;Create a new subclass of spin:Functions and name it searchKennedys. Add an sp:arg1 argument as a spin:constraint value using "Create from SPIN template" (as described in &lt;a href="http://topquadrantblog.blogspot.com/2010/01/how-to-write-new-sparql-functions-with.html"&gt;How to: write new SPARQL functions with SPIN&lt;/a&gt;) with a predicate value of sp:arg1. For the argument's comment field, enter "String to search for." Also, set its valueType to xsd:string so that the function receiving the passed argument value knows to treat it as a string and not as a URI. With that, you'll be finished configuring your spl:Argument and can click the OK button.&lt;/p&gt;  &lt;p&gt;A given SPARQLMotion script can have several possible endpoints return different variations on how the data is processed, so identifying a set of script modules to run means identifying a specific endpoint in a script. On the class form for your new searchKennedys function, set the sm:returnModule property by clicking the white triangle to display its context menu and then selecting "Create and add..." You will create this return module before adding it because you haven't created your script yet, so there's no endpoint module to point to. &lt;/p&gt;   &lt;p&gt;On the &lt;span class="uicontrol"&gt;Create and add&lt;/span&gt; dialog box, pick sml:ReturnRDF as the first module to add, as shown below. (It's a subclass of ExportToRemoteModules because your web service will return its results to a remote caller; you'd pick something from ExportToLocalModules if it were going to save the results in a local file.) Name your new module ReturnSearchResults.&lt;/p&gt;   &lt;img src="http://www.snee.com/bobdc.blog/img/howtocreatewebsvc1.jpg" alt="" /&gt;   &lt;p&gt;Click the OK button.&lt;/p&gt; &lt;/div&gt;    &lt;div class="section"&gt;&lt;h2 class="sectiontitle"&gt;Creating the SPARQLMotion script&lt;/h2&gt;  &lt;p&gt;Next, select "Edit SPARQLMotion script" from the &lt;span class="uicontrol"&gt;Scripts&lt;/span&gt; menu. You'll see that two modules have already been added to your new script: your ReturnSearchResults module and an Argument module to represent the arg1 argument being passed to your script.&lt;/p&gt;   &lt;img src="http://www.snee.com/bobdc.blog/img/howtocreatewebsvc2.jpg" alt="" width="590" /&gt;   &lt;p&gt;Note the gray "arg1" with a little arrow on a circle in the lower-right of the Argument module, which shows the name of the variable that's being set and passed along from it. Your script will use this variable to specify what to search for in the Kennedy family data.&lt;/p&gt;   &lt;p&gt;The next step is to add something to the script to read the data that it will search. Drag an Import RDF from Workspace icon from the Import from Local section of the palette onto the workspace and name it GetKennedysData. To configure it, double-click its icon, set its sml:sourceFilePath property to /TopBraid/Examples/kennedys.owl, and then click the &lt;span class="uicontrol"&gt;Edit GetKennedyData&lt;/span&gt; dialog box's Close button.&lt;/p&gt;   &lt;p&gt;Now we'll add the module that searches through the data and extracts the subset that we need. Drag an Apply Construct module from the palette's RDF Processing section onto the workspace and name it SelectData. Set its sml:replace property to True so that it only passes along the selected data and not the input data as well. Set the sml:constructQuery value to the following:&lt;/p&gt;  &lt;pre class="pre"&gt;PREFIX k: &amp;lt;http://topbraid.org/examples/kennedys#&gt;&lt;br /&gt;CONSTRUCT {&lt;br /&gt;?s k:firstName ?first .&lt;br /&gt;?s k:lastName ?last .&lt;br /&gt;}&lt;br /&gt;WHERE {&lt;br /&gt;?s k:firstName ?first .&lt;br /&gt;?s k:lastName ?last .&lt;br /&gt;FILTER regex(?first, &lt;strong&gt;?arg1&lt;/strong&gt;, "i" )&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;  &lt;p&gt;(After you press Enter, TopBraid Composer will replace the "k" namespace prefixes with the namespace URIs.) If you wanted this query to always search for firstName values with "John" in them, you could put that as the second argument of the regex function, but this query has something more flexible: a reference to the arg1 variable that will be passed in from the Argument module. (The third argument of "i" to this function tells it to ignore case when searching.) The use of the regex function means that it will search for substring matches as well, so that a search for "Car" will turn up Caroline Kennedy, Carolyn Bessete, and Cart Hood.&lt;/p&gt;  &lt;p&gt;You're finished configuring this module, so click the Close button and connect the two input modules to it like this (don't worry about connecting up the Return Search Results module just yet, and remember that at any time you can drag the module icons around to make the script's flow easier to understand):&lt;/p&gt;   &lt;img src="http://www.snee.com/bobdc.blog/img/howtocreatewebsvc3.jpg" alt="" width="590" /&gt;   &lt;p&gt;Select the SelectData module and then click the debug icon near the upper-left of the workspace to test it. Because no value has been passed for the Argument, a &lt;span class="uicontrol"&gt;SPARQLMotion Script Input&lt;/span&gt; dialog box prompts you for one. Enter "jean" as a test, press Enter, and then click the Next button. When it's finished, you should see triples storing the firstName and lastName values for Jean Olssen, Jean Kennedy, and Jeannie Ripp appear in the &lt;span class="uicontrol"&gt;SPARQLMotion Results&lt;/span&gt; view.  &lt;/p&gt;   &lt;p&gt;Your web service script can now do everything except return the data that it extracted from the data source to the process that called the service. Connect the Select data module to the Return search results module, which still needs one bit of configuration: to tell it to return the data as RDF/XML, double-click the icon and click the context menu for the sml:serialization property. Don't pick "Add empty row" this time; you want to add one of the predefined values from the sml:RDFSerialization class, so pick "Add Existing." On the &lt;span class="uicontrol"&gt;Add existing&lt;/span&gt; dialog box, click on sml:RDFSerialization, select sml:RDFXML on the right (note the other choices available to you), click this dialog box's OK button, and then click the &lt;span class="uicontrol"&gt;Edit ReturnSearchResults&lt;/span&gt; dialog box's Close button.&lt;/p&gt;  &lt;p&gt;Save your work. The final script should look something like this:&lt;/p&gt;   &lt;img src="http://www.snee.com/bobdc.blog/img/howtocreatewebsvc4.jpg" alt="" width="590" /&gt;  &lt;/div&gt;   &lt;div class="section"&gt;&lt;h2 class="sectiontitle"&gt;Registering and calling your web service&lt;/h2&gt; &lt;p&gt;Before something can tell TopBraid Live or the server built in to TopBraidComposer to call the searchKennedys function that calls this script, the function must be registered with the server. To do this, select "Refresh/Display SPARQLMotion functions..." from the &lt;span class="uicontrol"&gt;Script&lt;/span&gt; menu, and after a few seconds you'll see the updated list of registered functions on the &lt;span class="uicontrol"&gt;Console&lt;/span&gt; view.&lt;/p&gt;   &lt;p&gt;To test your web service, enter the following into any web browser running on the same computer as your copy of TopBraid Composer; note how its two parameters identify the function to call and the argument value to pass to it:&lt;/p&gt;  &lt;pre class="pre"&gt;http://localhost:8083/tbl/actions?action=sparqlmotion&amp;amp;id=searchKennedys&amp;amp;arg1=Rob&lt;br /&gt;&lt;/pre&gt;  &lt;p&gt;After making this call, you should see RDF/XML data in your web browser about the six people in the database who have "Rob" in their first name: five Roberts and a Robin. (For some browsers, you may need to to a View Source to see all the XML.) &lt;/p&gt;   &lt;p&gt;Congratulations! You now have a working, RESTful, semantic web service up and running. Any tool that can send a URI to the HTTP server built into TopBraid Composer and then parse the result can use it. (Most modern program languages include libraries that make this simple.) If you install your web service and the appropriate data files on a computer running TopBraid Live, multiple systems can retrieve data from that service at once.&lt;/p&gt;  &lt;p&gt;When you consider the possibilities of using data from more diverse, large-scale data sources and creating SPARQLMotion scripts that take advantage of a wider range of the modules available on the workspace palette, you'll start to see the tremendous possibilities of what you can do with your TopBraid semantic web services.&lt;/p&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/7507012841435012041-1711780531374970987?l=topquadrantblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://topquadrantblog.blogspot.com/feeds/1711780531374970987/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7507012841435012041&amp;postID=1711780531374970987' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default/1711780531374970987'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default/1711780531374970987'/><link rel='alternate' type='text/html' href='http://topquadrantblog.blogspot.com/2010/01/how-to-create-and-run-semantic-web.html' title='How to: create and run a semantic web service'/><author><name>Bob DuCharme</name><uri>http://www.blogger.com/profile/02742075186312518829</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_13zlUS8aD_8/S0OhTCeBZ8I/AAAAAAAAAAM/cGInR6wDS84/S220/128x128.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7507012841435012041.post-8083234399205769234</id><published>2010-01-14T20:38:00.000-08:00</published><updated>2010-07-27T07:11:52.736-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='How to'/><title type='text'>How to: create and run a SPARQLMotion script</title><content type='html'>&lt;p&gt;&lt;i&gt;An updated version of this blog posting is now available as a chapter in the TopBraid &lt;a href="http://www.topquadrant.com/docs/tbc/AppDevQuickstartGuide.pdf"&gt;Application Development Quickstart Guide&lt;/a&gt; (pdf).&lt;/i&gt;&lt;/p&gt;SPARQLMotion is a visual scripting language that lets you tie together triples from diverse data sources (whether they're natively stored as triples or not), process them using SPARQL, and then save the results in a wide choice of output formats. One of these scripts can be run from TopBraid Composer, as a semantic web service, or as the back end to a user interface created with TopBraid Ensemble. &lt;div&gt;&lt;div class="section"&gt;   &lt;p&gt;You create a SPARQLMotion script by dragging icons representing different kinds of modules from a palette onto a workspace and then filling out a dialog box for each to configure it. Here, we're going to look at the creation of a simple script, and in future entries on this blog we'll learn about more modules and what they can add to your application development: reading and writing spreadsheet data, reading and writing from large, disk-based triplestores, checking of data constraints, HTML and XML processing, and much more. &lt;/p&gt;   &lt;p&gt;Our sample script will import the triples from the FOAF ("Friend of a Friend") files of some well-known semantic web advocates, extract the names and nicknames of their friends who are listed there, and save the results in a new RDF file. Much more complex scripts are possible, but the creation of those scripts will always follow the basic steps described here.&lt;/p&gt;   &lt;p&gt;To create a SPARQLMotion file, create a new file in TopBraid Composer the same way you would create any other file. When you indicate that you want to create a file, you'll see that "SPARQLMotion File" is one of the options; picking it creates a file that already has the sparqlmotionfunctions and sparqlmotionlib libraries imported; these have what you need to add a script to your new file. Assign the file any Base URI and File name you like (for example, http://www.example.com/sm1 and sm1) and click the Finish button to indicate that you're done with the &lt;span class="uicontrol"&gt;Create SPARQLMotion File&lt;/span&gt; dialog box.&lt;/p&gt;   &lt;p&gt;Next,  select "Create SPARQLMotion Script" from TopBraid Composer's  &lt;span class="uicontrol"&gt;Scripts&lt;/span&gt; menu. A &lt;span class="uicontrol"&gt;Select initial module type&lt;/span&gt; dialog box will ask you about the first module to add to your script. Because the script will import RDF files from the web, start with an ImportRDFFromURL module and name it GetTimBLData:&lt;/p&gt;&lt;p&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.snee.com/bobdc.blog/img/howtosm1.jpg"&gt;&lt;img style="cursor: pointer; width: 419px; height: 596px;" src="http://www.snee.com/bobdc.blog/img/howtosm1.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;    &lt;img src="file:///C:/bob/writing/blogdrafts/howto/build/img/howtosm1.jpg" alt="" /&gt;  &lt;p&gt;After filling out the dialog box as shown and clicking the OK button, the script appears with its single module:&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.snee.com/bobdc.blog/img/howtosm2.jpg"&gt;&lt;img style="cursor: pointer; width: 592px; height: 348px;" src="http://www.snee.com/bobdc.blog/img/howtosm2.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;   &lt;img src="file:///C:/bob/writing/blogdrafts/howto/build/img/howtosm2.jpg" alt="" /&gt;  &lt;p&gt;Double-click the icon representing the module to configure it. The only information you must add to an ImportRDFFromURL module is the URL of the RDF to import. To set the value of a property such as sml:url on one of these dialog boxes when there is no existing value, display its context menu by clicking the white triangle next to it and select Add Empty Row. To to set the property value to retrieve Tim Berners-Lee's FOAF file, enter the value http://www.w3.org/People/Berners-Lee/card.rdf, as shown below. (I've also tweaked the rdfs:label value, and note from the "Ok" to the right of the sm:url that the data entry of this field is not complete—TopBraid Composer will not know about this new value until you either press the Enter key with the cursor in that field or click on "Ok" to make it go away.)&lt;/p&gt;&lt;p&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.snee.com/bobdc.blog/img/howtosm3.jpg"&gt;&lt;img style="cursor: pointer; width: 575px; height: 382px;" src="http://www.snee.com/bobdc.blog/img/howtosm3.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;We'll see shortly why you don't have to add a value for the sm:next property on this dialog box. Click the Close button to return to the script workspace. &lt;/p&gt;    &lt;p&gt;At this point, your script only has one module, but you can still run it. Clicking a module icon selects it, and clicking the little bug icon ("Debug selected SPARQLMotion module") at the top of your workspace tells TopBraid Composer to run the script up to the selected module. Do this with GetTimBLData, and after it retrieves the triples from the designated URL, TopBraid Composer displays a message box offering to display the result triples in TopBraid Composer's &lt;span class="uicontrol"&gt;SPARQLMotion Results&lt;/span&gt; view. &lt;/p&gt;   &lt;p&gt;As with so many semantic web applications, this one becomes more interesting when you add more data sources and then select a subset of the combined data that meets your needs. If you don't see the module palette on the right side of the script workspace, click the small white triangle in the upper-right of the workspace to display it. To add a second module, click "Import from Remote" on the palette and click the small darker triangle to scroll through the choices there. When you see &lt;span class="uicontrol"&gt;Import RDF from URL&lt;/span&gt;, add a new one of these modules to your workspace by dragging it there and name it GetJimHendlerData. Enter http://www.cs.umd.edu/~hendler/2003/foaf.rdf as the data's location. Then, add a third &lt;span class="uicontrol"&gt;Import RDF from URL&lt;/span&gt; module named GetDanBrickleyData and set http://danbri.org/foaf.rdf as the sml:url value. (At any point in the creation and editing of your script modules, you can rearrange the icons by selecting and dragging them.)&lt;/p&gt;    &lt;p&gt;Once the script retrieves data from these three sources, it will send it to a module that only passes along the triples that identify the name and nickname values found the source data. Drag an &lt;span class="uicontrol"&gt;Apply Construct&lt;/span&gt; module from the RDF Processing section of the palette onto the workspace and name it ExtractData. After this module appears, double-click it and set the sml:constructQuery's value to the following: &lt;/p&gt;&lt;pre class="pre"&gt;CONSTRUCT {&lt;br /&gt;?s a &amp;lt;http://xmlns.com/foaf/0.1/Person&gt; .&lt;br /&gt;?s &amp;lt;http://xmlns.com/foaf/0.1/name&gt; ?name .&lt;br /&gt;?s &amp;lt;http://xmlns.com/foaf/0.1/nick&gt; ?nick .&lt;br /&gt;}&lt;br /&gt;WHERE {&lt;br /&gt;?s &amp;lt;http://xmlns.com/foaf/0.1/name&gt; ?name .&lt;br /&gt;?s &amp;lt;http://xmlns.com/foaf/0.1/nick&gt; ?nick .&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;  &lt;p&gt;You can use SPARQL CONSTRUCT queries to rearrange and cross-reference data to infer and create new information based on the input, but our simple query merely finds and passes along triples that match two patterns and declares that the subject that has these properties is a Person as defined by the FOAF vocabulary.&lt;/p&gt;  &lt;p&gt;After entering this CONSTRUCT query, set the same dialog box's sml:replace value to True so that only the constructed triples get passed along to the output without the input data. Now you're finished with this dialog box, so click its Close button.&lt;/p&gt;   &lt;p&gt;We haven't identified the input of this CONSTRUCT module yet. Instead of writing code, we can do it by just pointing and clicking. To make your first connection, select the &lt;span class="uicontrol"&gt;Add connection&lt;/span&gt; icon on the Palette, click on the GetTimBLData module, and then click the ExtractData module. An arrow will appear to show that data will flow from one to the other when the script is run:&lt;/p&gt;&lt;img style="width: 591px; height: 316px;" src="http://www.snee.com/bobdc.blog/img/howtosm4.jpg" alt="" /&gt;  &lt;p&gt;Follow the same steps to connect the other two data retrieval modules to ExtractData. &lt;/p&gt;  &lt;p&gt;Instead of waiting until the application is finished to test it, we can do more incremental testing here. Select the ExtractData module, click the debug icon at the top, and you should end up with a list of names, nicknames, and foaf:Person type declarations in the &lt;span class="uicontrol"&gt;SPARQLMotion Results&lt;/span&gt; view. &lt;/p&gt;  &lt;p&gt;Our final step has two parts:&lt;/p&gt;  &lt;ol&gt;&lt;li&gt;&lt;p&gt;Tell the script to save the results of the ExtractData module to an RDF file. From the Export to Local section of the Palette, drag an &lt;span class="uicontrol"&gt;Export to RDF file&lt;/span&gt; module onto the workspace and call it SaveOutput. Double-click the new module and set the sml:baseURI property to http://mytest/ (or any URI you like; it will be used as the base URI of the saved file) and set sml:targetFilePath to sm1out.rdf. If you don't specify a path for this file, the SPARQLMotion script will save the file in the same directory as the script itself. After setting these two values, click the Close button.&lt;/p&gt; &lt;/li&gt;&lt;li&gt;&lt;p&gt;By including the FOAF ontology in your output, applications that read the file created by your script will have more context about the meaning of the data. You can import this ontology from the web, but the TopBraid Composer distribution includes many popular ontologies so that importing them will happen more quickly. From the Import from Local section of the SPARQLMotion palette, drag an &lt;span class="uicontrol"&gt;Import RDF from workspace&lt;/span&gt; module onto the workspace and name it FOAFOntology. Double-click it, set its sml:sourceFilePath property to /TopBraid/Common/foaf.owl, press Enter, and then click the dialog box's Close button. &lt;/p&gt; &lt;/li&gt;&lt;/ol&gt;   &lt;p&gt;Use &lt;span class="uicontrol"&gt;Add connection&lt;/span&gt; to connect the ExtractData and the FOAFOntology modules to the Save Output module. Your completed script should look like this: &lt;/p&gt;   &lt;img style="width: 590px; height: 325px;" src="http://www.snee.com/bobdc.blog/img/howtosm5.jpg" alt="" /&gt;   &lt;p&gt;After saving your application, test it by selecting the Save Output module and clicking the debug icon. As it runs, watch the &lt;span class="uicontrol"&gt;Console&lt;/span&gt; view, which has informational messages about your script as it runs. This and the &lt;span class="uicontrol"&gt;Error Log&lt;/span&gt; view are valuable for debugging complex scripts.&lt;/p&gt;   &lt;p&gt;The script should create the sm1out.rdf file described above. Open it up, and then in TopBraid Composer's &lt;span class="uicontrol"&gt;Classes&lt;/span&gt; view, drill down from owl:Thing to foaf:Agent and select foaf:Person so that the instances you've created appear in TopBraid Composer's &lt;span class="uicontrol"&gt;Instances&lt;/span&gt; view. Selecting any of them there will display details about that person in the &lt;span class="uicontrol"&gt;Form&lt;/span&gt; view, where you'll see the name and nickname assigned to that person somewhere on that form. (You may need to scroll down a bit to see those particular properties.)&lt;/p&gt;   &lt;p&gt;If you look through the many module choices on the SPARQLMotion palette you'll get some idea of the wide variety of possibilities you have for the kinds of data that a script can read and write and the sophisticated options for processing that data. We'll look at many of them in future entries here. Meanwhile, take a look at &lt;a href="http://www.youtube.com/topquadrant#p/a/u/1/5r4mHN7KuWo&amp;amp;fmt=18"&gt;this short video&lt;/a&gt;, which shows you how to create another simple script that uses a few more interesting modules.&lt;/p&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/7507012841435012041-8083234399205769234?l=topquadrantblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://topquadrantblog.blogspot.com/feeds/8083234399205769234/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7507012841435012041&amp;postID=8083234399205769234' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default/8083234399205769234'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default/8083234399205769234'/><link rel='alternate' type='text/html' href='http://topquadrantblog.blogspot.com/2010/01/how-to-create-and-run-sparqlmotion.html' title='How to: create and run a SPARQLMotion script'/><author><name>Bob DuCharme</name><uri>http://www.blogger.com/profile/02742075186312518829</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_13zlUS8aD_8/S0OhTCeBZ8I/AAAAAAAAAAM/cGInR6wDS84/S220/128x128.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7507012841435012041.post-5469679578197256017</id><published>2010-01-05T12:44:00.000-08:00</published><updated>2010-07-27T07:13:10.802-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='How to'/><title type='text'>How to: write new SPARQL functions with SPIN</title><content type='html'>&lt;p&gt;&lt;i&gt;An updated version of this blog post is now available as a chapter in the TopBraid &lt;a href="http://www.topquadrant.com/docs/tbc/AppDevQuickstartGuide.pdf"&gt;Application Development Quickstart Guide&lt;/a&gt; (pdf).&lt;/i&gt;&lt;/p&gt;&lt;br /&gt;This is the first of a series of short pieces on how to use various features of the TopBraid Suite application development tool set. For example, we'll see how to create a SPARQLMotion script, how to create a user interface with TopBraid Ensemble, how to create a web service, how to convert triples to XML and run an XSLT stylesheet on them, and how to use data from spreadsheets, databases, public SPARQL endpoints, and more. These postings will focus mostly on application development, and assume that you already know the basics of TopBraid Composer itself, which you can learn from the "TopBraid Composer Getting Started Guide" &lt;a id="id103350" href="http://www.topquadrant.com/docs/marcom/TBC-Getting-Started-Guide.pdf"&gt;(pdf)&lt;/a&gt;. Each posting will be assigned to the &lt;a id="id103305" href="http://topquadrantblog.blogspot.com/search/label/How%20to"&gt;How to&lt;/a&gt; category of this blog to make it easier for readers to use them as a set.&lt;div id="id103344"&gt; &lt;p id="id103315"&gt;This first entry shows how you can define your own functions using the SPARQL Inferencing Notation, because it's such an important building block for many of the techniques that we'll learn about in future entries. This material is excerpted from the "Getting Started with SPIN" &lt;a id="id103318" href="http://www.topquadrant.com/spin/tutorial/SPINTutorial-1.0.pdf"&gt;(pdf)&lt;/a&gt; document, which is available for you to download. The complete "Getting Started with SPIN" document also covers inferencing, constructors, constraints, and more.&lt;/p&gt; &lt;p id="id103367"&gt;Before we cover the definition of new functions, let's review the calling of functions in TopBraid, because there are so many useful ones available to you.&lt;/p&gt;  &lt;div id="id103374"&gt;&lt;h2 id="id103375"&gt;Calling built-in functions&lt;/h2&gt;   &lt;p id="id103379"&gt;The "TopBraid SPARQLMotion Functions Library" page of TopBraid Composer's online help lists over 70 functions available for you to call from your applications, including string functions, mathematical functions, logical functions, and ontology functions. Because TopBraid Composer uses the Jena SPARQL engine, it supports the LET keyword for assignment of variables, which gives you a way to experiment with built-in variables using a short, simple SPARQL query.&lt;/p&gt;  &lt;p id="id103391"&gt;For example, to try the mathematical function &lt;code id="id103394"&gt;smf:random()&lt;/code&gt; (a TopBraid Composer extension to the Jena function library), enter the following query in the &lt;span id="id103398" class="uicontrol"&gt;SPARQL&lt;/span&gt; view's Query Editor tab:&lt;/p&gt;  &lt;pre id="id103407" class="pre"&gt;SELECT ?x&lt;br /&gt;WHERE {&lt;br /&gt;LET (?x := smf:random()).&lt;br /&gt;}&lt;/pre&gt;  &lt;p id="id103415"&gt;To execute it, either click the "Execute SPARQL" green triangle button            &lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_13zlUS8aD_8/S0OlmdJeo1I/AAAAAAAAAA4/v1d9zoxtLB0/s1600-h/spintut12.jpg"&gt;&lt;img style="cursor: pointer; width: 11px; height: 12px;" src="http://1.bp.blogspot.com/_13zlUS8aD_8/S0OlmdJeo1I/AAAAAAAAAA4/v1d9zoxtLB0/s320/spintut12.jpg" alt="" id="BLOGGER_PHOTO_ID_5423360456362206034" border="0" /&gt;&lt;/a&gt; or press Ctrl+Enter, and you'll see a random number between 0 and 1 appear in the [x] column of the SPARQL query result. Because this function returns a different value each time you call it, go ahead and execute it a few more times.&lt;/p&gt;&lt;p id="id103415"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.snee.com/bobdc.blog/img/spintut2.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 444px; height: 139px;" src="http://www.snee.com/bobdc.blog/img/spintut2.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Another built-in extension function is &lt;code id="id103440"&gt;smf:parseDate()&lt;/code&gt;, which converts a string in a semi-structured date format into an xsd:date, xsd:dateTime, or xsd:time value. (To learn more about &lt;code id="id103446"&gt;smf:random()&lt;/code&gt;, &lt;code id="id103451"&gt;smf:parseDate()&lt;/code&gt;, and other available functions, select &lt;span id="id103456" class="uicontrol"&gt;Help Contents&lt;/span&gt; from the &lt;span id="id103463" class="uicontrol"&gt;Help&lt;/span&gt; menu and then &lt;span id="id103470" class="uicontrol"&gt;TopBraid Composer&lt;/span&gt; -&gt; &lt;span id="id103476" class="uicontrol"&gt;Reference&lt;/span&gt; -&gt; &lt;span id="id103483" class="uicontrol"&gt;SPARQLMotion Functions Reference&lt;/span&gt;.) This function takes two parameters: a date string and a template showing which pieces of  the date are where in that string. Try pasting the following query into the &lt;span id="id103493" class="uicontrol"&gt;SPARQL&lt;/span&gt;&lt;p id="id103437"&gt; view and executing it: &lt;/p&gt;  &lt;pre id="id103502" class="pre"&gt;SELECT ?x&lt;br /&gt;WHERE {&lt;br /&gt;LET (?x := smf:parseDate("12/3/09","MM/dd/yy")).&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;   &lt;p id="id103511"&gt;The value displayed under [x] is "2009-12-03". (The TopBraid Composer online help for this function includes the URL of a web page with greater detail about options for the format string in the &lt;code id="id103517"&gt;smf:parseDate()&lt;/code&gt; function's second parameter.)&lt;/p&gt;  &lt;p id="id103523"&gt;We're going build on this function to create a simpler function to convert dates in the MM/dd/yy format. &lt;/p&gt;  &lt;/div&gt;   &lt;div id="id103530"&gt;&lt;h2 id="id103532"&gt;Defining your own functions&lt;/h2&gt;   &lt;p id="id103536"&gt;Before we use the SPIN vocabulary, we need to import it into our vocabulary. Open your &lt;span id="id103540" class="uicontrol"&gt;Import&lt;/span&gt;&lt;/p&gt;&lt;p id="id103536"&gt;&lt;span id="id103540" class="uicontrol"&gt;s&lt;/span&gt; view and drag the &lt;span id="id103547" class="filepath"&gt;spin.owl&lt;/span&gt; file from the TopBraid/TBC folder in the &lt;span id="id103555" class="uicontrol"&gt;Navigator&lt;/span&gt; view into the &lt;span id="id103562" class="uicontrol"&gt;Import&lt;/span&gt; view. You'll see several new nodes appear in the &lt;span id="id103568" class="uicontrol"&gt;Properties&lt;/span&gt; view, each with an sp: or spin: prefix and a plus sign next to it that expands the node to show the full range of SPIN properties. For now, you won't need to use these properties from this view, because TopBraid Composer gives you forms to fill out to specify everything you need to define a new function. &lt;/p&gt; &lt;/div&gt;  &lt;p id="id103582"&gt;The &lt;span id="id103585" class="uicontrol"&gt;Classes&lt;/span&gt; view also shows a few new classes. Click the plus sign next to &lt;span id="id103592" class="uicontrol"&gt;spin:Modules&lt;/span&gt; to expand it, and you'll see that one of the subclasses is spin:Functions.&lt;/p&gt;   &lt;p id="id103601"&gt;To create your new function,&lt;/p&gt;  &lt;ol id="id103606"&gt;&lt;li id="id103608"&gt;&lt;p id="id103609"&gt;Right-click on &lt;span id="id103612" class="uicontrol"&gt;spin:Functions&lt;/span&gt; and pick &lt;span id="id103619" class="uicontrol"&gt;Create subclass&lt;/span&gt; from the context menu.&lt;/p&gt; &lt;/li&gt;&lt;li id="id103629"&gt;&lt;p id="id103630"&gt; On the "Create Classes" dialog box, click on the default new function name of "Functions_1", replace it with the name "mmddyy2ISO8601", and press Enter.&lt;/p&gt;        &lt;/li&gt;&lt;li id="id103638"&gt;&lt;p id="id103640"&gt;Click the &lt;span id="id103642" class="uicontrol"&gt;OK&lt;/span&gt; button. You'll see that your new subclass of spin:Functions is currently selected in the &lt;span id="id103650" class="uicontrol"&gt;Classes&lt;/span&gt; view, and the class form will have the &lt;span id="id103658" class="uicontrol"&gt;URI&lt;/span&gt; and &lt;span id="id103664" class="uicontrol"&gt;rdfs:subClassOf&lt;/span&gt; values already filled out. &lt;/p&gt;&lt;/li&gt;&lt;/ol&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.snee.com/bobdc.blog/img/spintut3.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 574px; height: 427px;" src="http://www.snee.com/bobdc.blog/img/spintut3.jpg" alt="" border="0" /&gt;&lt;/a&gt;  &lt;p id="id103683"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p id="id103683"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p id="id103683"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p id="id103683"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p id="id103683"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p id="id103683"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p id="id103683"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p id="id103683"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p id="id103683"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p id="id103683"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p id="id103683"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p id="id103683"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p id="id103683"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p id="id103683"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p id="id103683"&gt;Your new function will have an argument passed to it: the date string to convert. The body of the function must reference this argument, so let's define the argument before creating the function body. Like everything else in SPIN, this definition will ultimately be stored with a series of triples, but because argument definition is so common in application development, SPIN includes a template to make it easier.&lt;/p&gt;  &lt;ol id="id103707"&gt;&lt;li id="id103709"&gt;&lt;p id="id103711"&gt;SPIN models arguments to functions as constraints on those functions. On the mmddyy2ISO8601 class form, click the &lt;span id="id103715" class="uicontrol"&gt;spin:constraint&lt;/span&gt; widget (the small white triangle to the right of the name "spin:constraint") and pick "Create from SPIN template".&lt;/p&gt; &lt;/li&gt;&lt;li id="id103726"&gt;&lt;p id="id103728"&gt;Select &lt;span id="id103730" class="uicontrol"&gt;spl:Argument&lt;/span&gt; from the &lt;span id="id103737" class="uicontrol"&gt;Available Ask/Construct Templates&lt;/span&gt; list, and then fill in the following two fields in the &lt;span id="id103745" class="uicontrol"&gt;Arguments&lt;/span&gt; panel on the right of the "Create from SPIN template..." dialog box:&lt;/p&gt;  &lt;ul id="id103755"&gt;&lt;li id="id103758"&gt;&lt;p id="id103759"&gt;In the &lt;span id="id103761" class="uicontrol"&gt;comment&lt;/span&gt; field, enter &lt;kbd id="id103768" class="userinput"&gt;Convert mm/dd/yy formatted date to xsd:date type and format&lt;/kbd&gt;. (Remember to press the Enter key after entering a value on one of these forms. If you tab to another field and the &lt;span id="id103778" class="uicontrol"&gt;comment&lt;/span&gt; field has a heavier border around it and and the "Create from SPIN template" dialog box's &lt;span id="id103786" class="uicontrol"&gt;OK&lt;/span&gt; button is grayed out so that you can't click it, go back tot he &lt;span id="id103793" class="uicontrol"&gt;comment&lt;/span&gt; field and press the Enter key.)&lt;/p&gt; &lt;/li&gt;&lt;li id="id103803"&gt;&lt;p id="id103804"&gt;Instead of typing a value directly into the &lt;span id="id103808" class="uicontrol"&gt;predicate&lt;/span&gt; field, click the plus sign to the right of it. This displays a "Select Resource..." dialog box; because we're defining our first (and only) argument to pass to the new mmddyy2ISO8601 function, click &lt;span id="id103818" class="uicontrol"&gt;sp:arg1&lt;/span&gt; on the right panel and then the &lt;span id="id103825" class="uicontrol"&gt;OK&lt;/span&gt; button.&lt;/p&gt;  &lt;/li&gt;&lt;/ul&gt; &lt;/li&gt;&lt;li id="id103837"&gt;&lt;p id="id103838"&gt;Click the &lt;span id="id103841" class="uicontrol"&gt;OK&lt;/span&gt; button to finish with the "Create from SPIN template" dialog box, and you'll see that the &lt;span id="id103849" class="uicontrol"&gt;spin:constraint&lt;/span&gt; field of the class form for your new mmddyy2ISO8601 function has been filled out.&lt;/p&gt;   &lt;/li&gt;&lt;li id="id103860"&gt;&lt;p id="id103861"&gt;All that remains is to define the function body. Click the &lt;span id="id103865" class="uicontrol"&gt;spin:body&lt;/span&gt; widget on the class form and select &lt;span id="id103872" class="uicontrol"&gt;Add empty row&lt;/span&gt;.&lt;/p&gt; &lt;/li&gt;&lt;li id="id103882"&gt;&lt;p id="id103883"&gt;Enter the following as the body:&lt;/p&gt;  &lt;pre id="id103888" class="pre"&gt;SELECT ?x&lt;br /&gt;WHERE {&lt;br /&gt;LET (?x := smf:parseDate(?arg1, "MM/dd/yy")) .&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;   &lt;/li&gt;&lt;/ol&gt;  &lt;p id="id103900"&gt;The body of this function uses &lt;code id="id103903"&gt;?x&lt;/code&gt; as the variable name, but you can use any name you want. If you have more than one variable, and it binds to more than one value, the function will return the first value of the first variable, so there's no point in naming more than one variable after the SELECT keyword.&lt;/p&gt;  &lt;p id="id103912"&gt;Note how, in this SPARQL query, the first argument to the &lt;code id="id103916"&gt;smf:parseDate()&lt;/code&gt; function is &lt;code id="id103920"&gt;arg1&lt;/code&gt;, which we defined on the &lt;span id="id103925" class="uicontrol"&gt;spin:constraint&lt;/span&gt; part of the form earlier.&lt;/p&gt;  &lt;p id="id103934"&gt;Your new functions should be all ready. Test it by entering and executing the following in the &lt;span id="id103938" class="uicontrol"&gt;SPARQL&lt;/span&gt; view:&lt;/p&gt;  &lt;pre id="id103946" class="pre"&gt;SELECT ?x&lt;br /&gt;WHERE {&lt;br /&gt;LET (?x := :mmddyy2ISO8601("9/6/09")).&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;  &lt;p id="id103955"&gt;When you make calls to your own functions, don't forget the colon at the beginning of the function call and, if your function was not defined in the default namespace, the namespace prefix before that. All function calls are in a particular namespace (for example, &lt;code id="id103962"&gt;parseDate()&lt;/code&gt; is in the namespace represented by the &lt;code id="id103967"&gt;smf&lt;/code&gt; prefix), and your new &lt;code id="id103971"&gt;mmddyy2ISO8601()&lt;/code&gt; function is in the default namespace for this project. For production application development, it's better to identify the function's namespace with a specific prefix, because it will be easier to import the code into another file without confusion.&lt;/p&gt;  &lt;p id="id103981"&gt;&lt;code id="id103982"&gt;mmddyy2ISO8601()&lt;/code&gt; is now a function that you can call anywhere, including from the body of new functions that you create. Test it further in the &lt;span id="id103989" class="uicontrol"&gt;SPARQL&lt;/span&gt; view by passing other dates as a parameter. &lt;/p&gt;      &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7507012841435012041-5469679578197256017?l=topquadrantblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://topquadrantblog.blogspot.com/feeds/5469679578197256017/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7507012841435012041&amp;postID=5469679578197256017' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default/5469679578197256017'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default/5469679578197256017'/><link rel='alternate' type='text/html' href='http://topquadrantblog.blogspot.com/2010/01/how-to-write-new-sparql-functions-with.html' title='How to: write new SPARQL functions with SPIN'/><author><name>Bob DuCharme</name><uri>http://www.blogger.com/profile/02742075186312518829</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_13zlUS8aD_8/S0OhTCeBZ8I/AAAAAAAAAAM/cGInR6wDS84/S220/128x128.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_13zlUS8aD_8/S0OlmdJeo1I/AAAAAAAAAA4/v1d9zoxtLB0/s72-c/spintut12.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7507012841435012041.post-8451736439314019019</id><published>2009-12-16T16:17:00.000-08:00</published><updated>2009-12-16T16:20:22.848-08:00</updated><title type='text'>RDFa on topquadrant.com</title><content type='html'>&lt;div id="id103285"&gt;&lt;a id="id103290" href="http://www.w3.org/TR/2008/REC-rdfa-syntax-20081014/"&gt;RDFa&lt;/a&gt; is the W3C standard for embedding RDF triples in arbitrary XML using attributes. Its most popular use is in HTML, because it makes it easy to add machine-readable versions of a web page's information with minimal new markup.&lt;br /&gt;&lt;p id="id103302"&gt;You could add this markup to just about any web page, but it's especially useful on pages with information that is good for redistribution and can be described with popular vocabularies. We've just added RDFa to our &lt;a id="id103309" href="http://www.topquadrant.com/products/TB_Suite.html"&gt;products&lt;/a&gt;, &lt;a id="id103316" href="http://www.topquadrant.com/company/mgmt.html"&gt;management&lt;/a&gt;, and &lt;a id="id103324" href="http://www.topquadrant.com/company/contact.html"&gt;contact&lt;/a&gt; pages using the &lt;a id="id103331" href="http://www.foaf-project.org/"&gt;FOAF&lt;/a&gt;, &lt;a id="id103337" href="http://dublincore.org/"&gt;Dublin Core&lt;/a&gt;, &lt;a id="id103344" href="http://www.w3.org/TR/vcard-rdf"&gt;vcard&lt;/a&gt;, and &lt;a id="id103351" href="http://www.heppnetz.de/projects/goodrelations/"&gt;GoodRelations&lt;/a&gt; vocabularies.&lt;/p&gt;GoodRelations is the newest of these vocabularies, and it's getting popular quickly. A recent &lt;a id="id103364" href="http://priyankmohan.blogspot.com/2009/12/online-retail-how-best-buy-is-using.html"&gt;Semantic Technology Blog&lt;/a&gt; posting described a talk at the 2009 Search Engine Strategies conference in which BestBuy's Lead Web Development Engineer described how "GoodRelations + RDFa improved the rank of the respective pages in Google tremendously." In addition to improving page rank when selling products, RDFa makes it easier to share other kinds of information for use by applications on web pages where the data is already present for human consumption, whether it's research data, government data, or airline flight schedules.&lt;br /&gt;&lt;p id="id103382"&gt;An increasing number of tools are available for extracting triples from web pages with embedded RDFa, and the TopBraid Suite has supported this for a while. A TopBraid application can define a particular internet or intranet web page as an RDFa data source so that each time you run the application it will check for the latest set of triples in that page and then incorporate that data with the other data and logic used for that application. &lt;/p&gt;And now, applications like this can pull data about TopQuadrant's products, people, and places from our HTML web pages!&lt;br /&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/7507012841435012041-8451736439314019019?l=topquadrantblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://topquadrantblog.blogspot.com/feeds/8451736439314019019/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7507012841435012041&amp;postID=8451736439314019019' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default/8451736439314019019'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default/8451736439314019019'/><link rel='alternate' type='text/html' href='http://topquadrantblog.blogspot.com/2009/12/rdfa-on-topquadrantcom.html' title='RDFa on topquadrant.com'/><author><name>Bob DuCharme</name><uri>http://www.blogger.com/profile/02742075186312518829</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_13zlUS8aD_8/S0OhTCeBZ8I/AAAAAAAAAAM/cGInR6wDS84/S220/128x128.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7507012841435012041.post-4713276009875344563</id><published>2009-11-02T16:21:00.000-08:00</published><updated>2009-11-02T19:40:14.642-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='topbraid'/><category scheme='http://www.blogger.com/atom/ns#' term='upgrade'/><title type='text'>What's new in TopBraid Suite 3.2</title><content type='html'>&lt;div id="i0"&gt;3.2 is a minor release of TopBraid Suite, but it adds more than just background improvements such as faster performance and improvements to both memory management and 64-bit support. Each of TopBraid Suite's components includes new features that will ease the development of Semantic Web applications and offer a wider range of features to include in those applications. The following lists some highlights:&lt;br /&gt;&lt;h4&gt;TopBraid Composer&lt;/h4&gt;TopBraid Composer makes it easy to develop and integrate Semantic Web data models, SPARQL Inferencing Notation (SPIN) inferencing rules, and SPARQLMotion data processing pipelines into a standards-compliant application. New TopBraid Composer features in release 3.2 include:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;p&gt;OWL 2 support, with features such as property chain axioms, user-defined datatypes, and OWL 2 class axioms. Read more at VP of Product Development Holger Knublach's blog posting &lt;a href="http://composing-the-semantic-web.blogspot.com/2009/10/owl-2-support-in-topbraid-composer.html"&gt;OWL 2 Support in TopBraid Composer&lt;/a&gt;.&lt;br /&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;New SPIN features such as spin:fix to implement suggestions for constraint violation fixes,  easier control over rule execution, and the ability to distribute rules across devices. An important new improvement is support for user-defined magic properties in SPIN, allowing users to define rules with backward chaining. You can define  a magic property, or property function, using SPARQL and then use it as the predicate in another SPARQL expression to compute new values based on the data being queried. Holger's &lt;a href="http://composing-the-semantic-web.blogspot.com/2009/11/magic-properties-with-spin.html"&gt;Magic Properties with SPIN&lt;/a&gt; blog posting has some good examples.&lt;br /&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;A new SPARQL debugger that lets you set break points, display intermediate variable bindings, collect statistics, and see the internal algebra of SPARQL queries as they run. Holger's recent &lt;a href="http://composing-the-semantic-web.blogspot.com/2009/11/sparql-debugger-and-profiler.html"&gt;blog posting&lt;/a&gt; on this topic walks the reader through the underlying logic, the use of the debugger view, and the use of profiling.&lt;br /&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;More options for the display of long lists in the Properties and Classes view, making it easier to find what you're looking for quickly.&lt;br /&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;Easier packaging of a project developed with TopBraid Composer for deployment to a server running TopBraid Live for use by multiple users.&lt;br /&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;Support for the latest major release of the Eclipse platform, release 3.5.&lt;br /&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;h4&gt;TopBraid Ensemble&lt;/h4&gt;With TopBraid Ensemble, you can create web-based user interfaces for the applications you develop using Composer. End users, without using Composer, can interact with your application's data using a wide choice of graphical interface components that you customize for them. New Ensemble features in 3.2 include:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;p&gt;Support for pop-up windows,  so that you can build wizards that lead your application's users through a series of steps.&lt;br /&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;Support for multi-page applications, letting you spread the interface for more complex applications across a series of pages, as with a tabbed interface.&lt;br /&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;A new, customizable button component that lets your application's users trigger events with a mouse click.&lt;br /&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;A new SPARQL Relay component, which can listen for events and trigger SPARQLMotion scripts in the background of your application.&lt;br /&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;h4&gt;TopBraid Live&lt;/h4&gt;TopBraid Live lets you deploy your application for use by hundreds of users with the screens that you designed with Ensemble, with screens that were custom-built using Adobe Flex, or with an automated web services interface. New features in 3.2 include:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;p&gt;User and group management, including optional integration with LDAP roles.&lt;br /&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;Access Control Lists for projects, folders and graphs.&lt;br /&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;The ability to host an application as a SPARQL end point.&lt;br /&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;Significant performance improvements when used with Oracle.&lt;br /&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;For a complete list of new features in TopBraid Ensemble release 3.2, see the &lt;a href="http://www.topquadrant.com/products/release_notes/v3_2_0.html"&gt;3.2 Release Notes&lt;/a&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/7507012841435012041-4713276009875344563?l=topquadrantblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://topquadrantblog.blogspot.com/feeds/4713276009875344563/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7507012841435012041&amp;postID=4713276009875344563' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default/4713276009875344563'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default/4713276009875344563'/><link rel='alternate' type='text/html' href='http://topquadrantblog.blogspot.com/2009/11/whats-new-in-topbraid-suite-32.html' title='What&apos;s new in TopBraid Suite 3.2'/><author><name>Bob DuCharme</name><uri>http://www.blogger.com/profile/02742075186312518829</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_13zlUS8aD_8/S0OhTCeBZ8I/AAAAAAAAAAM/cGInR6wDS84/S220/128x128.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7507012841435012041.post-1282953448495735675</id><published>2009-10-14T16:53:00.000-07:00</published><updated>2011-03-04T05:46:06.586-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SPIN'/><category scheme='http://www.blogger.com/atom/ns#' term='SPARQL'/><title type='text'>SPIN Tutorial Available</title><content type='html'>&lt;div id="i0"&gt;&lt;p&gt;I &lt;a href="http://www.snee.com/bobdc.blog/2009/10/a-rules-language-for-rdf.html"&gt;recently wrote&lt;/a&gt; in my personal blog about how, since joining TopQuadrant, I've grown to appreciate how well SPARQL can serve as a rules language. SPARQL Inferencing Notation, or &lt;a href="http://www.spinrdf.org/"&gt;SPIN&lt;/a&gt;, lets you associate rules and constraints expressed in SPARQL with classes of triples. While you don't need to use TopQuadrant products to take advantage of SPIN, they sure make it much easier, especially if you want to use those rules as part of an application.  I just finished writing a &lt;a href="http://www.topquadrant.com/spin/tutorial/SPARQLRulesTutorial.pdf"&gt;tutorial&lt;/a&gt; (pdf) on how to implement SPIN rules and constraints with your models using TopBraid Composer, and except for one optional detail of the tutorial, it all works with the &lt;a href="http://www.topquadrant.com/products/TB_Composer.html#free"&gt;free edition&lt;/a&gt;, so it's available for anyone with a Mac or Windows machine to try. &lt;/p&gt;&lt;p&gt;Using a &lt;a href="http://www.topquadrant.com/topbraid/examples/purchases"&gt;small collection of data&lt;/a&gt; about service contracts and materials purchases, the tutorial walks you through the creation of:&lt;br /&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;p&gt;your own functions, written in SPARQL and returning values of whatever type you like&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;inferencing: the generation of new triples based on other data (in the case of the tutorial, the generation of ISO 8601 yyyy-mm-dd format invoiceDate values from "mm/dd/yy" date values stored in the original data)&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;constructors: the automatic generation of a postingDate value when a new MaterialsPurchase or ServiceContract instance is created&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;constraints: setting up the system to alert the user to unpaid materials purchases that are more than 90 days old or unpaid service contracts that are more than 60 days old. Instead of using a lot of redundant code to achieve these two different but similar goals, the tutorial shows how to define a reusable template with a SPARQL query and pass parameters to it (in this case, the numbers 60 or 90) when using the template.&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;I hope the tutorial demonstrates the potential connections between SPIN technology and real-world business issues to its readers, as well as the ease of implementing it all with TopBraid Composer. &lt;/p&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7507012841435012041-1282953448495735675?l=topquadrantblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://topquadrantblog.blogspot.com/feeds/1282953448495735675/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7507012841435012041&amp;postID=1282953448495735675' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default/1282953448495735675'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default/1282953448495735675'/><link rel='alternate' type='text/html' href='http://topquadrantblog.blogspot.com/2009/10/spin-tutorial-available.html' title='SPIN Tutorial Available'/><author><name>Bob DuCharme</name><uri>http://www.blogger.com/profile/02742075186312518829</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_13zlUS8aD_8/S0OhTCeBZ8I/AAAAAAAAAAM/cGInR6wDS84/S220/128x128.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7507012841435012041.post-4302277272917867238</id><published>2009-09-07T16:51:00.000-07:00</published><updated>2009-09-07T17:06:27.526-07:00</updated><title type='text'>Creating and Managing Metadata about RDF statements</title><content type='html'>Metadata about RDF statements can be quite useful and even required for a number of purposes. For example, let’s consider questions one may have about a statement “Washington, DC is a capital of the United States”:&lt;/p&gt;  &lt;ul style="font-family: arial;font-family:arial;" &gt;&lt;li&gt;&lt;!--[if !supportLists]--&gt;&lt;span style="font-size:85%;"&gt;What is the provenance of this statement – who said this, when did they say this?&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;!--[if !supportLists]--&gt;&lt;span style="font-size:85%;"&gt;What is the temporal scope of this statement – when did DC became a capital of the US, is it still the capital?&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;!--[if !supportLists]--&gt;&lt;span style="font-size:85%;"&gt;What is the access control for this statement – who can see it, who can change it?&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;      &lt;p style="font-family: arial;" class="MsoNormal"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style="font-family: arial;" class="MsoNormal"&gt;Interest in this topic is evidenced by Paul Hermans' blog summarizing recent discussions on approaches to implementing such metadata &lt;a href="http://www.proxml.be/users/paul/weblog/9d47d/A_must_read__Temporal_Scope_for_RDF_Triples.html"&gt;http://www.proxml.be/users/paul/weblog/9d47d/A_must_read__Temporal_Scope_for_RDF_Triples.html&lt;/a&gt;. &lt;/p&gt;  &lt;p style="font-family: arial;" class="MsoNormal"&gt;We often get asked what is TopQuadrant’s recommended approach to supporting statements about statement – for versioning, for governance, etc? TopBraid Suite is fully flexible in this respect and can be used to implement any number of approaches. However, in our work, we found an approach based on RDF reification to be particularly useful.&lt;/p&gt;  &lt;p style="font-family: arial;" class="MsoNormal"&gt;TopBraid Composer provides a Change History view where one can see every added and deleted triples. The view is based on a small ontology called &lt;span style="font-weight: bold; font-style: italic;"&gt;change.owl&lt;/span&gt; and available as part of TopBraid library,  It contains a class Change &lt;span style="font-size:100%;"&gt;&lt;span style="font-family: arial;"&gt;and a handful of properties – added, deleted, graph and timestamp. The class Change is described as follows:&lt;/span&gt;&lt;/span&gt; &lt;span style="font-size:100%;"&gt;“&lt;/span&gt;&lt;span style="line-height: 115%; font-family: arial;font-size:100%;" &gt;A change to an RDF Graph, encapsulating lists of added and/or deleted rdf:Statements. Additional metadata such as a timeStamp (or author or whatever) can be added”, &lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-family: arial;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="font-family: arial;" class="MsoNormal"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_hkOG6HtFjts/SqWdIkH6F2I/AAAAAAAAABA/CO8d7vg5NzA/s1600-h/change.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 320px; height: 274px;" src="http://4.bp.blogspot.com/_hkOG6HtFjts/SqWdIkH6F2I/AAAAAAAAABA/CO8d7vg5NzA/s320/change.jpg" alt="" id="BLOGGER_PHOTO_ID_5378878100425283426" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p style="font-family: arial;" class="MsoNormal"&gt;We often extend this model for particular applications to add the metadata required by the app, for example, author or scope. TopBraid Composer inserts change statements automatically. Every time there is a triple is added or deleted, there is a new change statement. In web applications deployed under TopBraid Live, we use a SPARQLMotion scripts that start with sml:TrackChanges module. &lt;/p&gt;  &lt;p style="font-family: arial;" class="MsoNormal"&gt;Sml:TrackChanges is used to implement services that shall be executed as a side effect of a change to an RDF model. In TopBraid, any script containing an instance of this module will be executed as part of each change. The output of this module is using the &lt;a href="http://topbraid.org/change"&gt;http://topbraid.org/change&lt;/a&gt; ontology, with triples describing the changes that have happened. &lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;" &gt;&lt;span style="font-family:arial;"&gt;In other words, TopBraid listens for the changes and, when a change happens, it will trigger execution of  a script(s) containing TrackChanges module. One can provide a filter to specify what type of changes a script should react to. And, as with any SPARQLMotion script, what happens when the script is triggered is up to the script designer. For example, in the Enterprise Vocabulary Management solution we use this approach to stamp every change with the author id and a timestamp and also to trigger the governance processes – send e-mails about the changes to the appropriate parties, promote approved changes, etc.&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7507012841435012041-4302277272917867238?l=topquadrantblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://topquadrantblog.blogspot.com/feeds/4302277272917867238/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7507012841435012041&amp;postID=4302277272917867238' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default/4302277272917867238'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default/4302277272917867238'/><link rel='alternate' type='text/html' href='http://topquadrantblog.blogspot.com/2009/09/creating-and-managing-metadata-about.html' title='Creating and Managing Metadata about RDF statements'/><author><name>Irene Polikoff</name><uri>http://www.blogger.com/profile/17834271916697741738</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_hkOG6HtFjts/SqWdIkH6F2I/AAAAAAAAABA/CO8d7vg5NzA/s72-c/change.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7507012841435012041.post-812811511223690226</id><published>2009-07-25T14:17:00.000-07:00</published><updated>2009-07-25T20:55:44.784-07:00</updated><title type='text'>Linked Data and what it really takes to create it</title><content type='html'>&lt;span style="font-family: arial;font-family:arial;" &gt;Recently there has been a number of popular discussions (some heated) on whether RDF is necessary for the Linked Data.&lt;/span&gt;&lt;span style="font-family: arial;font-family:arial;" &gt;  &lt;/span&gt;&lt;span style="font-family: arial;font-family:arial;" &gt;For example:&lt;/span&gt;&lt;p style="font-family: arial;"&gt;&lt;/p&gt;  &lt;p style="font-family: arial;" class="MsoNormal"&gt;&lt;o:p&gt;&lt;a href="http://cloudofdata.com/2009/07/does-linked-data-need-rdf/"&gt;http://cloudofdata.com/2009/07/does-linked-data-need-rdf/&lt;/a&gt;&lt;br /&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="font-family: arial;"&gt;&lt;a href="http://www.semanticsincorporated.com/2009/07/if-linked-data-is-a-brand-it-has-big-problems-to-address.html"&gt;http://www.semanticsincorporated.com/2009/07/if-linked-data-is-a-brand-it-has-big-problems-to-address.html&lt;/a&gt;&lt;/p&gt;  &lt;p style="font-family: arial;" class="MsoNormal"&gt;I believe that for the Linked Data to happen, we need a standard for representing semantic information. URIs are just an addressing scheme and do not carry any semantics. &lt;/p&gt;  &lt;p style="font-family: arial;" class="MsoNormal" face="arial"&gt;Once one moves beyond the high level marketing statements and starts to consider specific technical details of how the data linking could work, it quickly becomes apparent that, at minimum, RDF (or something very much like RDF) is required.  This is often lost on bloggers without a sufficiently deep grasp of the underlying technologies and results in somewhat unfocused and meandering discussions. Questions on how exactly URIs alone can bring the data together are kept unanswered and glossed over in a rhetoric of high level statements.&lt;br /&gt;&lt;/p&gt;    &lt;p style="font-family: arial;" class="MsoPlainText"&gt;Unfortunately, this makes it hard to conduct substantive discussions. Perhaps, this is why I found the recent post on &lt;a href="http://www.betaversion.org/%7Estefano/linotype/news/304/"&gt;Data Reconciliation Strategies and Their Impact on the Web of Data&lt;/a&gt; more insightful and useful than discussions above. It makes a number of valid points  and raises important questions. Having said this, I disagree with author's conclusion:&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p style="font-family: arial;" class="MsoPlainText"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;&lt;blockquote style="font-family: arial;"&gt;  &lt;p style="text-align: left;" class="MsoPlainText"&gt;"I cannot help but think that any effort tasked to promote and increase such density will look and feel just like Freebase: carefully selecting datasets and painfully trying to reconcile as much data as possible right when it enters the system and entice a community of volunteers to maintain it, curate it and clean up eventual mistakes."&lt;/p&gt;&lt;/blockquote&gt;&lt;p style="font-style: italic; font-family: arial; text-align: center;" class="MsoPlainText"&gt;&lt;/p&gt;  &lt;p style="font-family: arial;" class="MsoPlainText"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p style="font-family: arial;" class="MsoPlainText"&gt;There are the following "connectivity" problems in the query proposed by the author - “the height of all towers located in Paris”:&lt;/p&gt;  &lt;p style="font-family: arial;" class="MsoPlainText"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p style="font-family: arial;" class="MsoPlainText"&gt;1. Identity of a tower&lt;/p&gt;  &lt;p style="font-family: arial;" class="MsoPlainText"&gt;2. Identity of predicate height&lt;/p&gt;  &lt;p style="font-family: arial;" class="MsoPlainText"&gt;3. Identity of Paris&lt;/p&gt;  &lt;p style="font-family: arial;" class="MsoPlainText"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p style="font-family: arial;" class="MsoPlainText"&gt;I believe it is important to encourage people to provide mappings from their vocabulary/schema to some established vocabularies. These will (and are) appear over time. Foaf:Person is a good example. Now, you do not have to and may not be able to use it directly in your data, but as you expose your data to the Linked Data Cloud (LOD) it would be a good practice to provide such mappings. Otherwise, someone else will have to do it.&lt;/p&gt;  &lt;p style="font-family: arial;" class="MsoPlainText"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p style="font-family: arial;" class="MsoPlainText"&gt;This is where &lt;a href="http://dbpedia.org/About"&gt;dbpedia&lt;/a&gt; becomes very useful. It has a URI for height. NASA/TopQuadrant units ontology (to be shortly released here &lt;a href="http://www.oegov.org/"&gt;http://www.oegov.org/&lt;/a&gt;) has that as well. We linked units of measure, quantities and dimensions to dbpedia. If a broader community finds this work useful, it may be that over time this ontology becomes the de-facto standard and people will link to it. But even today there is a possibility to connect between it and other relevant ontologies/datasets - through dbpedia.&lt;/p&gt;  &lt;p style="font-family: arial;" class="MsoPlainText"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p style="font-family: arial;" class="MsoPlainText"&gt;The same premise applies to Paris. There are some authoritative sources that have emerged - the geonames and, again, dbpedia. If they both cross reference each other, then linking to either one should do the trick.&lt;/p&gt;  &lt;p style="font-family: arial;" class="MsoPlainText"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p style="font-family: arial;" class="MsoPlainText"&gt;Tower is a trickier problem because it is a type and can be identified in a number of ways - may be you have a table (class) Tower. May be you have a column (predicate) indicating the type. May be you have a table of controlled values for building types and there is a link to the appropriate resource (this will be the case, if something is more than one type - let's say both, a tower and a lighthouse). A similar issue may apply to the height if you reify it to provide a unit of measure, for example, or a measurement date.&lt;/p&gt;  &lt;p style="font-family: arial;" class="MsoPlainText"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p style="font-family: arial;" class="MsoPlainText"&gt;Some mechanisms are needed to describe less simplistic mappings. In our work SPARQL-based &lt;a href="http://www.spinrdf.org/"&gt;SPIN rules&lt;/a&gt; have proven to be an effective standard-based solution for more complex mappings. Overall, I believe there are only a handful of patterns that will constitute 80% of the cases. A good number of these are described above.&lt;/p&gt;  &lt;p style="font-family: arial;" class="MsoPlainText"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p style="font-family: arial;" class="MsoPlainText"&gt;The key benefit of using such an approach is that people can start with their own vocabularies and then, at some later stage, add the links to dbpedia. Or they don't, and someone else does it. This freedom is lost if a system (such as Freebase) forces users to do the mapping up front. With the units ontology it was quite easy to add the mappings, and likewise it will be for most other existing data models.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7507012841435012041-812811511223690226?l=topquadrantblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://topquadrantblog.blogspot.com/feeds/812811511223690226/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7507012841435012041&amp;postID=812811511223690226' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default/812811511223690226'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default/812811511223690226'/><link rel='alternate' type='text/html' href='http://topquadrantblog.blogspot.com/2009/07/linked-data-and-what-it-really-takes-to.html' title='Linked Data and what it really takes to create it'/><author><name>Irene Polikoff</name><uri>http://www.blogger.com/profile/17834271916697741738</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7507012841435012041.post-3697132677593970233</id><published>2009-07-09T19:05:00.001-07:00</published><updated>2009-07-24T10:03:06.637-07:00</updated><title type='text'>Data Transformation using Semantic Web Standards</title><content type='html'>I have created the presentation below in response to a recent discussion about converting XML to RDF.&lt;br /&gt;&lt;br /&gt;A person I was talking to assumed that there was a mapping process one needed to go through before a translation of XML (or relational databases, spreadsheets, etc.) into RDF could take place.&lt;br /&gt;&lt;br /&gt;Indeed mapping often happens, but it happens &lt;span style="font-style: italic; font-weight: bold;"&gt;after&lt;/span&gt; translation. First the non RDF information is represented in RDF. Any mappings that are created are also captured in RDF/OWL - either by using constructs such as rdfs:subClassOf and owl:sameAs or, for more complex mappings, by using SPIN (SPARQL rules).&lt;br /&gt;&lt;br /&gt;I am always surprised how often people find this approach novel and need time to understand what is going on. I guess this is because RDF is so flexible - it is quite easy to represent any data structures in RDF.  And because both, data and models are represented in RDF, once imported, structural transformations are very straightforward. RDF is built for change. Other data models do not have this advantage. Hence, they require mappings before importing external data.&lt;br /&gt;&lt;br /&gt;The presentation below explains in detail how RDF import and transformations are done including a step by step example. The benefits of the approach are also discussed.&lt;br /&gt;&lt;div style="width: 425px; text-align: left;" id="__ss_1702851"&gt;&lt;a style="margin: 12px 0pt 3px; font-family: Helvetica,Arial,Sans-serif; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: normal; font-size-adjust: none; font-stretch: normal; display: block; text-decoration: underline;" href="http://www.slideshare.net/irenetq/data-transformation-using-semantic-web-standards" title="Data Transformation using Semantic Web Standards"&gt;Data Transformation using Semantic Web Standards&lt;/a&gt;&lt;object style="margin: 0px;" width="425" height="355"&gt;&lt;param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=importandtransformationwithtopbraidsuite-090709171434-phpapp01&amp;amp;stripped_title=data-transformation-using-semantic-web-standards"&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;param name="allowScriptAccess" value="always"&gt;&lt;embed src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=importandtransformationwithtopbraidsuite-090709171434-phpapp01&amp;amp;stripped_title=data-transformation-using-semantic-web-standards" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;div style="font-size: 11px; font-family: tahoma,arial; height: 26px; padding-top: 2px;"&gt;View more &lt;a style="text-decoration: underline;" href="http://www.slideshare.net/"&gt;presentations&lt;/a&gt; from &lt;a style="text-decoration: underline;" href="http://www.slideshare.net/irenetq"&gt;irenetq&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/7507012841435012041-3697132677593970233?l=topquadrantblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://topquadrantblog.blogspot.com/feeds/3697132677593970233/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7507012841435012041&amp;postID=3697132677593970233' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default/3697132677593970233'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default/3697132677593970233'/><link rel='alternate' type='text/html' href='http://topquadrantblog.blogspot.com/2009/07/data-transformation-using-semantic-web.html' title='Data Transformation using Semantic Web Standards'/><author><name>Irene Polikoff</name><uri>http://www.blogger.com/profile/17834271916697741738</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7507012841435012041.post-5157360807298164730</id><published>2009-07-06T14:08:00.000-07:00</published><updated>2009-07-08T19:55:44.224-07:00</updated><title type='text'>Presentations from the Second TopBraid User Group Meeting - SemTech2009</title><content type='html'>&lt;a href="http://3.bp.blogspot.com/_VhB2_00snTs/SlT8BEzouGI/AAAAAAAAABI/2hm_ODPtbDo/s1600-h/129.JPG"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 200px; height: 152px;" src="http://3.bp.blogspot.com/_VhB2_00snTs/SlT8BEzouGI/AAAAAAAAABI/2hm_ODPtbDo/s200/129.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5356182952250751074" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/_VhB2_00snTs/SlUHAGBwNgI/AAAAAAAAABo/ZaYgsQ6Nfgk/s1600-h/135.JPG"&gt;&lt;img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 243px; height: 320px;" src="http://4.bp.blogspot.com/_VhB2_00snTs/SlUHAGBwNgI/AAAAAAAAABo/ZaYgsQ6Nfgk/s320/135.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5356195030026434050" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/_VhB2_00snTs/SlT2Lo1LojI/AAAAAAAAAA4/cpOpCg1FPgg/s1600-h/128.JPG"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 320px; height: 243px;" src="http://4.bp.blogspot.com/_VhB2_00snTs/SlT2Lo1LojI/AAAAAAAAAA4/cpOpCg1FPgg/s320/128.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5356176536649835058" /&gt;&lt;/a&gt;&lt;br /&gt;The Second TopBraid Suite Open User Group Meeting was conducted at the Semantic Technology Conference 2009 in San Jose, CA, Thursday, June 18, 2009, 09:45 AM - 12:45 PM.  The Agenda for the meeting and links to the presentations used by the speakers is given below.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;User Group Meeting Agenda and Presentations&lt;/strong&gt;&lt;br /&gt;•9:45am - 9:55am &lt;br /&gt;Welcome (Robert Coyne, TopQuadrant) &lt;br /&gt;&lt;br /&gt;•9:55am - 10:30am&lt;br /&gt;Keynote User Talk 1:&lt;br /&gt;&lt;strong&gt;"Using SPARQLMotion to Execute Task Networks among Distributed Cyber Physical Systems"&lt;/strong&gt;, &lt;br /&gt;Cyber-physical systems define networks of interactive sensors and actuators, grounded in the physical world. Such systems require a high degree of interoperation to achieve the system's objective. SPARQLMotion, a model-driven scripting language, has been used to achieve that level of interoperation. In addition, this approach results in greater operational redundancy among networks through distributed control. Three recent extensions to SPARQLMotion will be shared along with a motivating example for their use.&lt;br /&gt;&lt;em&gt;John T. Carson, Software Engineer, Lockheed Martin Aeronautics&lt;/em&gt;&lt;br /&gt;&lt;a href="http://www.topquadrant.com/docs/second_UGM_pres/JohnCarsonSemTech.ppt"&gt;(slides)&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;•10:30am - 11:00am &lt;br /&gt;TopBraid - New Capabilities - Sampler 1&lt;br /&gt;&lt;strong&gt;Presentation/demo of key aspects of TopQuadrant's Enterprise Vocabulary Management (EVM) Solution Package (just announced.&lt;/strong&gt;  Customers across a range of industries are building EVM solutions on top of the TopBraid Suite platform.  In response to customer requirements, TopQuadrant is offering an EVM Solution Package of commonly needed, high-value components including models, scripts (e.g. for workflow management with approvals), and application configuration templates. &lt;br /&gt;&lt;em&gt;Irene Polikoff, CEO and Co-founder, TopQuadrant, Inc.&lt;/em&gt; &lt;br /&gt;&lt;a href="http://www.topquadrant.com/docs/second_UGM_pres/TBS_EVM.ppt"&gt;(slides)&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;•11:00am - 11:35am&lt;br /&gt;Keynote User Talk 2:&lt;br /&gt;"Managing Your Online Social Graph with TopBraid Composer" &lt;br /&gt;In this short user experience session Marco will show you how he makes use of TopBraid Composer to keep track of the Semantic Web Meetup community (http://www.swnyc.org) and how he manages events, rsvps and security. In addition we will take a look at some of the editing and reporting features readily available and build into TopBraid Composer to visualize community data for evaluation and the identification of trends.&lt;br /&gt;&lt;em&gt;Marco Neumann, Information Scientist and CEO &amp; Founder, KONA&lt;/em&gt;&lt;br /&gt;&lt;a href="http://www.topquadrant.com/docs/second_UGM_pres/tbc_KONA.pdf"&gt;(slides)&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;•11:35am - 12:05pm&lt;br /&gt;TopBraid - New Capabilities - Sampler 2 &lt;br /&gt;For QA of ontologies, many users have interest in knowing key statistics or metrics regarding their models, such as the number of properties that reference each class.  A simple, flexible, convenient to use solution will be demonstrated within TopBraid.   By importing a special ontology, and running provided scripts, desired metrics fields get populated, and a reporting script is used to pretty-print the results to html.&lt;br /&gt;&lt;em&gt;Ralph Hodgson, CTO and Co-founder, TopQuadrant, Inc. &lt;/em&gt;&lt;br /&gt;&lt;a href="http://www.topquadrant.com/docs/second_UGM_pres/TQ_TBS_Metrics.ppt"&gt;(slides)&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;•12:05pm - 12:40pm &lt;br /&gt;User Feedback Session (conducted through lunch),&lt;br /&gt;moderated by Tom Fitzgerald, Director of Sales, TopQuadrant&lt;br /&gt;Notes from the session:&lt;br /&gt;1. Education –tremendous demand for online training materials.  Customers recommend we provide more training material (tutorials, videos, examples). Training is a key to success for many TopBraid customers.&lt;br /&gt;2. Help Menu – context search and more examples –need a “Getting Started” tutorial.  The tutorial would include how to use the Help Menu effectively.&lt;br /&gt;3. User’s Forum – “great asset” – would like to see it expanded to include wiki format and possibly all of our products.  Discsussion of how the forum can be expanded and provide more extensive support, e.g., examples of customer applications.&lt;br /&gt;4. Site Spin – Tim Smith – new capability&lt;br /&gt;5. Mind Mapping integration – Tim Smith talked about the value of providing a easy tool for business users to map out model requirements.  The mapping could then be integrated into TBC.&lt;br /&gt;6. Customer Use Cases – request to expand website to include tab for Use Cases and customer scroll&lt;br /&gt;&lt;br /&gt;TopQuadrant appreciated and valued this input and is responding quickly, in particular by making the extensive Help provided in TopBraid Composer more accessible, and in providing more support assets through our web site.  See links on the &lt;a href="http://www.topquadrant.com/products/TB_Composer.html"&gt;TopBraid Composer&lt;/a&gt; page, &lt;a href="http://www.topquadrant.com/products/support.html"&gt;Support&lt;/a&gt; and other product pages, and this &lt;a href="http://topquadrantblog.blogspot.com/2009/06/reflections-on-user-feedback-panel-or.html"&gt;recent post.&lt;/a&gt; for further details and links.  Additionally, two new slide sets are being provided for download the give an &lt;a href="http://www.topquadrant.com/resources/TBC_3.0_Tour2.pdf"&gt;extensive tour of TopBraid Composer capabilities&lt;/a&gt;, and in depth details on &lt;a href=" http://www.topquadrant.com/resources/Import_and_Transformation_with_TBS.pdf"&gt;importing data into RDF and transforming data&lt;/a&gt; with TopBraid utilities and power tools.&lt;br /&gt;&lt;br /&gt;•12:40pm - 12:45pm &lt;br /&gt;Announcements and Closing Remarks &lt;br /&gt;Robert Coyne, TopQuadrant&lt;br /&gt;&lt;br /&gt;(See also &lt;a href="http://www.topquadrant.com/resources/UGM.html"&gt;Reflections from the First TopBraid Suite User Group Meeting&lt;/a&gt;, May 21, 2008,San Jose, CA)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7507012841435012041-5157360807298164730?l=topquadrantblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://topquadrantblog.blogspot.com/feeds/5157360807298164730/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7507012841435012041&amp;postID=5157360807298164730' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default/5157360807298164730'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default/5157360807298164730'/><link rel='alternate' type='text/html' href='http://topquadrantblog.blogspot.com/2009/07/presentations-from-second-topbraid-user.html' title='Presentations from the Second TopBraid User Group Meeting - SemTech2009'/><author><name>Robert Coyne</name><uri>http://www.blogger.com/profile/02357795891397805420</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_VhB2_00snTs/SlT8BEzouGI/AAAAAAAAABI/2hm_ODPtbDo/s72-c/129.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7507012841435012041.post-7672801675343635802</id><published>2009-07-04T11:18:00.001-07:00</published><updated>2009-07-04T11:25:31.381-07:00</updated><title type='text'>The Meaning of "semantic" - post II</title><content type='html'>&lt;span style="font-family:arial;"&gt;After writing &lt;a href="http://topquadrantblog.blogspot.com/2009/06/meaning-of-semantic.html"&gt;this earlier post&lt;/a&gt;, I've decided to expand on my thoughts about the intersection between the Semantic Web and text mining, natural language processing, etc.&lt;br /&gt;&lt;br /&gt;The write up was ready just in time for TopQuadrant's submission to the monthly Semantic Universe column, so I've ended up publishing it there, but here is a link  &lt;a href="http://www.semanticuniverse.com/articles-using-semantic-web-standards-improved-text-mining.html"&gt;http://www.semanticuniverse.com/articles-using-semantic-web-standards-improved-text-mining.html&lt;/a&gt;.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7507012841435012041-7672801675343635802?l=topquadrantblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://topquadrantblog.blogspot.com/feeds/7672801675343635802/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7507012841435012041&amp;postID=7672801675343635802' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default/7672801675343635802'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default/7672801675343635802'/><link rel='alternate' type='text/html' href='http://topquadrantblog.blogspot.com/2009/07/meaning-of-semantic-post-ii.html' title='The Meaning of &quot;semantic&quot; - post II'/><author><name>Irene Polikoff</name><uri>http://www.blogger.com/profile/17834271916697741738</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7507012841435012041.post-5085725367454007100</id><published>2009-07-04T10:07:00.000-07:00</published><updated>2009-07-19T12:21:11.689-07:00</updated><title type='text'>RDFa - a good way to provide access to your data?</title><content type='html'>&lt;span style="font-family:arial;"&gt;I have been thinking about RDFa recently. With the &lt;/span&gt;&lt;a style="font-family: arial;" href="http://rdfa.info/2009/05/12/google-announces-support-for-rdfa/"&gt;announcement from Google&lt;/a&gt;&lt;span style="font-family:arial;"&gt; and continued support from &lt;/span&gt;&lt;a style="font-family: arial;" href="http://developer.yahoo.com/searchmonkey/"&gt;Yahoo/Search Monkey&lt;/a&gt;&lt;span style="font-family:arial;"&gt; there is an increased buzz around RDFa. So, why RDFa and what is it good for?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;TopBraid have had support for RDFa as long as I can remember – at least two years now. A user can point to a page with RDFa markups and TopBraid will import them. I remember getting existed about this and wanting to mark up all our web pages with RDF. This did not happen. At least partially because RDFa’s interaction with HTML formatting tags is pretty funky – the pages become harder to maintain. Then, there was also a persistent question on why do it at all. If one wants to provide data in RDF, why not do exactly that? &lt;/span&gt;&lt;p style="font-family: arial;"&gt;&lt;/p&gt;  &lt;p  style="color: rgb(0, 0, 0);font-family:arial;" class="MsoNormal"&gt;&lt;span style=";font-family:arial;font-size:100%;"  &gt;Each web page on a site, could have a corresponding N3 page. There is a standard tag in HTML that can be used to refer to related information. It can be used to point to the N3 page and/or the naming convention could be the same as for the given HTML page, but with the N3 extension. In TopQuadran’t case this would be an only alternative solution since the information on our web site is not in a database (at least not yet, this is changing). If it was in a database, then a way to go would be to provide a SPARQL endpoint.&lt;br /&gt;I looked at the RDFa presentation by Mark Birbeck at the Semantic Technologies conference. I did not get a chance to attend – 7:30 AM is way too early for me , but I browsed through slides. Here is an example of RDFa markup (from the presentation):&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p style="color: rgb(0, 0, 0);" class="MsoNormal"&gt;&lt;span style="font-size:100%;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_hkOG6HtFjts/Sk-ZFK6TwuI/AAAAAAAAAA0/7mEkD6LsbSI/s1600-h/rdfa.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 409px; height: 171px;" src="http://1.bp.blogspot.com/_hkOG6HtFjts/Sk-ZFK6TwuI/AAAAAAAAAA0/7mEkD6LsbSI/s320/rdfa.jpg" alt="" id="BLOGGER_PHOTO_ID_5354666796074124002" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="color: rgb(0, 0, 0);" class="MsoNormal"&gt;&lt;span style=";font-family:arial;font-size:100%;"  &gt;This says that there is a dc:creator rel&lt;/span&gt;&lt;span style=";font-family:arial;font-size:100%;"  &gt;ations&lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-family:arial;"&gt;hip between the header “RDFa: Now everyone can have an API” and a string “Mark Birbeck”. &lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p  style="color: rgb(0, 0, 0);font-family:arial;" class="MsoNormal"&gt;&lt;span style="font-size:100%;"&gt;Good, but we have not given a URI to the thing we are talking about – a presentation entitled “RDFa: Now everyone can have &lt;/span&gt;&lt;span style="font-size:100%;"&gt;an API”.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p  style="color: rgb(0, 0, 0);font-family:arial;" class="MsoNormal"&gt;&lt;span style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p  style="color: rgb(0, 0, 0);font-family:arial;" class="MsoNormal"&gt;&lt;span style="font-size:100%;"&gt;Absence of the URI makes it somewhat hard to talk about the presentation. Any RDFa crawler/importer would have to generate some kind of URI for it. If we used the URI to begin with, we could have simply put the triple {:RDFa_presentation &lt;/span&gt;&lt;span style="font-size:100%;"&gt; &lt;/span&gt;&lt;span style="font-size:100%;"&gt;dc:creator &lt;/span&gt;&lt;span style="font-size:100%;"&gt; &lt;/span&gt;&lt;span style="font-size:100%;"&gt;“Mark Birbeck” } into an RDF file.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p  style="color: rgb(0, 0, 0);font-family:arial;" class="MsoNormal"&gt;&lt;span style="font-size:100%;"&gt;One issue may be the maintenance – having 2 files to maintain. But, embedding RDFa into HTML arguably creates even worse maintenance problems. And, if RDFa markup was automatically generated (most serious publishing happens by generation, not hand crafting), then the maintenance issue is not there – it is easier to generate RDF file in addition to HTML file that it is to generate and insert markups. Not to mention that automatic generation means there is a database that could be exposed through SPARQL.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p  style="color: rgb(0, 0, 0);font-family:arial;" class="MsoNormal"&gt;&lt;span style="font-size:100%;"&gt;There must be something I am missing here. While I could not attend Mark Birbeck’s presentation, I just discovered he is giving a webinar on July 12&lt;sup&gt;th&lt;/sup&gt;: &lt;a href="http://skillsmatter.com/event/ajax-ria/the-possibilities-of-rdfa-and-the-semantic-web/ng-94"&gt;http://skillsmatter.com/event/ajax-ria/the-possibilities-of-rdfa-and-the-semantic-web/ng-94&lt;/a&gt; . I think I will sign up and see if some of my questions get answered.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="color: rgb(31, 73, 125);"&gt;&lt;span style="color: rgb(0, 0, 0);font-family:arial;font-size:100%;"  &gt;I’ll report what I learn here, so stay tuned.&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7507012841435012041-5085725367454007100?l=topquadrantblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://topquadrantblog.blogspot.com/feeds/5085725367454007100/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7507012841435012041&amp;postID=5085725367454007100' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default/5085725367454007100'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default/5085725367454007100'/><link rel='alternate' type='text/html' href='http://topquadrantblog.blogspot.com/2009/07/rdfa-good-way-to-provide-access-to-your.html' title='RDFa - a good way to provide access to your data?'/><author><name>Irene Polikoff</name><uri>http://www.blogger.com/profile/17834271916697741738</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_hkOG6HtFjts/Sk-ZFK6TwuI/AAAAAAAAAA0/7mEkD6LsbSI/s72-c/rdfa.jpg' height='72' width='72'/><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7507012841435012041.post-2490467092142835043</id><published>2009-06-24T18:19:00.000-07:00</published><updated>2009-06-24T19:03:03.167-07:00</updated><title type='text'>Reflections on the User Feedback Panel or More Help, please ...</title><content type='html'>One striking difference between user input this year compared to the last, is that this year we received considerably smaller number of new functionality requests. It seems that our users are still digesting all the new features that came out in 3.0 and in the ramp up to 3.0 - &lt;a href="http://www.topquadrant.com/products/SPARQLMotion.html"&gt;SPARQLMotion&lt;/a&gt;, &lt;a href="http://www.topquadrant.com/products/SPIN.html"&gt;SPIN&lt;/a&gt;, the new &lt;a href="http://www.topquadrant.com/products/TB_Ensemble.html"&gt;TopBraid Ensemble&lt;/a&gt; with the end-user composable web applications, etc.&lt;br /&gt;&lt;br /&gt;User feedback is very important to us as a key input to the product development plans. Of course, many requirements come on a regular basis through the &lt;a href="http://groups.google.com/group/topbraid-composer-users"&gt;web user forum&lt;/a&gt;, but in-person interaction adds different dimensions. It is immediately clear if a requirement voiced by one user is shared by the rest. You can also quickly explore requirements in more depth. For example, at the last year User Group meeting, we received repeated requests for the support of version control and governance. It took some time to fully understand the requirements and design the solution to address them, but after close interactions with several users, version control is now available as part of the new Enterprise Vocabulary Management solution.&lt;br /&gt;&lt;br /&gt;This year most of the requests were for better documentation and educational resources - a SPIN tutorial, more videos, example applications for TBE, etc. It seems that the richer the product suite becomes, the more we need to work on providing resources explaining how to use it.&lt;br /&gt;&lt;br /&gt;TopBraid Composer already has a pretty good help facility. However, we've learned that not all its features are well understood by the users. After returning from the conference we have created a new page dedicated to Help &lt;a href="http://www.topquadrant.com/products/ComposerHelp.html"&gt;http://www.topquadrant.com/products/ComposerHelp.html&lt;/a&gt;. It is accessible from a number of places including the download page.&lt;br /&gt;&lt;br /&gt;Other requests already in the works include a Powerpoint tour of TBC features, example TBE application for download with, probably, a video explaining how it was developed and, yes, a SPIN tutorial (once I get a chance). Help is being updated as well, in preparation for the 3.1 release.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7507012841435012041-2490467092142835043?l=topquadrantblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://topquadrantblog.blogspot.com/feeds/2490467092142835043/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7507012841435012041&amp;postID=2490467092142835043' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default/2490467092142835043'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default/2490467092142835043'/><link rel='alternate' type='text/html' href='http://topquadrantblog.blogspot.com/2009/06/reflections-on-user-feedback-panel-or.html' title='Reflections on the User Feedback Panel or More Help, please ...'/><author><name>Irene Polikoff</name><uri>http://www.blogger.com/profile/17834271916697741738</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7507012841435012041.post-3509074526631414996</id><published>2009-06-18T22:15:00.000-07:00</published><updated>2009-06-18T22:48:16.220-07:00</updated><title type='text'>TopBraid User Group Meeting at SemTech2009</title><content type='html'>&lt;a href="http://4.bp.blogspot.com/_VhB2_00snTs/SjsmdvFIJFI/AAAAAAAAAAU/5V9Fa3OuyHI/s1600-h/140.JPG"&gt;&lt;img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 320px; height: 243px;" src="http://4.bp.blogspot.com/_VhB2_00snTs/SjsmdvFIJFI/AAAAAAAAAAU/5V9Fa3OuyHI/s320/140.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5348911274728629330" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/_VhB2_00snTs/SjslZpCdUbI/AAAAAAAAAAM/2Gsj6BO7kt4/s1600-h/123.JPG"&gt;&lt;img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 320px; height: 243px;" src="http://1.bp.blogspot.com/_VhB2_00snTs/SjslZpCdUbI/AAAAAAAAAAM/2Gsj6BO7kt4/s320/123.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5348910104875717042" /&gt;&lt;/a&gt;&lt;br /&gt;TopQuadrant conducted its second TopBraid Open User Group Meeting at the Semantic Technology Conference 2009, on Thurs., June 18, San Jose, CA.  &lt;br /&gt;&lt;br /&gt;Topics presented and discussed included:&lt;br /&gt;&lt;br /&gt;• User Talk 1: Using SPARQLMotion to Execute Task Networks among Distributed Cyber Physical Systems&lt;br /&gt;&lt;br /&gt;• TopBraid - New Capabilities Sampler 1: Key aspects of TopQuadrant's Enterprise Vocabulary Management (EVMS) Solution package (just announced)&lt;br /&gt;&lt;br /&gt;• User Talk 2: Managing Your Online Social Graph with TopBraid Composer &lt;br /&gt;&lt;br /&gt;• TopBraid - New Capabilities - Sampler 2: Ontology Metrics &amp; Report Generation for Quality Assurance of Knowledge Models&lt;br /&gt;&lt;br /&gt;• User Feedback Session &lt;br /&gt;&lt;br /&gt;More details to follow!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7507012841435012041-3509074526631414996?l=topquadrantblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://topquadrantblog.blogspot.com/feeds/3509074526631414996/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7507012841435012041&amp;postID=3509074526631414996' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default/3509074526631414996'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default/3509074526631414996'/><link rel='alternate' type='text/html' href='http://topquadrantblog.blogspot.com/2009/06/topbraid-user-group-meeting-at.html' title='TopBraid User Group Meeting at SemTech2009'/><author><name>Robert Coyne</name><uri>http://www.blogger.com/profile/02357795891397805420</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_VhB2_00snTs/SjsmdvFIJFI/AAAAAAAAAAU/5V9Fa3OuyHI/s72-c/140.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7507012841435012041.post-27874061428277944</id><published>2009-06-18T11:27:00.000-07:00</published><updated>2009-06-18T15:53:05.004-07:00</updated><title type='text'>The Meaning of "semantic"</title><content type='html'>Going through the exhibit hall of the &lt;a href="http://www.semantic-conference.com/"&gt;Semantic Technologies&lt;/a&gt; conference one quickly notices that there are two types of vendors:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Providers of the middleware and tools that leverage Semantic Web standards (RDF, RDFS, OWL and SPARQL) to support a variety of business applications.This is an area where &lt;a href="http://www.topquadrant.com/"&gt;TopQuadrant&lt;/a&gt; plays.&lt;/li&gt;&lt;li&gt;Providers of the search and text mining products.&lt;/li&gt;&lt;/ol&gt;The word "semantic" is used when talking about both types of products. The reason for this is quite clear. Before W3C coined the term "Semantic Web", the word "semantics" was used to describe "smart software" capable of extracting some meaning from text. With the development of the Semantic Web standards, it is increasingly being used to describe semantics (schemas) of the data and to support integration across different sources and formats - databases, XML, spreadsheets, etc. As well as to support new, model driven ways to develop applications.&lt;br /&gt;&lt;br /&gt;I wonder if this creates confusion. In fact, I know it does. At a recent customer meeting, we gave a two hour product presentation. There were many good questions afterward. I did not think there was any confusion until one of the attendees asked if our software had multi-lingual support. I explained that yes, language specific labels can be provided and information can then be displayed in a selected language. He looked puzzled, thought a little and then said "I am not talking about labels. Different languages have different semantics, like sentence structure, etc. How do you address that?"&lt;br /&gt;&lt;br /&gt;I explained that TopBraid Suite does not directly provide text extraction. Instead, we integrate with software that has these capabilities. It can be a product like &lt;a href="http://www.opencalais.com/"&gt;Calais&lt;/a&gt; which provides the extracted concepts directly in RDF or a product that provides results in XML. We can convert it to RDF in an automated way. Integration with the text mining software makes it possible to bring together (and, consequently, query) structured and unstructured information using a common RDF infrastructure.&lt;br /&gt;&lt;br /&gt;With this, I wander if there should be two very distinct tracks at the conference? Is there some other space where these two different streams of technologies come together? If so, can the intersection be better explained and positioned?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7507012841435012041-27874061428277944?l=topquadrantblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://topquadrantblog.blogspot.com/feeds/27874061428277944/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7507012841435012041&amp;postID=27874061428277944' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default/27874061428277944'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default/27874061428277944'/><link rel='alternate' type='text/html' href='http://topquadrantblog.blogspot.com/2009/06/meaning-of-semantic.html' title='The Meaning of &quot;semantic&quot;'/><author><name>Irene Polikoff</name><uri>http://www.blogger.com/profile/17834271916697741738</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7507012841435012041.post-2762680022275433328</id><published>2009-06-16T23:07:00.000-07:00</published><updated>2009-06-20T20:55:05.460-07:00</updated><title type='text'>Starfleet Day One</title><content type='html'>Well, not exactly day one... We have been on a journey for quite some time now.  And a few of us at TopQuadrant have been blogging for awhile. However, until today we did not have a shared company blog.  Our hope is to make the blog be a place for publishing tips on using the TopBraid Suite, discussing best practices for working with the Semantic Web standards, sharing thoughts and ideas, learning from each other and from our customers.&lt;br /&gt;&lt;br /&gt;Today is not only the first day for the blog, but also the first day of the exhibit at the Semantic Technologies 2009. A busy day, many familiar faces, many new ones as well. Some reflections:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;No one asked me today to explain RDF. Such a difference from just a year ago!&lt;/li&gt;&lt;li&gt;Almost no one asked me "what is this technology good for". Everyone I talked to had a pretty clear idea what problems they wanted to solve. Integration was probably the most common theme.&lt;/li&gt;&lt;li&gt;The simplest demos seem to be the most effective ones. We've build a few fairly elaborate demos, but there is only so much one can show and absorb at a busy conference. Luckily, the demos we have are pretty versatile. I plan to post at least one of the demo apps for everyone to download and try.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;Tomorrow a good amount of demoing will be done by our partners - Oracle and CTG. Both of the partner demos are focusing on medical informatics.&lt;br /&gt;&lt;br /&gt;There is clear evidence that people are ready to adopt the technologies. Many spoke of pilot projects and the need to make IT people comfortable with new infrastructure. For TQ this was good confirmation of our TopBraid Ensemble/Live approach and product direction.&lt;br /&gt;&lt;br /&gt;At the same time, some of the things we take for granted in our product are not always known to the market.  We will therefore need to do some more communication of the "out-of-the-box" capabilities of the suite.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7507012841435012041-2762680022275433328?l=topquadrantblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://topquadrantblog.blogspot.com/feeds/2762680022275433328/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7507012841435012041&amp;postID=2762680022275433328' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default/2762680022275433328'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7507012841435012041/posts/default/2762680022275433328'/><link rel='alternate' type='text/html' href='http://topquadrantblog.blogspot.com/2009/06/starfleet-day-one.html' title='Starfleet Day One'/><author><name>Irene Polikoff</name><uri>http://www.blogger.com/profile/17834271916697741738</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
