1. 1
STI INNSBRUCK
FERATEL SCHEMA.ORG PLUGIN
IMPLEMENTATION
Zaenal Akbar, Ioan Toma, Christoph Fuchs, Corneliu Valentin
Stanciu, Lanzanasto Norbert
STI Innsbruck, University of Innsbruck,
Technikerstraße 21a, 6020 Innsbruck, Austria
firstname.lastname@sti2.at
2014-05-19
Semantic Technology Institute Innsbruck
STI INNSBTRUCK
Technikerstraße 21a
A – 6020 Innsbruck
Austria
http://www.sti-innsbruck.
2. 1
Contents
1. Introduction....................................................................................................................................2
2. Implementation...............................................................................................................................2
2.1. Mark-up Format.......................................................................................................................2
2.2. XML Elements Mapping...........................................................................................................3
2.3. XSLT with Microdata...............................................................................................................3
3. Evaluation ......................................................................................................................................5
4. Discussion......................................................................................................................................8
Appendix A. An XML Response of Event............................................................................................9
Appendix B. An XST Transformation for Event .................................................................................12
Appendix C. Transformed XML of Event ..........................................................................................15
References .......................................................................................................................................18
3. 2
1. Introduction
This document presents the implementation of Feratel-Schema.org plugin. Based on the
implementation plan [1], the plugin is designed to consume an XML response output from
Feratel API [2], parsing the XML elements and properties then mapping each element/property
to related class/ property from Schema.org, and finally insert the class/property into the XML
output using an XSL Transformation [3].
The outputs of this implementation are:
1. The markup format to be used
2. The mapping between XML element to Schema.org class including their properties
3. The XSL Transformation for each relevant element/property
2. Implementation
For notation, if does not mentioned explicitly, we use “element” to refer to an XML element
from Feratel API and “class” to a class from Schema.org.
The basic rules implementation to transform the elements to their relevant classes are described
as follow:
1. For each element in Feratel XML:
a. If there is a suitable class in Schema.org then use the class as property value of
the markup format for this element
b. If not then introduce a new element to represent the related class
2. For each property of element in Feratel XML:
a. If the element has a related class in Schema.org then use the relevant property
from the class
b. If not then introduce a new element to represent the class of related property
The solution for each desired output from the previous section will be explained in more detail in
the following sub-sections.
2.1. Mark-up Format
There are various formats available to annotate an XML such as RDFa [4] and Microdata [5],
where both formats are supported by Schema.org.
Since we use the Apache Any23 [6] to extract the annotated XML, after tested with these two
formats, we found that Microdata is more convenient to interlinking a class to other class (i.e to
link a class Event to class PostalAddress though property location).
4. 3
2.2. XML Elements Mapping
The mapping is representing a relation between the elements of Feratel XML and the classes of
Schema.org including their properties.
Table 1 Mapping XML element to Schema.org class
No. XML Element
Schema.org
Class Property
1 Event Event
Event/Details/Names/Translation name
Event/Details/Dates/Date
@From startDate
@To endDate
2 Event/Details/Position GeoCoordinates ??
@Latitude latitude
@Longitude longitude
Event/Descriptions/Description description
Event/Links/Link url
3 Event/Addresses/Address PostalAddress location
Event/Addresses/Address/Company ?? ??
Event/Addresses/Address/FirstName ?? givenName
Event/Addresses/Address/LastName ?? familyName
Event/Addresses/Address/AddressLine1 streetAddress
Event/Addresses/Address/AddressLine2 streetAddress
Event/Addresses/Address/Country addressCountry
Event/Addresses/Address/ZipCode postalCode
Event/Addresses/Address/Town addressRegion
Event/Addresses/Address/Email email
Event/Addresses/Address/Fax faxNumber
Event/Addresses/Address/URL url
Event/Addresses/Address/Phone telephone
Event/Addresses/Address/Mobile telephone
2.3. XSLT with Microdata
Based on the obtained mapping shown at Table 1, then we construct the transformation by using
the XSL transformation as follow:
1. Namespaces declaration
From the Feratel XML output (see Appendix A), it has a specific namespace
“http://interface.deskline.net/DSI/XSD”, therefore this namespace is required to be declared
in the XSL namespaces.
<xsl:stylesheet version="1.0"
5. 4
xmlns:idn="http://interface.deskline.net/DSI/XSD"
xmlns:schema="http://schema.org/"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
2. Element to Class transformation
An XSL template can be used to transform the mapping between an element to a related class
directly. A property to interlinking between classes can be inserted whenever it’s required
(i.e. between Event to its PostalAddress).
<xsl:template match="idn:Event">
<Event itemscope="" itemtype="http://schema.org/Event">
<xsl:apply-templates select="node()|@*"/>
</Event>
</xsl:template>
<xsl:template match="idn:Address">
<Address itemprop="location" itemscope=""
itemtype="http://schema.org/PostalAddress">
<xsl:apply-templates select="node()|@*"/>
</Address>
</xsl:template>
3. Element’s properties to relevant Class’s properties
Properties transformation can be implemented directly as a new property of related element.
<xsl:template match="idn:Event/idn:Descriptions/idn:Description">
<Description itemprop="description">
<xsl:apply-templates select="node()|@*"/>
</Description>
</xsl:template>
<xsl:template match="idn:Address/idn:Country">
<Country itemprop="addressCountry">
<xsl:value-of select="."/>
</Country>
</xsl:template>
4. Element’s properties transformation without a relevant Class
A special transformation is required whenever a property has no relevant class. For example,
property FirstName in XML is covered by the element Address where in Schema.org the
relevant property givenName is covered by class Person. Therefore, a meta element to
represent class Person needs to be inserted first.
<xsl:template match="idn:Event/idn:Details/idn:Dates/idn:Date">
<Date>
<xsl:apply-templates select="node()|@*"/>
</Date>
<time itemprop="startDate" datetime="{@From}" />
<time itemprop="endDate" datetime="{@To}" />
</xsl:template>
<xsl:template match="idn:Address/idn:FirstName">
6. 5
<schema:Person itemprop="owner" itemscope=""
itemtype="http://schema.org/Person">
<FirstName itemprop="givenName">
<xsl:value-of select="."/>
</FirstName>
<LastName itemprop="familyName">
<xsl:value-of select="../idn:LastName"/>
</LastName>
</schema:Person>
</xsl:template>
3. Evaluation
For evaluation we will use Event as input from Feratel API (see Appendix A). The XSL Transformation
for Event shown at Appendix B and produce output at Appendix C.
The output from Apache Any23 [6] is shown as follow:
------------------------------------------------------------------------
Apache Any23 :: rover
------------------------------------------------------------------------
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix doac: <http://ramonantonio.net/doac/0.1/#> .
_:node2ef56d19853fde73a26d76e4fbc19ce a <http://schema.org/Event> ;
<http://schema.org/Event/startDate> "2010-07-
30"^^<http://www.w3.org/2001/XMLSchema#date> .
_:node975779997e46bf1c502ae7c4e9863e7 a <http://schema.org/PostalAddress> ;
<http://schema.org/PostalAddress/streetAddress> "Am Wald 1" , "Null" ;
<http://schema.org/PostalAddress/postalCode> "88605" ;
<http://schema.org/PostalAddress/faxNumber> "Null" ;
<http://schema.org/PostalAddress/email> "Null" ;
<http://schema.org/PostalAddress/addressRegion> "Messkirch" .
_:noded99eb72852e18a5aa2a5fb17182d1c a <http://schema.org/Person> ;
<http://schema.org/Person/familyName> "Huber" ;
<http://schema.org/Person/givenName> "Null" .
_:node975779997e46bf1c502ae7c4e9863e7
<http://schema.org/PostalAddress/owner> _:noded99eb72852e18a5aa2a5fb17182d1c
;
<http://schema.org/PostalAddress/addressCountry> "DE" ;
<http://schema.org/PostalAddress/telephone> "Null" , "Null" ;
<http://schema.org/PostalAddress/url> "Null" .
_:node2ef56d19853fde73a26d76e4fbc19ce <http://schema.org/Event/location>
_:node975779997e46bf1c502ae7c4e9863e7 .
_:nodef2cce7629b732aad2a981c5a354ac99 a <http://schema.org/PostalAddress> ;
<http://schema.org/PostalAddress/streetAddress> "Am Wald 1" , "Null" ;
<http://schema.org/PostalAddress/postalCode> "88605" ;
8. 7
_:node2ef56d19853fde73a26d76e4fbc19ce <http://schema.org/Event/location>
_:nodef31aaf75bfbb1b23e591a93b6f1a07f ;
<http://schema.org/Event/description> "Dieses Mega-Event findet direkt
am Faaker-See statt." ;
<http://schema.org/Event/name> "Beach-Party" , "Beach-Party" ;
<http://schema.org/Event/endDate> "2010-08-
01"^^<http://www.w3.org/2001/XMLSchema#date> ;
<http://schema.org/Event/url> "http://www.test.com" .
<http://localhost:8080/feratel/Feratel>
<http://www.w3.org/1999/xhtml/microdata#item>
_:node2ef56d19853fde73a26d76e4fbc19ce .
------------------------------------------------------------------------
Apache Any23 SUCCESS
Total time: 2s
Finished at: Mon May 19 11:21:23 CEST 2014
Final Memory: 48M/480M
------------------------------------------------------------------------
It is successfully extracted:
1. Event
a. startDate
b. description
c. name
d. endDate
e. url
2. PostalAddress
a. streetAddress
b. postalCode
c. faxNumber
d. email
e. addressRegion
f. addressCountry
g. telephone
h. url
i. owner
3. Person
a. familyName
b. givenName
9. 8
4. Discussion
There are a few transformations (marked with red color) need to be considered and discussed:
1. Property Company is covered by the element Address in Feratel XML. We could not find a
relevant property from a class of Schema.org.
2. Properties FamilyName and LastName is covered by the element Address in Feratel XML. We
introduce a new class Person from Schema.org to cover these properties, but we do not have an
exact property to link the PostalAddress to this Person yet. At the moment we use “owner”.
3. The effect of those newly introduced elements/properties to the TVb’s program which consume
the annotated XML need to be tested.