Bus Routes.

Slides:



Advertisements
Similar presentations
CH-4 Ontologies, Querying and Data Integration. Introduction to RDF(S) RDF stands for Resource Description Framework. RDF is a standard for describing.
Advertisements

RDF Tutorial.
 Copyright 2004 Digital Enterprise Research Institute. All rights reserved. SPARQL Query Language for RDF presented by Cristina Feier.
Dr. Jim Bowring Computer Science Department College of Charleston CSIS 690 (633) May Evening 2009 Semantic Web Principles and Practice Class 5: 27 May.
SPARQL for Querying PML Data Jitin Arora. Overview SPARQL: Query Language for RDF Graphs W3C Recommendation since 15 January 2008 Outline: Basic Concepts.
More RDF CS 431 – Carl Lagoze – Cornell University Acknowledgements: Eric Miller Dieter Fensel.
Chapter 7: Resource Description Framework (RDF) Service-Oriented Computing: Semantics, Processes, Agents – Munindar P. Singh and Michael N. Huhns, Wiley,
Chapter 3A Semantic Web Primer 1 Chapter 3 Querying the Semantic Web Grigoris Antoniou Paul Groth Frank van Harmelen Rinke Hoekstra.
Chapter 6 Understanding Each Other CSE 431 – Intelligent Agents.
Chapter 3 Querying RDF stores with SPARQL. Why an RDF Query Language? Why not use an XML query language? XML at a lower level of abstraction than RDF.
OWL 2 in use. OWL 2 OWL 2 is a knowledge representation language, designed to formulate, exchange and reason with knowledge about a domain of interest.
The Knowledge Presentation Language. Web Ontology Language (OWL)  Web Ontology Language (OWL) extends RDF and RDFS languages by adding several other.
Semantic Web Ontology Design Pattern Li Ding Department of Computer Science Rensselaer Polytechnic Institute October 3, 2007 Class notes for CSCI-6962.
Part I: Set Constructs. RDF Schema (RDFS) RDF does not provide mechanisms to define domain classes and properties RDFS is a vocabulary that provides many.
ISO TC184/SC4 contribution to REACH and LCA David Leal CAESAR Systems Limited and the impact of the Semantic Web on the.
Not only mark-up languages! There are other many other grammar formalisms and tools than XML. Some of them standardized (ASN). Even XML does not always.
ONTOLOGY ENGINEERING Lab #6 – October 6, The FILTER Keyword  Up to this point we’ve restricted the result set of a query by binding a variable.
Turtle – RDF Graph. Turtle – Basic Syntax Triples are terminated with a full stop URLs are encoded in angle brackets ( ) Literals are enclosed by double.
Mapping Guide Mapping Ontologies and Data Sets in RDF/RDFS/OWL2 Michel Böhms.
Chapter 7: Resource Description Framework (RDF) Service-Oriented Computing: Semantics, Processes, Agents – Munindar P. Singh and Michael N. Huhns, Wiley,
Semantic Web Exam 1 Review.
Part II. Property domain and range restriction RDFS allows us to put restriction on the properties by specifying their domain and range, providing the.
Of 35 lecture 5: rdf schema. of 35 RDF and RDF Schema basic ideas ece 627, winter ‘132 RDF is about graphs – it creates a graph structure to represent.
RDF Schema (RDFS) RDF user communities need to define the vocabularies (terms) to indicate that they  are describing specific kinds or classes of resources.
SPARQL In-Class Shared Exercise. Pop Quiz If you have a large knowledge store, why should you not issue: SELECT ?s ?p ?o WHERE { ?s ?p ?o } Ans: It returns.
Chapter 7: Resource Description Framework (RDF) Service-Oriented Computing: Semantics, Processes, Agents – Munindar P. Singh and Michael N. Huhns, Wiley,
Ch 7: RDF schema 현근수, 김영욱, 백상윤, 이용현 Team C. Introduction Semantic web modeling In RDF: simply creates graph structure to represent data In RDFS: about.
Practical RDF Chapter 12. Ontologies: RDF Business Models Shelley Powers, O’Reilly SNU IDB Lab. Taikyoung Kim.
Of 38 lecture 6: rdf – axiomatic semantics and query.
CC L A W EB DE D ATOS P RIMAVERA 2015 Lecture 10: Conclusion Aidan Hogan
CC L A W EB DE D ATOS P RIMAVERA 2015 Lecture 7: SPARQL (1.0) Aidan Hogan
Ontology Engineering Lab #4 - September 23, 2013.
Knowledge Technologies Manolis Koubarakis 1 Some Other Useful Features of RDF.
Semantic Interoperability in GIS N. L. Sarda Suman Somavarapu.
Semantic Web in Depth RDF Schema Dr Nicholas Gibbins –
SPARQL Query Andy Seaborne. Apache Jena he.org/jena ● Open source - Apache License ● Apache Incubator (accepted November 2010) ●
Knowledge Representation XI – IKT437 Part II OWL, SPARQL, …
Service-Oriented Computing: Semantics, Processes, Agents
Charlie Abela Department of Intelligent Computer Systems
Knowledge Representation Part V RDF
CC La Web de Datos Primavera 2017 Lecture 7: SPARQL [i]
SPARQL.
The Semantic Web Part 6. RDF Vocabularies: RDF Schema
Reasoning with Rules SWRL as Example
Chapter 3 RDF Schema.
Knowledge Representation Part VII Protégé / RDFS / OWL / ++
CC La Web de Datos Primavera Lecture 3: RDF Schema and Semantics
Service-Oriented Computing: Semantics, Processes, Agents
Introduction to the Semantic Web (tutorial) 2009 Semantic Technology Conference San Jose, California, USA June 15, 2009 Ivan Herman, W3C
Service-Oriented Computing: Semantics, Processes, Agents
Knowledge Representation Part II
“This presentation is for informational purposes only and may not be incorporated into a contract or agreement.”
Jan Pettersen Nytun, UiA
SPARQL + RDF Based on: Prof. Benny Kimelfled’s lecture notes
Semantic Interoperability and Knowledge Engineering: Use of GoodRelations in a Climbing Gear Retail Ontology Rebecca Tauber
SPARQL Exercise Much of this exercise has been copied from: INF3580/INF4580 – MANDATORY EXERCISE 3
Web Ontology Language: OWL
CC La Web de Datos Primavera 2016 Lecture 7: SPARQL (1.0)
Introduction to RDF and RDFS Editor: MR3
Hong Sun, AGFA Healthcare
How can DDI make the most of RDF?
ece 720 intelligent web: ontology and beyond
Linking Guide Michel Böhms.
SPARQL Exercise Most of this exercise has been copied from: INF3580/INF4580 – MANDATORY EXERCISE 3
G-CORE: A Core for Future Graph Query Languages
CHEAR (Child Health Environmental Assessment Resource) Ontology
Sheet 10 RDF (2).
Semantic Web Basics (cont.)
ece 720 intelligent web: ontology and beyond
Semantic-Web, Triple-Strores, and SPARQL
Presentation transcript:

Bus Routes

Consider an RDF document that contains information about bus companies and bus routes. A prefix named bus: identifies a given namespace (http://www.uia.no/ikt437/bus#). The data uses the following classes in the given namespace: BusCompany represents bus companies; a bus company owns buses and operates bus routes. BusStop represents bus stops along a bus route. A bus stop is a designated place where buses stop for passengers to board or leave a bus. BusStation represents bus stations, which can be origin or target of bus routes. A bus station is a special kind of bus stop. BusRoute represents bus routes. A route has an origin bus station (start bus station) and a target bus station (end bus station). We assume bus routes have unique labels (i.e., names). We also assume that routes are “one way routes”, e.g., if one route starts in Grimstad and ends in Oslo, a route going from Oslo to Grimstad must have another label (i.e., it is a different route).

The following properties are also used: rdfs:label links buss stations, bus stops, bus routes, etc., to their names bus:isOperatedBy links bus route to the bus company that operates it. bus:hasStartBusStation links a bus route to the bus station where the route starts. bus:hasEndBusStation links a bus route to the bus station where the route ends.

@prefix bus: <http://www. uia. no/ikt437/bus#> @prefix bus: <http://www.uia.no/ikt437/bus#> . @prefix owl: <http://www.w3.org/2002/07/owl#> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix xml: <http://www.w3.org/XML/1998/namespace> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . # Object Properties bus:hasEndBusStation rdf:type owl:ObjectProperty . bus:isOperatedBy rdf:type owl:ObjectProperty ; rdfs:domain bus:BusRoute; rdfs:range bus:BusCompany. bus:hasStartBusStation rdf:type owl:ObjectProperty . bus:hasStopAtBusStop rdf:type owl:ObjectProperty . # Classes bus:BusCompany rdf:type owl:Class . bus:BusRoute rdf:type owl:Class . bus:BusStation rdf:type owl:Class ; rdfs:subClassOf bus:BusStop . bus:BusStop rdf:type owl:Class . # Individuals bus:AgderExpressen rdf:type bus:BusCompany , owl:NamedIndividual ; rdfs:label "Agder Expressen"^^xsd:string . bus:ArendalBusStation rdf:type bus:BusStation , rdfs:label "Arendal Bus Station"^^xsd:string . bus:FevikBusStop rdf:type bus:BusStop , rdfs:label "Fevik Bus Stop"^^xsd:string . bus:GrimstadBusStop rdf:type bus:BusStop , rdfs:label "Grimstad Bus Stop"^^xsd:string . bus:KristiansandBusStation rdf:type bus:BusStation , rdfs:label "Kristiansand Bus Station"^^xsd:string . bus:Route_191_Skien_Kristiansand rdf:type bus:BusRoute , owl:NamedIndividual ; rdfs:label "Route 191 Skien Kristiansand"^^xsd:string ; bus:hasStopAtBusStop bus:FevikBusStop , bus:GrimstadBusStop ; bus:hasEndBusStation bus:KristiansandBusStation ; bus:hasStartBusStation bus:SkienBusStation ; bus:isOperatedBy bus:TelemarkExpressen . bus:Route_1_Kristiansand_Arendal rdf:type bus:BusRoute , owl:NamedIndividual ; rdfs:label "Route 1 Kristiansand Arendal"^^xsd:string ; bus:isOperatedBy bus:AgderExpressen ; bus:hasEndBusStation bus:ArendalBusStation ; bus:hasStopAtBusStop bus:FevikBusStop , bus:hasStartBusStation bus:KristiansandBusStation . bus:Route_2_Arendal_Kristiansand rdf:type bus:BusRoute , rdfs:label "Route 2 Arendal Kristiansand"^^xsd:string ; bus:isOperatedBy bus:AgderExpressen ; bus:hasStartBusStation bus:ArendalBusStation ; bus:hasStopAtBusStop bus:GrimstadBusStop ; bus:hasEndBusStation bus:KristiansandBusStation . bus:SkienBusStation rdf:type bus:BusStation , rdfs:label "Skien Bus Station"^^xsd:string . bus:TelemarkExpressen rdf:type bus:BusCompany , owl:NamedIndividual ; rdfs:label "Telemark Expressen"^^xsd:string . Attachment

Given Ontology Classes and Properties bus:hasEndBusStation rdf:type owl:ObjectProperty . bus:isOperatedBy rdf:type owl:ObjectProperty ; rdfs:domain bus:BusRoute; rdfs:range bus:BusCompany. bus:hasStartBusStation rdf:type owl:ObjectProperty . bus:hasStopAtBusStop rdf:type owl:ObjectProperty . Given Ontology Classes and Properties bus:BusCompany rdf:type owl:Class . bus:BusRoute rdf:type owl:Class . bus:BusStation rdf:type owl:Class ; rdfs:subClassOf bus:BusStop . bus:BusStop rdf:type owl:Class . owl:ObjectProperty type type type type isOperatedBy hasEndBusStation hasStartBusStation hasStopAtBusStop domain range subClassOf BusStation BusStop BusRoute BusCompany

Given Ontology Individuals type GrimstadBusStop label=“Grimstad Bus Stop" BusStop Given Ontology Individuals type FevikBusStop label=“Fevik Bus stop" ArendalBusStation label="Arendal Bus Station" AgderExpressen label="Agder Expressen" type type SkienBusStation label=“Skien Bus Station" type BusStation BusCompany type type KristiansandBusStation label=“Kristiansand Bus Station" TelemarkExpressen label=“Telemark Expressen"

Route_1_Kristiansand_Arendal label= "Route 1 Kristiansand Arendal" bus:Route_1_Kristiansand_Arendal rdf:type bus:BusRoute , owl:NamedIndividual ; rdfs:label "Route 1 Kristiansand Arendal"^^xsd:string ; bus:isOperatedBy bus:AgderExpressen ; bus:hasEndBusStation bus:ArendalBusStation ; bus:hasStopAtBusStop bus:FevikBusStop , bus:GrimstadBusStop ; bus:hasStartBusStation bus:KristiansandBusStation . KristiansandBusStation GrimstadBusStop FevikBusStop ArendalBusStation hasStopAtBusStop hasStopAtBusStop hasStartBusStation hasEndBusStation Route_1_Kristiansand_Arendal label= "Route 1 Kristiansand Arendal" isOperatedBy type BusRoute AgderExpressen

Route_2_Arendal_Kristiansand label= "Route 2 Arendal Kristiansand" bus:Route_2_Arendal_Kristiansand rdf:type bus:BusRoute , owl:NamedIndividual ; rdfs:label "Route 2 Arendal Kristiansand"^^xsd:string ; bus:isOperatedBy bus:AgderExpressen ; bus:hasStartBusStation bus:ArendalBusStation ; bus:hasStopAtBusStop bus:GrimstadBusStop ; bus:hasEndBusStation bus:KristiansandBusStation .   ArendalBusStation GrimstadBusStop KristiansandBusStation hasStopAtBusStop hasEndBusStation hasStartBusStation Route_2_Arendal_Kristiansand label= "Route 2 Arendal Kristiansand" isOperatedBy type BusRoute AgderExpressen

b) Make and try a SPARQL query that lists all the bus routes (i. e b) Make and try a SPARQL query that lists all the bus routes (i.e., list the rdfs:labels of the bus routes) together with the bus company that operates it.

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> b) Make and try a SPARQL query that lists all the bus routes (i.e., list the rdfs:labels of the bus routes) together with the bus company that operates it. PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX owl: <http://www.w3.org/2002/07/owl#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX bus: <http://www.uia.no/ikt437/bus#> SELECT ?busCompany ?busRoute WHERE { ?busRoute bus:isOperatedBy ?busCompany. ?busRoute a bus:BusRoute } ?busRoute type isOperatedBy BusRoute ?busCompany

c) Make a SPARQL query that lists all bus stops (i. e c) Make a SPARQL query that lists all bus stops (i.e., list the rdfs:labels of the bus stops); avoid duplicates. Do not list bus stations.

c) Make a SPARQL query that lists all bus stops (i. e c) Make a SPARQL query that lists all bus stops (i.e., list the rdfs:labels of the bus stops); avoid duplicates. Do not list bus stations. PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX owl: <http://www.w3.org/2002/07/owl#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX bus: <http://www.uia.no/ikt437/bus#> SELECT DISTINCT ?busStopLabel WHERE { ?busStop a bus:BusStop ; rdfs:label ?busStopLabel . }

d) Make a SPARQL query that lists all bus stops (i. e d) Make a SPARQL query that lists all bus stops (i.e., list the rdfs:labels of the bus stops) of the bus routes (i.e., a bus stop must be a stop on a bus route). List in alphabetic order and avoid duplicates. All bus stops should be listed except the one with rdfs:label "Fevik Bus Stop"^^xsd:string. Do not list bus stations.

d) Make a SPARQL query that lists all bus stops (i. e d) Make a SPARQL query that lists all bus stops (i.e., list the rdfs:labels of the bus stops) of the bus routes (i.e., a bus stop must be a stop on a bus route). List in alphabetic order and avoid duplicates. All bus stops should be listed except the one with rdfs:label "Fevik Bus Stop"^^xsd:string. Do not list bus stations. PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX owl: <http://www.w3.org/2002/07/owl#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX bus: <http://www.uia.no/ikt437/bus#> SELECT DISTINCT ?busStopLabel WHERE { ?busStop a bus:BusStop ; rdfs:label ?busStopLabel . ?busRoute a bus:BusRoute; bus:hasStopAtBusStop ?busStop . FILTER (?busStopLabel != "Fevik Bus Stop"^^xsd:string) } ORDER BY (?busStopLabel)

e) Make a SPARQL query that lists all the bus stops of bus route "Route 1 Kristiansand Arendal"^^xsd:string (this is the identifying label of the bus route) together with the bus company that operates it. The start and end bus stations should not be listed.

e) Make a SPARQL query that lists all the bus stops of bus route "Route 1 Kristiansand Arendal"^^xsd:string (this is the identifying label of the bus route) together with the bus company that operates it. The start and end bus stations should not be listed. PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX owl: <http://www.w3.org/2002/07/owl#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX bus: <http://www.uia.no/ikt437/bus#> SELECT ?busStop ?busCompany WHERE { ?busRoute rdfs:label "Route 1 Kristiansand Arendal"^^xsd:string . ?busRoute bus:hasStopAtBusStop ?busStop . ?busRoute bus:isOperatedBy ?busCompany . }

f) Make a SPARQL query that lists all the bus stops of bus route "Route 1 Kristiansand Arendal"^^xsd:string (this is the identifying label of the bus route) together with the bus company that operates it. List also start and end bus stations. “SPARQL provides a means of combining graph patterns so that one of several alternative graph patterns may match. If more than one of the alternatives matches, all the possible pattern solutions are found. Pattern alternatives are syntactically specified with the UNION keyword.”[1] Use the UNION construct when solving this task.

f) Make a SPARQL query that lists all the bus stops of bus route "Route 1 Kristiansand Arendal"^^xsd:string (this is the identifying label of the bus route) together with the bus company that operates it. List also start and end bus stations. PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX owl: <http://www.w3.org/2002/07/owl#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX bus: <http://www.uia.no/ikt437/bus#> SELECT ?busStop ?busCompany WHERE { ?busRoute rdfs:label "Route 1 Kristiansand Arendal"^^xsd:string . ?busRoute bus:isOperatedBy ?busCompany . { ?busRoute bus:hasStopAtBusStop ?busStop } UNION { ?busRoute bus:hasStartBusStation ?busStop } { ?busRoute bus:hasEndBusStation ?busStop } }

g) You are to achieve the same as in the point above (… lists all the bus stops of bus route "Route 1 Kristiansand Arendal" …), but this time don’t use UNION but use arbitrary length path matching. “Connectivity between the subject and object by a property path of arbitrary length can be found using the "zero or more" property path operator, *, and the "one or more" property path operator, +.”[1] Hint: You need to add two rdfs:subPropertyOf to your ontology and then you use the * operator in your SPARQL statement.

Make a SPARQL query that lists all the bus stops of bus route "Route 1 Kristiansand Arendal"^^xsd:string together with the bus company that operates it. List also start and end bus stations. PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX owl: <http://www.w3.org/2002/07/owl#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX bus: <http://www.uia.no/ikt437/bus#> SELECT ?busStop ?busCompany WHERE { ?busRoute rdfs:label "Route 1 Kristiansand Arendal"^^xsd:string . ?busRoute bus:isOperatedBy ?busCompany . ?property rdfs:subPropertyOf * bus:hasStopAtBusStop . ?busRoute ?property ?busStop }

Choose route to be Route 1 Kristiansand Arendal and find the operating bus company. WHERE { ?busRoute rdfs:label "Route 1 Kristiansand Arendal"^^xsd:string . ?busRoute bus:isOperatedBy ?busCompany . ?property rdfs:subPropertyOf * bus:hasStopAtBusStop . ?busRoute ?property ?busStop

Route_1_Kristiansand_Arendal label= "Route 1 Kristiansand Arendal" Only Route_1_Kristiansand_Arendal has “Route 1 Kristiansand Arendal” as label. WHERE { ?busRoute rdfs:label "Route 1 Kristiansand Arendal"^^xsd:string . ?busRoute bus:isOperatedBy ?busCompany . ?property rdfs:subPropertyOf * bus:hasStopAtBusStop . ?busRoute ?property ?busStop }

Route_1_Kristiansand_Arendal label= "Route 1 Kristiansand Arendal" isOperatedBy type BusRoute AgderExpressen Only one match for ?busRoute and ?busCompany together WHERE {Route_1_Kristiansand_Arendal rdfs:label "Route 1 Kristiansand Arendal"^^xsd:string . Route_1_Kristiansand_Arendal bus:isOperatedBy AgderExpressen . ?property rdfs:subPropertyOf * bus:hasStopAtBusStop . Route_1_Kristiansand_Arendal ?property ?busStop }

owl:ObjectProperty type type type owl:ObjectProperty hasEndBusStation hasStartBusStation hasStopAtBusStop type type type hasStopAtBusStop subPropertyOf subPropertyOf hasEndBusStation hasStartBusStation WHERE { ... ?property rdfs:subPropertyOf * bus:hasStopAtBusStop . Route_1_Kristiansand_Arendal ?property ?busStop

“rdfs:subPropertyOf * bus:hasStopAtBusStop” has 3 matches owl:ObjectProperty type type type hasStopAtBusStop subPropertyOf subPropertyOf hasEndBusStation hasStartBusStation “rdfs:subPropertyOf * bus:hasStopAtBusStop” has 3 matches ?property will be bound to properties (one at a time): hasStopAtBusStop, hasEndBusStation and hasStartBusStation WHERE { ... ?property rdfs:subPropertyOf * bus:hasStopAtBusStop . Route_1_Kristiansand_Arendal ?property ?busStop

Route_1_Kristiansand_Arendal label= "Route 1 Kristiansand Arendal" KristiansandBusStation GrimstadBusStop FevikBusStop ArendalBusStation hasStopAtBusStop hasStopAtBusStop hasStartBusStation hasEndBusStation Route_1_Kristiansand_Arendal label= "Route 1 Kristiansand Arendal" ?property can be hasStopAtBusStop, hasEndBusStation and hasStartBusStation ?busStop will then match: KristiansandBusStation, GrimstadBusStop, FevikBusStop, ArendalBusStation WHERE { ... ?property rdfs:subPropertyOf * bus:hasStopAtBusStop . Route_1_Kristiansand_Arendal ?property ?busStop

h) One and the same bus route can have several departures the same day; the number of departures and the departure times may vary from weekday to weekday. We simplify: We ignore public holidays, etc.; this means that there are only seven alternatives (one for each day of the week) for the daily scheduling of a bus route. We ignore rush hours. i.e., the time from one bus stop until the next is always the same. We handle time by just counting minutes since midnight. E.g., time 62 is two minutes past one in the night. (A bus route always stops on the same stops.) The stored information can be used to: Calculate the total time a route takes from start to end bus station. Calculate the total time a route takes from a selected bus stop on a route to another bus stop at the same route. Show the time schedule for a route (i.e., time from stop to stop of a route) given a start time.   Use OWL and model the information needed (this should be an extension of the ontology shown in the Attachment). Insert an example of one or more routes. Make SPARQL statements that give the information stated in point 1, 2 and 3 above.

First: Use OWL and model the information needed (this should be an extension of the ontology shown in the Attachment). Insert an example of one or more routes.

Route_1_Kristiansand_Arendal label= "Route 1 Kristiansand Arendal" KristiansandBusStation GrimstadBusStop FevikBusStop ArendalBusStation hasStopAtBusStop hasEndBusStation hasStopAtBusStop hasStartBusStation Route_1_Kristiansand_Arendal label= "Route 1 Kristiansand Arendal" isOperatedBy AgderExpressen type hasRouteDay hasRouteDay BusRoute route1DayMonday hasOnWeekDay = “Monday“ hasDepatureTime=345 hasDepatureTime=405 hasDepatureTime=465 route1DaySunday hasOnWeekDay = “Sunday“ hasDepatureTime=600 hasDepatureTime=720 New type type RouteDay

Route_1_Kristiansand_Arendal label= "Route 1 Kristiansand Arendal" KristiansandBusStation GrimstadBusStop FevikBusStop ArendalBusStation hasStopAtBusStop hasStopAtBusStop hasStartBusStation hasEndBusStation Route_1_Kristiansand_Arendal label= "Route 1 Kristiansand Arendal" isOperatedBy hasStopTime- Intervals type intervalsRoute1 BusRoute AgderExpressen type New StopTimeIntervals

KristiansandBusStation GrimstadBusStop FevikBusStop ArendalBusStation hasStopAt- BusStop hasStopAt- BusStop hasStopAt- BusStop hasStopAt- BusStop hasNextBusRouteStop hasNextBusRouteStop hasNextBusRouteStop route1Stop1 hasRouteStopNumber=0 hasTimeFromStart=0 route1Stop2 hasRouteStopNumber=1 hasTimeFromStart=60 route1Stop3 hasRouteStopNumber=2 hasTimeFromStart=74 route1Stop4 hasRouteStopNumber=3 hasTimeFromStart=104 type type type type hasFirstBusRouteStop BusRouteStop intervalsRoute1 New Old class BusStop is about location; a place where the bus may stop. The new class BusRouteStop is a stop on a route.

1. Calculate the total time a route takes from start to end bus station. Strategy find last stop (the one that has no :hasNextBusRouteStop property) and show its value of :hasTimeFromStart. We select route: Route_1_Kristiansand_Arendal

PREFIX : <http://www. uia PREFIX : <http://www.uia.no/ikt437/bus#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX owl: <http://www.w3.org/2002/07/owl#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> SELECT ?time WHERE { :Route_1_Kristiansand_Arendal :hasStopTimeIntervals ?stopTimeIntervals . ?stopTimeIntervals :hasFirstBusRouteStop ?firstRouteStop . ?firstRouteStop :hasNextBusRouteStop* ?stop . ?stop :hasTimeFromStart ?time . Minus { ?stop :hasNextBusRouteStop ?dummy . } }

2. Calculate the total time a route takes from a selected bus stop on a route to another bus stop on the same route. We select route: Route_1_Kristiansand_Arendal Get time from stop 1 (Grimstad) until 2 (Fevik)

PREFIX : <http://www. uia PREFIX : <http://www.uia.no/ikt437/bus#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX owl: <http://www.w3.org/2002/07/owl#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> SELECT ((MAX(?time) - MIN(?time)) AS ?timeDiff) WHERE { :Route_1_Kristiansand_Arendal :hasStopTimeIntervals ?stopTimeIntervals . ?stopTimeIntervals :hasFirstBusRouteStop ?firstRouteStop . ?firstRouteStop :hasNextBusRouteStop* ?stop . ?stop :hasTimeFromStart ?time . ?stop :hasRouteStopNumber ?stopNumber . FILTER (?stopNumber = 1 || ?stopNumber = 2 ) }

Solution if interval times are stored (i. e Solution if interval times are stored (i.e., property hasTimeToNextStop is used) instead of hasTimeFromStart . Selecting :Route_1_Kristiansand_Arendal and time from stop 2 to 4: PREFIX : <http://www.uia.no/ikt437/bus#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX owl: <http://www.w3.org/2002/07/owl#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> SELECT (SUM (?time) AS ?total) WHERE { :Route_1_Kristiansand_Arendal :hasStopTimeIntervals ?stopTimeIntervals . ?stopTimeIntervals :hasFirstBusRouteStop ?firstRouteStop . ?firstRouteStop :hasNextBusRouteStop* ?stop . ?stop :hasTimeToNextStop ?time . ?stop :hasRouteStopNumber ?stopNumber . FILTER (?stopNumber >= 1 ) FILTER (?stopNumber <= 3 ) }

3. Show the time schedule for a route (i. e 3. Show the time schedule for a route (i.e., time from stop to stop of a route) given a start time. Selecting: Route_1_Kristiansand_Arendal, route on Monday and departure 405. Assuming start time is the same as a specific departure time for this route on this day (in my ontology 405 is such a time).

PREFIX : <http://www. uia PREFIX : <http://www.uia.no/ikt437/bus#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX owl: <http://www.w3.org/2002/07/owl#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> SELECT ?stopTime ?routeStopLabel WHERE { BIND (:Route_1_Kristiansand_Arendal as ?input_route) BIND ("Monday"^^xsd:string as ?input_dayOfWeek) BIND ("405"^^xsd:int as ?input_startTimeForSchedule) ?input_route :hasRouteDay ?routeDay . ?routeDay :hasOnWeekDay ?input_dayOfWeek . ?routeDay :hasDepatureTime ?input_startTimeForSchedule . ?input_route :hasStopTimeIntervals ?stopTimeIntervals . ?stopTimeIntervals :hasFirstBusRouteStop ?firstRouteStop . ?firstRouteStop :hasNextBusRouteStop* ?stop . ?stop :hasTimeFromStart ?time . ?stop :hasStopAtBusStop ?busStop . ?busStop rdfs:label ?routeStopLabel . BIND ((?input_startTimeForSchedule+?time) as ?stopTime) } ORDER BY ?stopTime The use of BIND is only to indicate that :Route_1_Kristiansand_Arendal, "Monday“ and "405“ are input values.

New Ontology: @prefix : <http://www.uia.no/ikt437/bus#> . @prefix owl: <http://www.w3.org/2002/07/owl#> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix xml: <http://www.w3.org/XML/1998/namespace> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @base <http://www.uia.no/ikt437/bus> . <http://www.uia.no/ikt437/bus> rdf:type owl:Ontology .

Object Properties :hasEndBusStation rdf:type owl:ObjectProperty ; rdfs:subPropertyOf :hasStopAtBusStop . :hasFirstBusRouteStop rdf:type owl:ObjectProperty ; rdfs:subPropertyOf owl:topObjectProperty . :hasNextBusRouteStop rdf:type owl:ObjectProperty ; rdfs:domain :BusRouteStop ; rdfs:range :BusRouteStop . :hasRouteDay rdf:type owl:ObjectProperty . :hasStartBusStation rdf:type owl:ObjectProperty ; rdfs:subPropertyOf :hasStopAtBusStop . :hasStopAtBusStop rdf:type owl:ObjectProperty . :hasStopTimeIntervals rdf:type owl:ObjectProperty . :isLocatedAtBusStop rdf:type owl:ObjectProperty ; rdfs:range :BusStop . :isOperatedBy rdf:type owl:ObjectProperty ; rdfs:domain :BusRoute ; rdfs:range :BusCompany .

# Data properties ################################################################# ### http://www.uia.no/ikt437/bus#hasDepatureTime :hasDepatureTime rdf:type owl:DatatypeProperty ; rdfs:range xsd:int . ### http://www.uia.no/ikt437/bus#hasOnWeekDay :hasOnWeekDay rdf:type owl:DatatypeProperty ; rdfs:range xsd:string . ### http://www.uia.no/ikt437/bus#hasRouteStopNumber :hasRouteStopNumber rdf:type owl:DatatypeProperty ; ### http://www.uia.no/ikt437/bus#hasTimeFromStart :hasTimeFromStart rdf:type owl:DatatypeProperty ; rdfs:range xsd:integer .

# Classes ### http://www. uia # Classes ### http://www.uia.no/ikt437/bus#BusCompany :BusCompany rdf:type owl:Class . ### http://www.uia.no/ikt437/bus#BusRoute :BusRoute rdf:type owl:Class . ### http://www.uia.no/ikt437/bus#BusRouteStop :BusRouteStop rdf:type owl:Class . ### http://www.uia.no/ikt437/bus#BusStation :BusStation rdf:type owl:Class ; rdfs:subClassOf :BusStop . ### http://www.uia.no/ikt437/bus#BusStop :BusStop rdf:type owl:Class . ### http://www.uia.no/ikt437/bus#RouteDay :RouteDay rdf:type owl:Class . ### http://www.uia.no/ikt437/bus#StopTimeIntervals :StopTimeIntervals rdf:type owl:Class .

# Individuals ################################################################# ### http://www.uia.no/ikt437/bus#AgderExpressen :AgderExpressen rdf:type owl:NamedIndividual , :BusCompany ; rdfs:label "Agder Expressen"^^xsd:string . ### http://www.uia.no/ikt437/bus#ArendalBusStation :ArendalBusStation rdf:type owl:NamedIndividual , :BusStation ; rdfs:label "Arendal Bus Station"^^xsd:string . ### http://www.uia.no/ikt437/bus#FevikBusStop :FevikBusStop rdf:type owl:NamedIndividual , :BusStop ; rdfs:label "Fevik Bus Stop"^^xsd:string . ### http://www.uia.no/ikt437/bus#GrimstadBusStop :GrimstadBusStop rdf:type owl:NamedIndividual , rdfs:label "Grimstad Bus Stop"^^xsd:string . ### http://www.uia.no/ikt437/bus#KristiansandBusStation :KristiansandBusStation rdf:type owl:NamedIndividual , rdfs:label "Kristiansand Bus Station"^^xsd:string . ### http://www.uia.no/ikt437/bus#Route_191_Skien_Kristiansand :Route_191_Skien_Kristiansand rdf:type owl:NamedIndividual , :BusRoute ; :hasEndBusStation :KristiansandBusStation ; :hasStartBusStation :SkienBusStation ; :hasStopAtBusStop :FevikBusStop , :GrimstadBusStop ; :isOperatedBy :TelemarkExpressen ; rdfs:label "Route 191 Skien Kristiansand"^^xsd:string . ### http://www.uia.no/ikt437/bus#Route_1_Kristiansand_Arendal :Route_1_Kristiansand_Arendal rdf:type owl:NamedIndividual , :hasEndBusStation :ArendalBusStation ; :hasRouteDay :route1DayMonday , :route1DaySunday ; :hasStartBusStation :KristiansandBusStation ; :hasStopTimeIntervals :intervalsRoute1 ; :isOperatedBy :AgderExpressen ; rdfs:label "Route 1 Kristiansand Arendal"^^xsd:string . ### http://www.uia.no/ikt437/bus#Route_2_Arendal_Kristiansand :Route_2_Arendal_Kristiansand rdf:type owl:NamedIndividual , :hasStartBusStation :ArendalBusStation ; :hasStopAtBusStop :GrimstadBusStop ; rdfs:label "Route 2 Arendal Kristiansand"^^xsd:string . ### http://www.uia.no/ikt437/bus#SkienBusStation :SkienBusStation rdf:type owl:NamedIndividual , rdfs:label "Skien Bus Station"^^xsd:string . ### http://www.uia.no/ikt437/bus#TelemarkExpressen :TelemarkExpressen rdf:type owl:NamedIndividual , rdfs:label "Telemark Expressen"^^xsd:string . ### http://www.uia.no/ikt437/bus#intervalsRoute1 :intervalsRoute1 rdf:type owl:NamedIndividual , :StopTimeIntervals ; :hasFirstBusRouteStop :route1Stop1 . ### http://www.uia.no/ikt437/bus#route190DayMonday :route190DayMonday rdf:type owl:NamedIndividual , :RouteDay ; :hasOnWeekDay "Monday"^^xsd:string . ### http://www.uia.no/ikt437/bus#route1DayMonday :route1DayMonday rdf:type owl:NamedIndividual , :hasDepatureTime "345"^^xsd:int , "405"^^xsd:int , "465"^^xsd:int ; ### http://www.uia.no/ikt437/bus#route1DaySunday :route1DaySunday rdf:type owl:NamedIndividual , :hasDepatureTime "600"^^xsd:int , "720"^^xsd:int ; :hasOnWeekDay "Sunday"^^xsd:string . ### http://www.uia.no/ikt437/bus#route1Stop1 :route1Stop1 rdf:type owl:NamedIndividual , :BusRouteStop ; :hasNextBusRouteStop :route1Stop2 ; :hasStopAtBusStop :KristiansandBusStation ; :hasRouteStopNumber "0"^^xsd:int ; :hasTimeFromStart "0"^^xsd:int . ### http://www.uia.no/ikt437/bus#route1Stop2 :route1Stop2 rdf:type owl:NamedIndividual , :hasNextBusRouteStop :route1Stop3 ; :hasRouteStopNumber "1"^^xsd:int ; :hasTimeFromStart "60"^^xsd:int . ### http://www.uia.no/ikt437/bus#route1Stop3 :route1Stop3 rdf:type owl:NamedIndividual , :hasNextBusRouteStop :route1Stop4 ; :hasStopAtBusStop :FevikBusStop ; :hasRouteStopNumber "2"^^xsd:int ; :hasTimeFromStart "74"^^xsd:int . ### http://www.uia.no/ikt437/bus#route1Stop4 :route1Stop4 rdf:type owl:NamedIndividual , :hasStopAtBusStop :ArendalBusStation ; :hasRouteStopNumber "3"^^xsd:int ; :hasTimeFromStart "104"^^xsd:int . ### Generated by the OWL API (version 4.2.5.20160517-0735) https://github.com/owlcs/owlapi