Training:Advanced Ontology Engineering at FOI - 2011/Reengineering

From Odp

(Difference between revisions)
Jump to: navigation, search
(Reengineering and Refactoring using Semion)
Line 28: Line 28:
Start Semion from the commandline as follows (from the directory where you unpacked Semion):
Start Semion from the commandline as follows (from the directory where you unpacked Semion):
 +
Mac:
java -jar -Xmx512m -XstartOnFirstThread it.cnr.istc.semion.tool-0.6-SNAPSHOT.one-jar.jar  
java -jar -Xmx512m -XstartOnFirstThread it.cnr.istc.semion.tool-0.6-SNAPSHOT.one-jar.jar  
 +
 +
Windows:
 +
java -jar -Xmx512m it.cnr.istc.semion.tool-0.6-SNAPSHOT.one-jar.jar
 +
When the tool starts, the following procedure lets you do the first syntactical transformation (reengineering):
When the tool starts, the following procedure lets you do the first syntactical transformation (reengineering):
Line 44: Line 49:
* In the Project Explorer, under your datasource, and the Alignment subcategory, you alignment should now appear. Double click on it to open its related tab.
* In the Project Explorer, under your datasource, and the Alignment subcategory, you alignment should now appear. Double click on it to open its related tab.
* In the overview you can see any annotations related to the ontology you have chosen to align to. And in the SPARQL tab you can query your alignment, however, currently it is empty. Instead go to the Alignment Rules tab. This is where you can now create your alignment, i.e. the transformation rules that brings the  data from the RDF model of your database into something expressed using the FOAF model instead.
* In the overview you can see any annotations related to the ontology you have chosen to align to. And in the SPARQL tab you can query your alignment, however, currently it is empty. Instead go to the Alignment Rules tab. This is where you can now create your alignment, i.e. the transformation rules that brings the  data from the RDF model of your database into something expressed using the FOAF model instead.
-
* First we want to identify all the persons in the database and set them as instances of FOAF person.  
+
* First we want to identify all the persons in the database and set them as instances of FOAF person.
=== Using D2R ===
=== Using D2R ===

Revision as of 09:10, 4 October 2011

Tutorial Training:Advanced Ontology Engineering at FOI - 2011
Title Reengineering
Problem:

Exercise on reengineering DBs to OWL/RDF.

Solutions:

Reengineering and Refactoring using Semion

In this exercise you will use the Semion tool to reengieer a database table from an example database into RDF, and then to refactor it so that the data is expressed using the FOAF vocabulary.

The database:

host: mysql315.loopia.se

user name: d2r@o45820

password: (given at the course)

database name: ontology_se_db_2

Content: The database contains information about a past ISWC conference, and in one table called "persons" there is information about the people that organized or attended the conference.


Task 1:

Your task is to use Semion to express this data in terms of the FOAF vocabulary, at the following URI: http://xmlns.com/foaf/0.1/


Start Semion from the commandline as follows (from the directory where you unpacked Semion):

Mac: java -jar -Xmx512m -XstartOnFirstThread it.cnr.istc.semion.tool-0.6-SNAPSHOT.one-jar.jar

Windows: java -jar -Xmx512m it.cnr.istc.semion.tool-0.6-SNAPSHOT.one-jar.jar


When the tool starts, the following procedure lets you do the first syntactical transformation (reengineering):

  • When the tool starts you see the workspace on the left, with an example project called "test". Open the text project, and right-click on the "Data sources" icon.
  • Select "New", "Data source", and "Relational database".
  • In the dialogue that appears, give the database a name, e.g. "ISWC", and select the type "MySQL". Enter the host given above, and the port 3306. Database name and username according to above, and the password given to you on site. Finally, set a URI for your new data that will be the result of the reengineering, e.g. "http://example.org/myISWCdata/" and then click on "finish".
  • Double click on your new datasource in the Project Explorer, so that a tab appears to the right with information about the DB.
  • At the bottom-left of the new tab, you can see all the tables of the database. Here you can select what tables of the DB you want to work with. Select the "persons" table, and click on "Extract data" in order to start the reengineering process, i.e. the syntactic transformation step.
  • In the source code tab (bottom) you can see the result of the transformation. The table and its data is now described according to the relational database metamodel of Semion. In the SPARQL tab you can also query this data.
  • However, so far we have only transformed the source syntactically, so now we want to align the data to the FOAF ontology. Start by right-clicking on the data source in the Project Explorer, and select New, Alignment.
  • In the dialogue that appears, you have to first give the alignment a name. Then you can either select to simply use the OWL vocabulary itself as the basis for your alignment, or you can choose to add your own ontology. We want to align our data to the FOAF vocabulary, hence click on the "new ontology" button.
  • First you give the ontology and ID and a name (both can be anything you choose, but the ID needs to be unique for the workspace). Then provide the online URI of the ontology, i.e for FOAF you input http://xmlns.com/foaf/0.1/

Then click Finish.

  • Now the ontology appears in the drop-down list under the name you gave it. Select it and then click on Finish.
  • In the Project Explorer, under your datasource, and the Alignment subcategory, you alignment should now appear. Double click on it to open its related tab.
  • In the overview you can see any annotations related to the ontology you have chosen to align to. And in the SPARQL tab you can query your alignment, however, currently it is empty. Instead go to the Alignment Rules tab. This is where you can now create your alignment, i.e. the transformation rules that brings the data from the RDF model of your database into something expressed using the FOAF model instead.
  • First we want to identify all the persons in the database and set them as instances of FOAF person.

Using D2R

Now, you should try to use D2R to instead create a runtime mapping to the DB, so that you can query the DB using SPARQL.

Task 2:

Use the same database as above, and run the following tutorial: http://sw.cs.technion.ac.il/d2rq/tutorial

The example data is already loaded into the database, but you have to edit the example mapping to reflect the details of the database above. Then you can run the D2R server (with the mapping file in the same directory) and try accessing the DB through SPARQL in your browser.

Personal tools
Quality Committee
Content OP publishers