<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>Preliminary Results of Logical Ontology Pattern Detection Using SPARQL and Lexical Heuristics</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Ondˇrej Sˇva´b-Zamazal</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Franc¸ois Scharffe</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Vojtˇech Sva´tek</string-name>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>INRIA &amp; LIG</institution>
          ,
          <addr-line>Montbonnot</addr-line>
          ,
          <country country="FR">France</country>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>University of Economics</institution>
          ,
          <addr-line>Prague</addr-line>
        </aff>
      </contrib-group>
      <fpage>139</fpage>
      <lpage>146</lpage>
      <abstract>
        <p>Ontology design patterns were proposed in order to assist the ontology engineering task, providing models of specific construction representing a particular form of knowledge. Various kinds of patterns have since been introduced and classes of patterns identified. Detecting these patterns in existing ontologies is needed in various scenarios, for example the detection of the the two parts of an alignment pattern in an ontology matching scenario, or the detection of an anti-pattern in an optimization scenario. In this paper we present a novel method for the detection of logical patterns in ontologies. This method is based on both SPARQL, as the underlying language for retrieving patterns, and a lexical heuristic constraining the query. It extends our previous works on ontology patterns modeling and detection. We describe an algorithm computing a tokenbased similarity measure used as the lexical heuristic. We conduct an experiment on a large number of Web ontologies, obtaining interesting measures on the usage frequency of three selected patterns.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>-</title>
      <p>
        Ontology Patterns turn out to be an important instrument in many diverse
applications on the Semantic Web. This is reflected by many different Ontology
Design Pattern types such as Logical Patterns, Content Patterns, Refactoring
Patterns, Transformation Patterns or Alignment Patterns1. Many applications
of ontology patterns need to detect patterns at first. In this paper we present
preliminary experiments with logical ontology pattern detection using SPARQL
and additional lexical heuristics. This work extends the work presented in [
        <xref ref-type="bibr" rid="ref7 ref8">7, 8</xref>
        ]
in terms of detection experiments over real ontologies. Our particular motivation
for ontology pattern detection is ontology transformation where detection is the
first step. In [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ] we argue that ontology transformation is useful for many different
Semantic Web use-cases such as ontology matching and ontology re-engineering.
The remainder of this paper is organized as follows: in the next section we
describe three ontology patterns and the way to detect them. Then in Section 3
we present preliminary results of a large scale detection experiment along with
illustrative examples of these ontology patterns. We wrap-up the paper with
conclusions and future work.
      </p>
    </sec>
    <sec id="sec-2">
      <title>Patterns and their Detection</title>
      <p>
        All of the logical ontology patterns introduced in this section have been
presented before [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ]. We introduce here preliminary results of their detection over
a collection of real ontologies. The detection of these patterns has two aspects:
structural and naming ones. Our method first detect the structural aspect
using the SPARQL language2. We currently use the SPARQL query engine from
the Jena framework3. SPARQL queries corresponding to each detected pattern
are detailed in sections below. Then, the method applies the lexical heuristic
computed by Algorithm 1.
      </p>
      <sec id="sec-2-1">
        <title>Algorithm 1 calculateAverageT okenBasedSimilarityM easure</title>
        <p>M ainEntity ⇐ lemmatized tokens of main entity
Entities ⇐ lemmatized tokens of entities
c ⇐ 0
i ⇐ 0
for all u ∈ Entities do
if |u ∩ M ainEntity| = ∅ then</p>
        <p>i ⇐ i + 1
end if
end for
c ⇐ i/|Entities|
return c</p>
        <p>
          Algorihtm 1 computes an average token-based similarity measure c. The
particular instantiation of M ainEntity and Entities depends on the ontology
pattern, see below. This algorithm works on names of entities (a fragment of the
entity URI) which are tokenised (See [
          <xref ref-type="bibr" rid="ref6">6</xref>
          ]) and lemmatized.4 Lemmatization can
potentially increase the recall of the detection process. The lexical heuristics
constraint is fulfilled when c exceeds a certain threshold which is dependent on
particular ontology pattern. The motivation of this computation is based on an
assumption that entities involved in patterns share tokens. More entities share
the same token, the higher probability of occurrence of a pattern. We detail
below three patterns that were detected in the experiment described in Section 3.
2.1
        </p>
        <sec id="sec-2-1-1">
          <title>Attribute Value Restriction</title>
          <p>
            The AVR pattern has been originally introduced in [
            <xref ref-type="bibr" rid="ref4">4</xref>
            ] as a constituent part
of an alignment pattern, a pattern of correspondence between entities in two
ontologies. Basically, it is a class the instances of which are restricted with some
2 http://www.w3.org/TR/rdf-sparql-query/
3 http://jena.sourceforge.net/
4 We use the Stanford POS tagger http://nlp.stanford.edu/software/tagger.
shtml.
attribute value. The SPARQL query for detection of this ontology pattern is the
following:
SELECT ?c1 ?c2 ?c3
WHERE {
?c1 rdfs:subClassOf _:b.
_:b owl:onProperty ?c2.
_:b owl:hasValue ?c3.
?c2 rdf:type owl:ObjectProperty.
          </p>
          <p>FILTER (!isBlank(?c1)) }</p>
          <p>In this query we express a value restriction applied on a named class.
Furthermore restricting properties must be of the type ’ObjectProperty’ in order to
have individuals (eg. ’Sweet’) as values and not data types (eg. String). Currently
we do not consider the naming aspect for this pattern.
2.2</p>
        </sec>
        <sec id="sec-2-1-2">
          <title>Specified Values</title>
          <p>
            We first considered the SV pattern in [
            <xref ref-type="bibr" rid="ref7">7</xref>
            ], but it had been originally presented in
a document from the SWBPD group5. This ontology pattern deals with ’value
partitions’ representing specified collection of values expressing ’qualities’,
’attributes’, or ’features’. An example is given in the next section 3.
          </p>
          <p>There are mainly two ways for capturing this pattern which are reflected by
two different SPARQL queries. Either individuals where qualities are instances
can be used for the detection:
SELECT distinct ?p ?a1 ?a2
WHERE {
?a1 rdf:type ?p.
?a2 rdf:type ?p.
?a1 owl:differentFrom ?a2 }</p>
          <p>Or subclasses where qualities are classes partitioning a ’feature’ can be used:
SELECT distinct ?p ?c1 ?c2
WHERE {
?c1 rdfs:subClassOf ?p.
?c2 rdfs:subClassOf ?p.
?c1 owl:disjointWith ?c2
FILTER (
!isBlank(?c1) &amp;&amp; !isBlank(?c2) &amp;&amp; !isBlank(?p))}</p>
          <p>We are interested in mutually disjoint named classes (siblings) and we use
non-transitive semantics (ie. direct) of ’subClassOf’ relation here. Otherwise we
would get ’specified value’ as many times as there are different superclasses for
those siblings. Regarding the initialisation of variables from the Algorithm 1,
the M ainEntity is either a ?p instance (for the first query) or class (for the
second query). Entities are all other entities from the SELECT construct. The
experimental setting for the threshold is 0.5.
5 http://www.w3.org/TR/swbp-specified-values/
2.3</p>
        </sec>
        <sec id="sec-2-1-3">
          <title>Reified N-ary Relations</title>
          <p>
            We have already considered the N-ary pattern in [
            <xref ref-type="bibr" rid="ref7">7</xref>
            ]. It has also been an
important topic of the SWBPD group [
            <xref ref-type="bibr" rid="ref2">2</xref>
            ], because there is no direct way how to
express N-ary relations in OWL6. Basically, a N-ary relation is a relation
connecting an individual to many individuals or values. For this pattern we adhere
to a solution introduced in [
            <xref ref-type="bibr" rid="ref2">2</xref>
            ]: introducing a new class for a relation which is
therefore reified. For examples in the next section 3 we will use the following
syntax (property(domain,range)):
relationX(X, Y ); relationY 1(Y, A); relationY 2(Y, B)
          </p>
          <p>The structural aspect of this pattern is captured
using the following SPARQL query:
SELECT ?relationX ?Y ?relationY1 ?relationY2 ?A ?B
WHERE {
?relationX rdfs:domain ?X.
?relationX rdfs:range ?Y.
?relationY1 rdfs:domain ?Y.
?relationY1 rdfs:range ?A.
?relationY2 rdfs:domain ?Y.
?relationY2 rdfs:range ?B
FILTER (?relationY1!=?relationY2)}</p>
          <p>The intended structure of this reified N-ary relation pattern is depicted in
the Figure on the right. In order to increase the precision of the detection we also
apply lexical heuristics introduced above in Algorithm 1: variable M ainEntity
is initialised with the value ?relationX. Entities are all other entities from the
SELECT construct. The experimental setting for the threshold is 0.4.
3</p>
        </sec>
      </sec>
    </sec>
    <sec id="sec-3">
      <title>Experiment</title>
      <p>In order to acquire a high number of ontologies, we applied the Watson tool7 via
its API. We searched ontologies imposing conjuction of the following constraints:
OWL as the representation language, at least 10 classes, and at least 5
properties. Alltogether we collected 490 ontologies. However, many ontologies have
not been accessible at the time of querying or there were some parser problems.
Futhermore we only include ontologies having less than 300 entities. All in all
our collection has 273 ontologies.</p>
      <p>Table 1 presents overall numbers of ontologies where certain amount of
ontology patterns were detected.</p>
      <p>We can see that patterns were only detected in a small portion of ontologies
from the collection. In four ontologies, the AVR pattern was detected more than
10 times. It reflects the fact that some designers tend to extensively use this
6 It also holds for OWL 2. The notion of N-ary datatype was not introduced there,
except for syntactic constructs allowing further extensions, see http://www.w3.org/
TR/2009/WD-owl2-new-features-20090611/#F11:_N-ary_Datatypes
7 http://watson.kmi.open.ac.uk/WS_and_API.html
≥ 10× (9 − 4)× 3× 2× 1× all
AVR pattern 4× – 2× 1× 1× 8×
SV pattern – 4× – 2× 9× 15×</p>
      <p>N-ary pattern – 5× 4× 16× 25× 50×</p>
      <p>Table 1. Frequency table of ontologies wrt. number of ontology patterns detected.
pattern. Other two ontology patterns were not so frequent in one ontology (the
SV pattern was detected maximally 8 times and the N-ary pattern was detected
maximally six times). On the other hand the most frequent pattern regarding a
number of ontologies was the N-ary pattern. This goes against an intution that
this pattern is quite rare. It can be explained with a low precision detection of
this pattern, see below.</p>
      <p>In order to obtain raw preliminary precision estimation for the ontology
pattern detection we analysed one randomly chosen detected pattern instance from
10 ontologies (in the case of the AVR pattern from 8 ontologies). Although
we tried to apply ontology transformation perspective for manual evaluation, we
could not fully avoid coarse-grained and subjective evaluation due to soft
boundaries between ontology patterns and sometimes unexpected conceptualisations
in some Web ontologies.</p>
      <p>The overall precision for the AVR pattern is 0.6, for the SV pattern 0.7, and
for the N-ary pattern 0.3. For better insight we will look at two examples (one
positive and one negative) for each of these ontology patterns.</p>
      <p>AVR pattern This ontology pattern was found many times in a wine
ontology8 with high precision. One positive example is the following:
hasColor.{W hite}</p>
      <sec id="sec-3-1">
        <title>Chardonnay</title>
        <p>Chardonnay wine is restricted on these instances having value ’White’ for the
property hasColor. On the other hand, one negative example is the following9:
2.{coordinate 0}</p>
      </sec>
      <sec id="sec-3-2">
        <title>N orth</title>
        <p>In this ontology each point of the compass (eg. North) is described using
three different relations ( 2 is one of them) having coordinates. This cannot be
interpreted as an attribute value restriction pattern.</p>
        <p>SV pattern The following10 is one example which we evaluated as positive
(a shared token is ’Molecule’, c = 1.0):</p>
        <p>M olecule</p>
        <p>AnorganicM olecule; M olecule</p>
        <p>OrganicM olecule</p>
        <p>This can be interpreted as a collection of different kinds of molecules which is a
complete partitioning. Furthermore disjointness is ensured by a query. On the other
hand in another ontology11 a negative example was detected:
8 http://www.w3.org/TR/2003/CR-owl-guide-20030818/wine
9 http://sweet.jpl.nasa.gov/ontology/space.owl
10 http://www.meteck.org/PilotPollution1.owl
11 http://www.cip.ifi.lmu.de/~oezden/MastersThesisWeb/STCONCEPTS.owl
T imeP eriods</p>
        <p>SocioculturalT imeP eriods; T imeP eriods
CalendarDateP eriods</p>
        <p>In this case it can hardly be a complete partitioning, however this is always
dependent on domain of discourse. It points out that ontology pattern detection should
generally be a semi-automatic process.</p>
        <p>N-ary pattern This pattern has the lowest precision. Due to the usage of a relaxed
structural condition there are a lot of negative cases. Even if the lexical heuristics
constraint improves this low precision, there is still ample space for improvement.</p>
        <p>In the PML ontology12 the following positive example was detected:
hasP rettyNameMapping(InferenceStep, P rettyNameMapping)
hasP rettyName(P rettyNameMapping, string)
hasReplacee(P rettyNameMapping, string)</p>
        <p>This is the example of N-ary relation where the reified property
’PrettyNameMapping’ (’ ?Y’) captures additional attributes (’hasReplacee’) describing the relation
(’hasPrettyNameMapping’). c = 0.5 where shared tokens were ’Pretty’ resp. ’has’.</p>
        <p>On the other hand in the earthrealm13 a negative example was detected:
hasUpperBoundary(EarthRealm, LayerBoundary)
isUpperBoundaryOf(LayerBoundary, EarthRealm)
isLowerBoundaryOf(LayerBoundary, EarthRealm)</p>
        <p>In this case ’LayerBoundary’ was detected as a reified N-ary relation (’ ?relationX’)
connecting different aspects (’ ?relationY1’, ’ ?A’ and ’ ?relationY2’,’ ?B’) of the same
relation; c = 0.75 where a shared token was ’Boundary’. But if we look at the classes
bound with ’ ?X’, ’ ?A’ and ’ ?B’, we can see that there is an implicit ’inverseOf’ relation
between ’hasUpperBoundary’ and ’isUpperBoundaryOf’ resp. with
’isLowerBoundaryOf’. This ’inverseOf’ relation cannot be directly found in this ontology. However
we could assume this and therefore we could increase the precision considering this
specific case in the future work.</p>
        <p>Another recurrent negative example is the following14:
concludedby(perdurant, perdurant)
startedby(perdurant, perdurant)
concludedby(perdurant, perdurant)</p>
        <p>This is a chain of properties connected with the same class in domain/range; c =
0.66 where a shared token is ’by’. Thus, at the first sight a detection could be improved
with considering this negative example (’ ?X’=’ ?Y’=’ ?A’=’ ?B’). On the other hand
we can also find a counter-example considering true semantics of domain and range in
OWL, ie. restrictions are superclasses of possible individuals. As usual, applying this
condition we could filter out some current negative examples (getting higher precision),
on the other side we could miss other positive examples (getting lower recall). This
choice is application-dependant.
4</p>
      </sec>
    </sec>
    <sec id="sec-4">
      <title>Related Work</title>
      <p>
        In [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ] the authors generally consider using SPARQL expressions for extracting Content
Ontology Design Patterns from an existing reference ontology. It is followed by a manual
12 http://inferenceweb.stanford.edu/2004/07/iw.owl
13 http://sweet.jpl.nasa.gov/sweet/earthrealm.owl
14 http://neuroscientific.net/bio-zen.owl
selection of particular useful axioms towards creating new Content Ontology Design
Pattern. The Ontology Pre-Processing Language (OPPL) is specialized on
patternbased manipulation with ontologies. It can be used for ontology pattern detection,
however there is no such a lexical support which our detection needs. In [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ] the authors
envision employing OPPL for detecting recurring patterns in ontologies and materialize
them as new patterns. This is also one of our long-term effort.
      </p>
      <p>
        By now, we use the SPARQL language for detecting structural aspect of ontology
patterns. But SPARQL is a query language for RDF. Considering ontology patterns
as DL-like conceptualisations, it leads to a necessity of expressing DL-like concepts in
RDF representations which is rarely 1:1. This can be overcome by using some OWL-DL
aware query language, eg. SPARQL-DL [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ]. However for now this language does not
support some specific DL constructs e.g. restriction and it is not fully implemented
yet.
5
      </p>
    </sec>
    <sec id="sec-5">
      <title>Conclusions and Future Work</title>
      <p>
        In this paper we presented preliminary results of logical ontology pattern detection for
which we use SPARQL and lexical heuristics. We conducted an experiment on a large
number of Web ontologies. We manually evaluated 28 ontology pattern instances so
as to roughly estimate precision. The performance of this detection must be further
improved. Besides future work depicted in Section 3, we have to further work on more
sophisticated lexical heuristics constraint. We could also employ head noun detection
[
        <xref ref-type="bibr" rid="ref6">6</xref>
        ]. Further, we should also try to perform our queries using SPARQL-DL as OWL-DL
aware language. We work on a specific FILTER extension (in connection with head
noun detection) for the SPARQL language which could include the naming aspect
already at the level of the query language.
      </p>
      <p>Acknowledgement The work has been partially supported by the IGA VSE grant no.
20/08 “Evaluation and matching ontologies via patterns”.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <given-names>A. R. Luigi</given-names>
            <surname>Iannone</surname>
          </string-name>
          and
          <string-name>
            <given-names>R.</given-names>
            <surname>Stevens</surname>
          </string-name>
          .
          <article-title>Embedding Knowledge Patterns into OWL</article-title>
          .
          <source>In Proceedings of the 6th European Semantic Web Conference</source>
          ,
          <year>2009</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <given-names>N.</given-names>
            <surname>Noy</surname>
          </string-name>
          and
          <string-name>
            <given-names>A.</given-names>
            <surname>Rector. Defining</surname>
          </string-name>
          n
          <article-title>-ary relations on the semantic web</article-title>
          ,
          <source>Apr</source>
          .
          <year>2006</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <given-names>V.</given-names>
            <surname>Presutti</surname>
          </string-name>
          and
          <string-name>
            <given-names>A.</given-names>
            <surname>Gangemi</surname>
          </string-name>
          .
          <article-title>Content ontology design patterns as practical building blocks for web ontologies</article-title>
          .
          <source>In Proceedings of ER2008. Barcelona, Spain</source>
          ,
          <year>2008</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <given-names>F.</given-names>
            <surname>Scharffe</surname>
          </string-name>
          . Correspondence Patterns Representation.
          <source>PhD thesis</source>
          , University of Innsbruck,
          <year>2009</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <given-names>E.</given-names>
            <surname>Sirin</surname>
          </string-name>
          and
          <string-name>
            <given-names>B.</given-names>
            <surname>Parsia</surname>
          </string-name>
          .
          <article-title>SPARQL-DL: SPARQL Query for OWL-DL</article-title>
          .
          <source>In OWLED2007</source>
          ,
          <year>2007</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <surname>O.</surname>
          </string-name>
          <article-title>Sˇv´ab Zamazal and V. Sv´atek. Analysing Ontological Structures through Name Pattern Tracking</article-title>
          .
          <source>In Proceedings of the 16th International Conference on Knowledge Engineering and Knowledge Management</source>
          ,
          <year>2008</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <surname>O.</surname>
          </string-name>
          <article-title>Sˇv´ab-Zamazal and V. Sv´atek. Towards Ontology Matching via Pattern-Based Detection of Semantic Structures in OWL Ontologies</article-title>
          .
          <source>In Proceedings of the Znalosti Czecho-Slovak Knowledge Technology conference</source>
          ,
          <year>2009</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8.
          <string-name>
            <surname>O.</surname>
          </string-name>
          <article-title>Sˇv´ab-</article-title>
          <string-name>
            <surname>Zamazal</surname>
            ,
            <given-names>V.</given-names>
          </string-name>
          <article-title>Sv´atek, and</article-title>
          <string-name>
            <given-names>F.</given-names>
            <surname>Scharffe</surname>
          </string-name>
          .
          <article-title>Pattern-based Ontology Transformation Service</article-title>
          .
          <source>In Proceedings of the 1st International Conference on Knowledge Engineering and Ontology Development</source>
          ,
          <year>2009</year>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>