<!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>PSOA RuleML Integration of Relational and Ob ject-Centered Geospatial Data</article-title>
      </title-group>
      <contrib-group>
        <aff id="aff0">
          <label>0</label>
          <institution>Faculty of Computer Science, University of New Brunswick</institution>
          ,
          <addr-line>Fredericton</addr-line>
          ,
          <country country="CA">Canada</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>In recent years, many geospatial data sets have become available on the Web. These data can be incorporated into real-world applications to answer advanced geospatial queries. In this paper, we present a use case to integrate a local data set with external geospatial data sets on the Web. The data sets are modeled in different paradigms relational and object-centered. The integration uses Positional-Slotted Object-Applicative (PSOA) RuleML, which combines the relational and object-centered modeling paradigms for databases as well as knowledge bases (KBs).</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>Introduction</title>
      <p>In recent years, many geospatial data sets, e.g. LinkedGeoData1 [1] and
GeoNames2, become available on the Web. Since a large number of real-world
applications are built on top of data sets that contain geospatial information,
enriching these data with external geospatial knowledge on the Web become an
interesting topic. The integration becomes more complex when the data sets
are modeled in different paradigms, e.g. some use the relational paradigm built
on top of predicate applications while others use the object-centered paradigm
built on top of RDF triples. In this paper, we present a use case that integrates
two relational data sets and one object-centered data set to answer interesting
geospatial queries. The integration is done using the PSOA RuleML language,
which integrates the relational and the object-centered paradigms for knowledge
representation.</p>
      <p>The paper is organized as follows: Section 2 introduces the basics of PSOA
RuleML. Section 3 explains the data sets used for integration and give sample
facts. Section 4 explains integration rules. Section 5 gives sample geospatial
queries that can be answered after integration. Section 6 concludes the paper.</p>
      <sec id="sec-1-1">
        <title>1 http://linkedgeodata.org</title>
      </sec>
      <sec id="sec-1-2">
        <title>2 http://www.geonames.org</title>
      </sec>
    </sec>
    <sec id="sec-2">
      <title>PSOA RuleML</title>
      <p>PSOA RuleML [2] is an object-relational Web rule language that integrates
relations and graphs via positional-slotted object-applicative (psoa)3 terms, which
have the general form</p>
      <p>
        o # f([t1,1 ... t1,n1 ] ... [tm,1 ... tm,nm ] p1-&gt;v1 ... pk-&gt;vk)
Here, an object is identified by an Object IDentifier (OID) o and described by
(
        <xref ref-type="bibr" rid="ref1">1</xref>
        ) a class membership o # f, (
        <xref ref-type="bibr" rid="ref2">2</xref>
        ) a set of tupled arguments [ti,1 ... ti,ni ],
i = 1; : : : ; m, each being a sequence of terms, and (
        <xref ref-type="bibr" rid="ref3">3</xref>
        ) a set of slotted arguments
pj-&gt;vj, j = 1; : : : ; k representing attribute-value pairs. Each slot can have one
or more fillers (values). The OID as well as tuples and, orthogonally, slots in a
psoa term are all optional. A psoa term can express untyped objects by treating
them as being typed by the root class f=Top.
      </p>
      <p>A more detailed introduction, with many examples leading to the semantics,
can be found in [3].
3</p>
    </sec>
    <sec id="sec-3">
      <title>Data Sets</title>
      <p>The data sets employed in the use case consist of three parts, all of which are
converted into PSOA RuleML presentation syntax.
1. A relational data set that contains house rental information, where the
arguments denote the unique reference number of the house, the street name
and number, city name, province/state name, country name, number of
bedrooms, price per month, and whether it is furnished. Some facts are shown
in the following.
ex:HouseRentalInfo(1 "35 Routliffe Lane" "Toronto" "ON" "CA"
3 2500 "False"^^xs:boolean)
ex:HouseRentalInfo(2 "42 Frey Crescent" "Toronto" "ON" "CA"
2 900 "True"^^xs:boolean)
ex:HouseRentalInfo(3 "200 Hilda Avenue" "Toronto" "ON" "CA"
4 2000 "True"^^xs:boolean)
ex:HouseRentalInfo(4 "56 Wellington Street West" "Toronto" "ON" "CA"</p>
      <sec id="sec-3-1">
        <title>4 1695 "False"^^xs:boolean)</title>
        <p>ex:HouseRentalInfo(5 "1130 McAllister Avenue" "Ottawa" "ON" "CA"</p>
      </sec>
      <sec id="sec-3-2">
        <title>2 1300 "False"^^xs:boolean)</title>
        <p>2. A relational data set containing coordinates of addresses in WGS 84 geodetic
longitude-latitude spatial reference system used by the Global Positioning
System. Such data can be obtained using online geocoding services. The
relational arguments represent the latitude, the longitude, the street address,
the city name, the province name, and the country name. Some facts are
shown in the following.
3 We use the upper-cased “PSOA” as a qualifier for the language and the lower-cased
“psoa” for its terms.
gc:Geocode(43.778267 -79.426723 "35 Routliffe Lane" "Toronto" "ON" "CA")
gc:Geocode(43.74242 -79.291529 "42 Frey Crescent" "Toronto" "ON" "CA")
gc:Geocode(43.7955 -79.429234 "200 Hilda Avenue" "Toronto" "ON" "CA")
gc:Geocode(43.645289 -79.389063 "56 Wellington Street West" "Toronto" "ON" "CA")
gc:Geocode(39.78373 -100.445882 "1130 McAllister Avenue" "Ottawa" "ON" "CA")
3. An object-centered data set, extracted from Geonames, that contains
information about geospatial entities. Each object is of the class gn:Feature
(geospatial feature) and described by slots gn:name, geo:lat, geo:long,
and gn:featureCode for its name, WGS84 latitude, WGS84 longitude, and
feature code. The feature code describes the type of geospatial feature, e.g.
a store, a hotel, a city, etc. Following is a example fact.
&lt;http://sws.geonames.org/123456/&gt;#gn:Feature(gn:name-&gt;"Canadian Tire"
gn:featureCode-&gt;gn:S.RET
geo:lat-&gt;43.7
geo:long-&gt;-79.1)</p>
      </sec>
    </sec>
    <sec id="sec-4">
      <title>4 Integration Rules</title>
      <p>In order to extract geospatial knowledge from multiple data sets and
integrate them, we first create a vocabulary to describe the geospatial entities in
our KB. The constant names are modeled using IRIs starting with the
prefix gr:, which is a shortcut for http://psoa.ruleml.org/GeospatialRules#.
The class gr:GeoEntity denotes all geospatial entities that can be located.
Every gr:GeoEntity-typed object has a slot gr:coord for the precise coordinates
of its centroid, where the slot value is expressed as a gr:Point application to the
latitude and longitude floating-point values. It also has an gr:addr slot for its
address of the class gr:Address. Subclasses of gr:GeoEntity in the KB include
gr:SubwayStation, gr:Store and gr:House. gr:HouseForRent is a subclass of
gr:House. The set of subclasses can be expanded based on application
requirements.
gr:SubwayStation##gr:GeoEntity
gr:Restaurant##gr:GeoEntity
gr:Store##gr:GeoEntity
gr:House##gr:GeoEntity
gr:HouseForRent##gr:House</p>
      <p>The class gr:Address, which is used to type addresses objects, is described
by slots gr:street, gr:city, gr:prov, and gr:country.</p>
      <p>The following rule extracts address information from the house rental
relation. The OID of the gr:HouseForRent object is an application of the function
gr:HouseRentID to the reference number ?RefNo, which uniquely determines
the house. While the OID of the gr:Address object is an existentially
quantified variable ?Addr denoting a system-generated OID.</p>
      <sec id="sec-4-1">
        <title>Exists ?Addr (</title>
      </sec>
      <sec id="sec-4-2">
        <title>Forall ?Key ?Name ?Phone ?Street ?City ?Prov ?Country ?PostCode ?Addr</title>
        <p>(</p>
        <p>And(gr:HouseRentID(?RefNo)#gr:HouseForRent(?Bedrooms ?Price ?Furnished
gr:addr-&gt;?Addr)
?Addr#gr:Address(gr:street-&gt;?Street
gr:city-&gt;?City
gr:prov-&gt;?Prov
gr:country-&gt;?Country))
)
:- ex:HouseRentalInfo(?RefNo ?Street ?City ?Prov ?Country</p>
        <p>?Bedrooms ?Price ?Furnished)
)
)</p>
        <p>The coordinate of a geospatial entity with an address can be retrieved from
the gc:Geocode relation, using the following rule.</p>
        <p>Forall ?O ?Ad ?Lat ?Long ?Street ?City ?Prov ?Country
(
?O#gr:GeoEntity(gr:coord-&gt;gr:Point(?Lat ?Long))
:- And(?O#gr:GeoEntity(gr:addr-&gt;?Ad)
?Ad#gr:Address(gr:street-&gt;?Street
gr:city-&gt;?City
gr:prov-&gt;?Prov
gr:country-&gt;?Country)
gc:Geocode(?Lat ?Long ?Street ?City ?Prov ?Country))</p>
        <p>The following rule derives that an object ?O is gr:in an ?Area if ?O has
an address ?Ad, ?Ad has coordinates ?Pt, and ?Pt is a proper part of ?Area.
The conclusion adds to ?O a slot name gr:in whose filler, ?Area, is the
result of the condition query evaluation. The condition performs a composition
of the slot named gr:coord, with filler ?Pt, followed by the binary relation
gr:RCCProperPartOf, leading to ?Area.</p>
        <p>Forall ?O ?Ad ?Pt ?Area
(
?O#gr:GeoEntity(gr:in-&gt;?Area)
:- And(
?O#gr:GeoEntity(gr:coord-&gt;?Pt)
gr:RCCProperPartOf(?Pt ?Area)
)</p>
        <p>)</p>
        <p>The following rule derives a “proper part of” relation between a point and an
rectangular area expressed as an gr:Box application to the minimum latitude,
the minimum longitude, the maximum latitude, and the maximum longitude of
the area, by comparing the coordinates of the point with the coordinates of the
boundaries of the area.</p>
        <p>Next we discuss the integration of the graph data set for other geospatial
queries. The following rule maps the slot values of gn:name, geo:lat, and
geo:long of gn:Feature into slot values of gr:name and gr:coord for gr:GeoEntity.
Forall ?O ?Name ?Lat ?Long
(
?O#gr:GeoEntity(gr:name-&gt;?Name</p>
        <p>gr:coord-&gt;gr:Point(?Lat ?Long))
:- ?O#gn:Feature(gn:name-&gt;?Name
geo:lat-&gt;?Lat
geo:long-&gt;?Long)</p>
        <p>The classes of these objects can be refined using their feature codes, as shown
in the following rules.</p>
      </sec>
      <sec id="sec-4-3">
        <title>Forall ?Lat ?Long ?LatMin ?LongMin ?LatMax ?LongMax ( gr:RCCProperPartOf(gr:Point(?Lat ?Long) gr:Box(?LatMin ?LongMin ?LatMax ?LongMax)) :- And (</title>
      </sec>
      <sec id="sec-4-4">
        <title>External(pred:numeric-greater-than-or-equal(?Lat ?LatMin))</title>
      </sec>
      <sec id="sec-4-5">
        <title>External(pred:numeric-greater-than-or-equal(?Long ?LongMin))</title>
      </sec>
      <sec id="sec-4-6">
        <title>External(pred:numeric-less-than-or-equal(?Lat ?LatMax)) External(pred:numeric-less-than-or-equal(?Long ?LongMax)) ) )</title>
        <p>)
)
)
)</p>
      </sec>
      <sec id="sec-4-7">
        <title>Forall ?O (</title>
      </sec>
      <sec id="sec-4-8">
        <title>Forall ?O ( Forall ?O (</title>
        <p>?O#gr:SubwayStation</p>
        <p>:- ?O#gn:Feature(gn:featureCode-&gt;gn:S.MTRO)
?O#gr:Restaurant</p>
        <p>:- ?O#gn:Feature(gn:featureCode-&gt;gn:S.REST)
?O#gr:Store</p>
        <p>:- ?O#gn:Feature(gn:featureCode-&gt;gn:S.RET)</p>
        <p>With both data sets expressed as GeoEntity objects, we can introduce the
following rule, which derives the distance (measured in km) of ?O1 and ?O2 to be less
or equal than ?Distance, using the external function gr:distanceLessEqual,
which computes whether the distance of two GPS points (?Lat1, ?Long1) and
(?Lat2, ?Long2) is less or equal than ?Distance.</p>
      </sec>
      <sec id="sec-4-9">
        <title>Forall ?Lat1 ?Long1 ?Lat2 ?Long2 ?Distance ?Name ?G ?F ( gr:inDistance(?O1 ?O2 ?Distance) :</title>
        <p>And(
?O1#gr:GeoEntity(gr:coord-&gt;gr:Point(?Lat1 ?Long1))
?O2#gr:GeoEntity(gr:coord-&gt;gr:Point(?Lat2 ?Long2))</p>
      </sec>
      <sec id="sec-4-10">
        <title>External(gr:distanceLessEqual(?Lat1 ?Long1 ?Lat2 ?Long2 ?Distance))) )</title>
        <p>5</p>
      </sec>
    </sec>
    <sec id="sec-5">
      <title>Geospatial Queries</title>
      <p>The first kind of query that can be asked is one type of geospatial entities in a
region, such as all houses available for rent in a region:</p>
      <sec id="sec-5-1">
        <title>And(?H#gr:HouseForRent(gr:in-&gt;gr:Box(43 -80 44 -79) gr:addr-&gt;?Addr) ?Addr#gr:Address(gr:street-&gt;?Street))</title>
        <p>
          The result binds ?H to gr:HouseRentID(
          <xref ref-type="bibr" rid="ref1">1</xref>
          ) ... gr:HouseRentID(
          <xref ref-type="bibr" rid="ref4">4</xref>
          ),
representing houses 1 to 4 from the original KB.
        </p>
        <p>Another kind of query is to look for all geospatial entities near a specific
entity.</p>
        <p>For example, we can ask queries such as all stores within 5km of the house
with reference number 2:</p>
      </sec>
      <sec id="sec-5-2">
        <title>And(?S#gr:Store(gr:name-&gt;?Name) gr:inDistance(gr:HouseRentID(2) ?S 5))</title>
        <p>We can also look for all houses for rent within a certain distance of a place,
e.g. 2km within the subway station named "Spadina".</p>
      </sec>
      <sec id="sec-5-3">
        <title>And(?S#gr:SubwayStation(gn:name-&gt;"Spadina") ?H#gr:HouseForRent gr:inDistance(?H ?S 2))</title>
        <p>6</p>
      </sec>
    </sec>
    <sec id="sec-6">
      <title>Conclusion</title>
      <p>
        In this paper, we show a PSOA RuleML-based integration of a local relational
house rental data set, with external geocoding data set and Geonames. The
integration enables the use of reasoning engines to answer advanced geospatial
queries. The approach can be applied to similar local data sets that contain
address information. In the use case, we demonstrate the usefulness of
objectrelational PSOA rules, e.g. for expressing transformation among the relational,
the object-centered, or the combined modeling paradigms. Future work includes:
(
        <xref ref-type="bibr" rid="ref1">1</xref>
        ) exploring the use of Region Connection Calculus rules in GeospatialRules
KB [4] to answer more geospatial queries; (
        <xref ref-type="bibr" rid="ref2">2</xref>
        ) expand the KB with more facts to
test the scalability of the PSOATransRun engine [5].
      </p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <surname>Stadler</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Lehmann</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Höffner</surname>
            ,
            <given-names>K.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Auer</surname>
            ,
            <given-names>S.:</given-names>
          </string-name>
          <article-title>LinkedGeoData: A core for a Web of spatial open data</article-title>
          .
          <source>Semantic Web</source>
          <volume>3</volume>
          (
          <issue>4</issue>
          ) (
          <year>2012</year>
          )
          <fpage>333</fpage>
          -
          <lpage>354</lpage>
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <surname>Boley</surname>
          </string-name>
          , H.:
          <article-title>A RIF-Style Semantics for RuleML-Integrated Positional-Slotted, ObjectApplicative Rules</article-title>
          .
          <source>In: Proc. 5th International Symposium on Rules: Research Based and Industry Focused (RuleML-2011 Europe)</source>
          ,
          <source>Barcelona, Spain. Lecture Notes in Computer Science</source>
          , Springer (July
          <year>2011</year>
          )
          <fpage>194</fpage>
          -
          <lpage>211</lpage>
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <surname>Boley</surname>
          </string-name>
          , H.:
          <article-title>PSOA RuleML: Integrated object-relational data and rules</article-title>
          .
          <source>In: Reasoning Web</source>
          . Springer (
          <year>2015</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <surname>Zou</surname>
          </string-name>
          , G.:
          <article-title>GeospatialRules: A Datalog+ RuleML Rulebase for Geospatial Reasoning</article-title>
          . In Patkos, T.,
          <string-name>
            <surname>Wyner</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Giurca</surname>
          </string-name>
          , A., eds.: Challenge+DC@
          <article-title>RuleML</article-title>
          . Volume
          <volume>1211</volume>
          of CEUR Workshop Proceedings., CEUR-WS.org (
          <year>2014</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <surname>Zou</surname>
            ,
            <given-names>G.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Boley</surname>
          </string-name>
          , H.:
          <article-title>PSOA2Prolog: Object-Relational Rule Interoperation and Implementation by Translation from PSOA RuleML to ISO Prolog</article-title>
          .
          <source>In: Proc. 9th International Web Rule Symposium (RuleML</source>
          <year>2015</year>
          ), Berlin, Germany. Lecture Notes in Computer Science, Springer (
          <year>August 2015</year>
          )
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>