The SmartMap service, such as it is, runs on a JSP server. It has a simple servlet interface, that takes in map requests formatted in N3/RDF or XML/RDF and outputs N3 route plans. It uses Jena to parse the data. It then takes the information and sends a query to FanLin's service, which returns a route with directions. (This part is currently disabled.) It then adds the route to its SHOP problem, and queries against this new, extended information. It then returns a route, if one exists. Otherwise it returns nothing. As it is, it requires you to upload a knowledge base as well as a query - it does not store the database as an application variable (this should be easy to fix), nor can it get a route from the outside world. The included SHOP domain is very simple, and only Connections are exported to SHOP. I used Caucho's Resin as the server. In this case, you can just unzip this into the doc directory, and it should run (note that it contains a root index.html file, so you might not want to do this on a server you are running).
(defdomain SmartMap
(
(:operator (!turnOnto ?you ?road)
((at ?you ?oldRoad)
(connectsTo ?oldRoad ?road ?time ?distance))
((at ?you ?oldRoad)
(now ?you ?oldTime ?oldDistance))
((at ?you ?road)
(now ?you (call + ?oldTime ?time) (call + ?oldDistance ?distance))))
(:method (travel ?you ?start ?end)
((at ?you ?start)
(connectsTo ?start ?end ?time ?distance))
((!turnOnto ?you ?end))
((at ?you ?start)
(connectsTo ?intron ?end ?time ?distance))
((travel ?you ?start ?intron)
(!turnOnto ?you ?end)))
)
)
@prefix daml: <http://www.daml.org/2001/03/daml+oil#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix sm: <http://www.wam.umd.edu/~krakatoa/cs828y/project/smartmap.daml#> .
@prefix trav: <http://www.wam.umd.edu/~krakatoa/cs828y/project/travel.daml#> .
@prefix : <#> .
[ a trav:Trip ;
trav:to
[ trav:streetAddress "9591 Baltimore BLVD" ;
trav:city "College Park" ;
trav:zip "20740" ;
trav:state "MD" ;
a trav:Location ] ;
trav:from
[ trav:streetAddress "4910 Blackfoot RD" ;
trav:city "College Park" ;
trav:zip "20740" ;
trav:state "MD" ;
a trav:Location ] ;
trav:directions
([ trav:exit
[ trav:streetAddress "49th Place" ;
a trav:Location ] ;
trav:start
[ trav:streetAddress "4910 Blackfoot RD" ;
a trav:Location ] ;
a trav:Connection ;
trav:distance "0.1" ;
trav:instructions "Drive ahead to 49th Place." ]
[ trav:exit
[ trav:streetAddress "CHEROKEE ST" ;
a trav:Location ] ;
trav:start
[ trav:streetAddress "49th Place" ;
a trav:Location ] ;
a trav:Connection ;
trav:distance "0.2" ;
trav:instructions "Turn left onto Cherokee Street." ]
[ trav:exit
[ trav:streetAddress "BALTIMORE AVE" ;
a trav:Location ] ;
trav:start
[ trav:streetAddress "CHEROKEE ST" ;
a trav:Location ] ;
a trav:Connection ;
trav:distance "0.5" ;
trav:instructions "Turn right onto Baltimore Avenue." ]
[ trav:exit
[ trav:streetAddress "9591 Baltimore BLVD" ;
trav:city "College Park" ;
trav:zip "20740" ;
trav:state "MD" ;
a trav:Location ] ;
trav:start
[ trav:streetAddress "BALTIMORE AVE" ;
a trav:Location ] ;
a trav:Connection ;
trav:distance "1.6" ;
trav:instructions "Arrive at destination." ]) ] .
[ a trav:Trip ;
trav:from
[ trav:streetAddress "BALTIMORE AVE" ;
a trav:Location ] ;
trav:to
[ trav:streetAddress "Campus" ;
trav:city "College Park" ;
trav:zip "20742" ;
trav:state "MD" ;
a trav:Location ] ;
trav:directions
([ trav:exit
[ trav:streetAddress "Campus Drive" ;
a trav:Location ] ;
trav:start
[ trav:streetAddress "BALTIMORE AVE" ;
a trav:Location ] ;
a trav:Connection ;
trav:distance "0.1" ;
trav:instructions "Turn right onto campus drive." ]
[ trav:exit
[ trav:streetAddress "Campus" ;
a trav:Location ] ;
trav:start
[ trav:streetAddress "Campus Drive" ;
a trav:Location ] ;
a trav:Connection ;
trav:distance "0.2" ;
trav:instructions "Arrive at the M." ]) ] .
@prefix daml: <http://www.daml.org/2001/03/daml+oil#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix sm: <http://www.wam.umd.edu/~krakatoa/cs828y/project/smartmap.daml#> .
@prefix trav: <http://www.wam.umd.edu/~krakatoa/cs828y/project/travel.daml#> .
@prefix : <#> .
[ a trav:Trip ;
trav:to
[ trav:streetAddress "Campus" ;
trav:city "College Park" ;
trav:zip "20742" ;
trav:state "MD" ;
a trav:Location ] ;
trav:from
[ trav:streetAddress "4910 Blackfoot RD" ;
trav:city "College Park" ;
trav:zip "20740" ;
trav:state "MD" ;
a trav:Location ] ] .
Most of the processing involves the travel ontology, which is for describing routes from one point to another. There is a SmartMap ontology, but it was not used for the project. Also, Location instances must be placed in a single namespace for proper querying. The middle tier does this by mangling and disambiguating address information to assign hopefully unique URIs to each Location. A more advanced method, using a Street class, would be preferred. Laks also has another ontology, not mentioned here, for storing Event points.
This is the ontology in N3. Please refer to the DAML file.
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix daml: <http://www.daml.org/2001/03/daml+oil#> .
@prefix dc: <http://purl.org/dc/elements/1.1/> .
@prefix : <http://www.wam.umd.edu/~krakatoa/cs828y/project/travel.daml#> .
<> a daml:Ontology;
rdfs:comment "An ontology for describing driving directions." ;
daml:imports <http://www.daml.org/2001/03/daml+oil> .
<> dc:title "A Map Ontology" ;
dc:description """Ontology for describing driving directions.
This defines three major daml:Classes:: Trip, for defining a route,
Location, for describing a place, and Connection, for connecting two
Locations (this is really just a multivariate property). It does not
include several important and necessary things: a Street class that would
be useful for computing new directions, any reference to things not
necessary for getting directions (like phone numbers or apartment
numbers), and any sort of concrete GIS stuff. """ .
:Trip a daml:Class ;
rdfs:label "Driving Directions" .
:to a daml:ObjectProperty ;
rdfs:label "to a location" ;
a daml:UniqueProperty ;
rdfs:domain :Trip ;
rdfs:range :Location .
:from a daml:ObjectProperty ;
rdfs:label "from a location" ;
a daml:UniqueProperty ;
rdfs:domain :Trip ;
rdfs:range :Location .
:directions a daml:ObjectProperty ;
rdfs:label "directions" ;
a daml:UniqueProperty ;
rdfs:domain :Trip ;
rdfs:range daml:List .
# How do you specify a List of something?
# It should be a list of <Connection>s.
# Should I make this unique?
:Location a daml:Class ;
rdfs:label "Location in space" .
:latitude a daml:DatatypeProperty ;
rdfs:domain :Location .
:longitude a daml:DatatypeProperty ;
rdfs:domain :Location .
:streetAddress a daml:DatatypeProperty ;
rdfs:comment "unlike :street and :number, this is clumped together" ;
rdfs:domain :Location .
:zip a daml:DatatypeProperty ;
rdfs:label "zip or postal code" ;
rdfs:domain :Location .
:state a daml:Property ;
rdfs:label "state or provence" ;
rdfs:comment """I suppose I should make this a datatype property
and have it reference some state ontology (like the US Region
ontology) but that seems overly restrictive. I don't want to sacrifice
genericity. Perhaps it really should be :locality. If it is an object,
the pretty printer will use its dc:title or rdfs:label if it exists,
otherwise it will use its URI. There is nothing stopping it from being
a :Location, as well. See also :zip, :city, and :country.""" ;
rdfs:domain :Location .
:city a daml:Property ;
rdfs:label "City or municipality" ;
rdfs:domain :Location .
:country a daml:Property ;
rdfs:label "country or state" ;
rdfs:domain :Location .
:hasConnection a daml:ObjectProperty ;
rdfs:label "connects to a point" ;
rdfs:domain :Location ;
rdfs:range :Connection .
:Connection a daml:Class ;
rdfs:label "describes a short hop in a journey" ;
rdfs:comment """Basically, this class is a holder since I cannot
have a multivariate predicate 'connectsTo'. Connections function as
semantically enhanced directed edges in the map graph.""" ;
rdfs:subClassOf
[ a daml:Restriction ;
daml:onProperty :exit ;
daml:cardinality "1" ] ,
[ a daml:Restriction ;
daml:onProperty :distance ;
daml:cardinality "1" ] ,
[ a daml:Restriction ;
daml:onProperty :time ;
daml:cardinality "1" ] .
:DriveAhead a daml:Class ;
rdfs:label "continue driving along" ;
rdfs:subClassOf :Connection .
:TurnLeft a daml:Class ;
rdfs:label "turn left onto" ;
rdfs:subClassOf :Connection .
:TurnRight a daml:Class ;
rdfs:label "turn right onto" ;
rdfs:subClassOf :Connection .
:TakeExit a daml:Class ;
rdfs:label "exit onto" ;
rdfs:subClassOf :Connection .
:exit a daml:ObjectProperty ;
rdfs:label "connects to" ;
rdfs:domain :Connection ;
rdfs:range :Location .
:distance a daml:DatatypeProperty ;
rdfs:label "distance in miles" ;
rdfs:domain :Connection .
:time a daml:DatatypeProperty ;
rdfs:label "number of seconds it takes to make the connection" ;
rdfs:domain :Connection .
:start a daml:ObjectProperty ;
rdfs:domain :Connection ;
rdfs:range :Location ;
daml:inverseOf :hasConnection .
:instructions a daml:DatatypeProperty ;
rdfs:comment "Describes how to make the turn and how far to drive" ;
rdfs:subPropertyOf dc:description ;
rdfs:domain :Connection .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix daml: <http://www.daml.org/2001/03/daml+oil#> .
@prefix dc: <http://purl.org/dc/elements/1.1/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix t: <http://www.wam.umd.edu/~krakatoa/cs828y/project/travel.daml#> .
@prefix : <http://www.wam.umd.edu/~krakatoa/cs828y/project/smartmap.daml#> .
<> a daml:Ontology;
rdfs:comment "Enhancements to an ontology for driving directions." ;
daml:imports <http://www.daml.org/2001/03/daml+oil> ;
daml:imports <http://www.wam.umd.edu/~krakatoa/cs828y/project/travel.daml> .
<> dc:title "The SmartMap Ontology" ;
dc:description """Ontology for describing enhanced driving
directions. This includes roads, time of day, date, person taking the
route, if the route was successful, as well as new classes, including a
Street class.""" .
:driver a daml:ObjectProperty ;
rdfs:label "driver" ;
rdfs:domain :Trip ;
rdfs:range foaf:Person .
:onStreet a daml:ObjectProperty ;
rdfs:label "on street" ;
rdfs:domain t:Location ;
rdfs:range :Street.
:number a daml:DatatypeProperty ;
rdfs:label "no." ;
rdfs:domain t:Location .
:Street a daml:Class ;
rdfs:label "street or highway" ;
rdfs:comment """A street or highway. Note that a street only has
one direction; 95N and 95S are two different streets, for example. This
means that if someone gets on a street, they can only be going one
way. This allows things like distance calculations to work. Also note
that some streets might be closed at some parts of the day, etc.""" .
:hasSegment a daml:ObjectProperty ;
rdfs:comment "Links a road back to its segments" ;
rdfs:inverseOf :alongRoad ;
rdfs:domain :Street ;
rdfs:range :Segment .
:Segment a daml:Class ;
rdfs:subClassOf t:Connection ;
rdfs:comment """Like a connection, but only along one road and may
be congealed with the final connection when displaying results. Note that
the exit will always be along the same road as the start location. Further
note that different segments may have different names, using
dc:title. """ .
:alongRoad a daml:ObjectProperty ;
rdfs:domain :Segment ;
rdfs:range :Street .