From 2604ea6f2dbd2e051f633e32da0d227f238da4da Mon Sep 17 00:00:00 2001 From: Florian Kleedorfer Date: Thu, 23 May 2019 15:56:11 +0200 Subject: [PATCH] Apply rename 005, adapt to change in sockets --- .../bot/action/CreateFactoryOfferAction.java | 18 +++++----- .../resources/FactoryAtoms/taxi-service.trig | 32 +++++++++-------- .../resources/FactoryAtoms/taxi-service.ttl | 36 ++++++++++--------- .../resources/temp/fromLocationRetrieval.rq | 5 +-- .../src/main/resources/temp/goals.trig | 5 +-- .../main/resources/temp/goals_withoutmax.trig | 5 +-- .../resources/temp/toLocationRetrieval.rq | 5 +-- .../taxi/bot/client/MobileBookingTest.java | 13 ++++++- 8 files changed, 70 insertions(+), 49 deletions(-) diff --git a/won-taxi-bot/src/main/java/won/transport/taxi/bot/action/CreateFactoryOfferAction.java b/won-taxi-bot/src/main/java/won/transport/taxi/bot/action/CreateFactoryOfferAction.java index 72ae066..adead76 100644 --- a/won-taxi-bot/src/main/java/won/transport/taxi/bot/action/CreateFactoryOfferAction.java +++ b/won-taxi-bot/src/main/java/won/transport/taxi/bot/action/CreateFactoryOfferAction.java @@ -15,6 +15,7 @@ */ package won.transport.taxi.bot.action; +import won.protocol.vocabulary.WONMATCH; import org.apache.commons.lang3.StringUtils; import org.apache.jena.query.Dataset; @@ -35,7 +36,6 @@ import won.protocol.exception.WonMessageBuilderException; import won.protocol.message.WonMessage; import won.protocol.message.WonMessageBuilder; -import won.protocol.model.AtomContentPropertyType; import won.protocol.model.AtomGraphType; import won.protocol.service.WonNodeInformationService; import won.protocol.util.DefaultAtomModelWrapper; @@ -120,14 +120,16 @@ private Model createFactoryOfferFromTemplate(EventListenerContext ctx, URI facto DefaultAtomModelWrapper atomModelWrapper = new DefaultAtomModelWrapper(ctx.getWonNodeInformationService().generateAtomURI(ctx.getNodeURISource().getNodeURI()).toString()); - atomModelWrapper.setTitle(AtomContentPropertyType.IS, connectTitle); + atomModelWrapper.setTitle(connectTitle); //atomModelWrapper.setDescription(AtomContentPropertyType.IS, "This is a automatically created atom by the TaxiBot"); - atomModelWrapper.addFlag(WON.NoHintForCounterpart); - atomModelWrapper.addFlag(WON.NoHintForMe); + atomModelWrapper.addFlag(WONMATCH.NoHintForCounterpart); + atomModelWrapper.addFlag(WONMATCH.NoHintForMe); atomModelWrapper.setShapesGraphReference(STUB_SHAPES_URI); - for(URI socket : sockets){ - atomModelWrapper.addSocketUri(socket.toString()); + int i = 1; + for (URI socket : sockets) { + atomModelWrapper.addSocket("#socket" + i, socket.toString()); + i++; } return atomModelWrapper.copyAtomModel(AtomGraphType.ATOM); @@ -147,8 +149,8 @@ private WonMessage createWonMessage( AtomModelWrapper atomModelWrapper = new AtomModelWrapper(atomModel, null); - atomModelWrapper.addFlag(WON.NoHintForMe); - atomModelWrapper.addFlag(WON.NoHintForCounterpart); + atomModelWrapper.addFlag(WONMATCH.NoHintForMe); + atomModelWrapper.addFlag(WONMATCH.NoHintForCounterpart); RdfUtils.replaceBaseURI(atomModel, atomURI.toString()); diff --git a/won-taxi-bot/src/main/resources/FactoryAtoms/taxi-service.trig b/won-taxi-bot/src/main/resources/FactoryAtoms/taxi-service.trig index 166f58c..4c380bc 100644 --- a/won-taxi-bot/src/main/resources/FactoryAtoms/taxi-service.trig +++ b/won-taxi-bot/src/main/resources/FactoryAtoms/taxi-service.trig @@ -1,3 +1,5 @@ +@prefix con: . +@prefix match: . @prefix msg: . @prefix conn: . @prefix atom: . @@ -27,20 +29,20 @@ { olntest:taxiService1 a won:Atom ; - won:flag won:NoHintForCounterpart ; + match:flag match:NoHintForCounterpart ; won:hasSearchString "search-lift" ; won:is [ dc:description "next 10 minutes" ; dc:title "Taxi in Wien"@de ; dc:description "Biete Taxidienstleistungen im Raum Wien und Umgebung"@de ; dc:title "Taxi in Vienna"@en ; dc:description "Offering taxi services in Vienna and around"@en ; - won:tag "Taxi", "PersonenTransport"@de, "People transport"@en ; + con:tag "Taxi", "PersonenTransport"@de, "People transport"@en ; won:location [ a s:Place ; - won:boundingBox [ won:northWestCorner [ a s:GeoCoordinates ; + con:boundingBox [ con:northWestCorner [ a s:GeoCoordinates ; s:latitude "48.199528" ; s:longitude "16.355209" ] ; - won:southEastCorner [ a s:GeoCoordinates ; + con:southEastCorner [ a s:GeoCoordinates ; s:latitude "48.218489" ; s:longitude "16.384895" ] @@ -53,8 +55,8 @@ s:name "Vienna, Austria"@en ] ] ; - won:seeks [ - won:seeks [ + match:seeks [ + match:seeks [ dc:title "Taxi"; won:location [ s:geo [ @@ -66,8 +68,8 @@ ]; ] ]; - won:seeks [ - won:seeks [ + match:seeks [ + match:seeks [ dc:description "Taxi"; won:location [ s:geo [ @@ -79,9 +81,9 @@ ]; ] ]; - won:seeks [ - won:seeks [ - won:tag "Taxi"; + match:seeks [ + match:seeks [ + con:tag "Taxi"; won:location [ s:geo [ a s:GeoCoordinates ; @@ -92,13 +94,13 @@ ]; ] ]; - won:seeks [ - won:seeks [ + match:seeks [ + match:seeks [ dc:title "Taxi Wien" ] ]; - won:seeks [ - won:seeks [ + match:seeks [ + match:seeks [ dc:description "Taxi Wien" ] ]. diff --git a/won-taxi-bot/src/main/resources/FactoryAtoms/taxi-service.ttl b/won-taxi-bot/src/main/resources/FactoryAtoms/taxi-service.ttl index 0bcb003..c2ece8b 100644 --- a/won-taxi-bot/src/main/resources/FactoryAtoms/taxi-service.ttl +++ b/won-taxi-bot/src/main/resources/FactoryAtoms/taxi-service.ttl @@ -1,3 +1,5 @@ +@prefix con: . +@prefix match: . @prefix dc: . @prefix won: . @prefix s: . @@ -5,22 +7,22 @@ oln-test:taxiService1 a won:Atom; a s:TaxiService; - won:flag won:NoHintForCounterpart; + match:flag match:NoHintForCounterpart; won:is [ dc:title "Taxi in Wien"@de; dc:description "Biete Taxidienstleistungen im Raum Wien und Umgebung"@de; dc:title "Taxi in Vienna"@en; dc:description "Offering taxi services in Vienna and around"@en; - won:tag "Taxi", "PersonenTransport"@de, "People transport"@en; + con:tag "Taxi", "PersonenTransport"@de, "People transport"@en; won:location [ a s:Place ; - won:boundingBox [ - won:northWestCorner [ + con:boundingBox [ + con:northWestCorner [ a s:GeoCoordinates ; s:latitude "48.199528" ; s:longitude "16.355209" ] ; - won:southEastCorner [ + con:southEastCorner [ a s:GeoCoordinates ; s:latitude "48.218489" ; s:longitude "16.384895" @@ -28,7 +30,7 @@ oln-test:taxiService1 ] ; s:geo [ a s:GeoCoordinates ; - won:geoSpatial "48.220210#16.371216"^^ ; + con:geoSpatial "48.220210#16.371216"^^ ; s:latitude "48.220210" ; s:longitude "16.371216" ] ; @@ -36,8 +38,8 @@ oln-test:taxiService1 s:name "Vienna, Austria"@en ] ]; - won:seeks [ - won:seeks [ + match:seeks [ + match:seeks [ dc:title "Taxi"; won:location [ s:geo [ @@ -49,8 +51,8 @@ oln-test:taxiService1 ]; ] ]; - won:seeks [ - won:seeks [ + match:seeks [ + match:seeks [ dc:description "Taxi"; won:location [ s:geo [ @@ -62,9 +64,9 @@ oln-test:taxiService1 ]; ] ]; - won:seeks [ - won:seeks [ - won:tag "Taxi"; + match:seeks [ + match:seeks [ + con:tag "Taxi"; won:location [ s:geo [ a s:GeoCoordinates ; @@ -74,13 +76,13 @@ oln-test:taxiService1 s:name "Wien" ]; ]; - won:seeks [ - won:seeks [ + match:seeks [ + match:seeks [ dc:title "Taxi Wien" ] ]; - won:seeks [ - won:seeks [ + match:seeks [ + match:seeks [ dc:description "Taxi Wien" ] ]; diff --git a/won-taxi-bot/src/main/resources/temp/fromLocationRetrieval.rq b/won-taxi-bot/src/main/resources/temp/fromLocationRetrieval.rq index a0f8aa4..5584e61 100644 --- a/won-taxi-bot/src/main/resources/temp/fromLocationRetrieval.rq +++ b/won-taxi-bot/src/main/resources/temp/fromLocationRetrieval.rq @@ -1,3 +1,4 @@ +PREFIX con: prefix s: prefix won: @@ -5,8 +6,8 @@ Select ?lat ?lon where { ?main a s:Place; - won:boundingBox ?boundingBox . - ?boundingBox won:northWestCorner ?geoCoordinates . + con:boundingBox ?boundingBox . + ?boundingBox con:northWestCorner ?geoCoordinates . ?geoCoordinates s:latitude ?lat; s:longitude ?lon. } \ No newline at end of file diff --git a/won-taxi-bot/src/main/resources/temp/goals.trig b/won-taxi-bot/src/main/resources/temp/goals.trig index 1bb5ffc..d3b87c3 100644 --- a/won-taxi-bot/src/main/resources/temp/goals.trig +++ b/won-taxi-bot/src/main/resources/temp/goals.trig @@ -1,3 +1,4 @@ +@prefix con: . @prefix xsd: . @prefix s: . @prefix sh: . @@ -23,13 +24,13 @@ ex2:p2g-shapes { sh:closed false ; sh:ignoredProperties ( rdf:type ) ; sh:property [ - sh:path (won:boundingBox won:southEastCorner); + sh:path (con:boundingBox con:southEastCorner); sh:class s:GeoCoordinates ; sh:minCount 0; sh:maxCount 1; ] ; sh:property [ - sh:path (won:boundingBox won:northWestCorner); + sh:path (con:boundingBox con:northWestCorner); sh:class s:GeoCoordinates ; sh:minCount 1; sh:maxCount 1; diff --git a/won-taxi-bot/src/main/resources/temp/goals_withoutmax.trig b/won-taxi-bot/src/main/resources/temp/goals_withoutmax.trig index d9a7bf3..1b037e3 100644 --- a/won-taxi-bot/src/main/resources/temp/goals_withoutmax.trig +++ b/won-taxi-bot/src/main/resources/temp/goals_withoutmax.trig @@ -1,3 +1,4 @@ +@prefix con: . @prefix xsd: . @prefix s: . @prefix sh: . @@ -22,12 +23,12 @@ ex2:p2g-shapes { sh:closed false ; sh:ignoredProperties ( rdf:type ) ; sh:property [ - sh:path (won:boundingBox won:southEastCorner); + sh:path (con:boundingBox con:southEastCorner); sh:class s:GeoCoordinates ; sh:minCount 0; ] ; sh:property [ - sh:path (won:boundingBox won:northWestCorner); + sh:path (con:boundingBox con:northWestCorner); sh:class s:GeoCoordinates ; sh:minCount 1; ] ; diff --git a/won-taxi-bot/src/main/resources/temp/toLocationRetrieval.rq b/won-taxi-bot/src/main/resources/temp/toLocationRetrieval.rq index bbfa86f..06392a7 100644 --- a/won-taxi-bot/src/main/resources/temp/toLocationRetrieval.rq +++ b/won-taxi-bot/src/main/resources/temp/toLocationRetrieval.rq @@ -1,3 +1,4 @@ +PREFIX con: prefix s: prefix won: @@ -5,8 +6,8 @@ Select ?lat ?lon where { ?main a s:Place; - won:boundingBox ?boundingBox . - ?boundingBox won:southEastCorner ?geoCoordinates . + con:boundingBox ?boundingBox . + ?boundingBox con:southEastCorner ?geoCoordinates . ?geoCoordinates s:latitude ?lat; s:longitude ?lon. } \ No newline at end of file diff --git a/won-taxi-bot/src/test/java/won/transport/taxi/bot/client/MobileBookingTest.java b/won-taxi-bot/src/test/java/won/transport/taxi/bot/client/MobileBookingTest.java index e68616c..1e6b124 100644 --- a/won-taxi-bot/src/test/java/won/transport/taxi/bot/client/MobileBookingTest.java +++ b/won-taxi-bot/src/test/java/won/transport/taxi/bot/client/MobileBookingTest.java @@ -1,11 +1,22 @@ package won.transport.taxi.bot.client; import org.junit.Assert; +import org.junit.Ignore; import org.junit.Test; -import won.transport.taxi.bot.client.entity.Parameter.*; + import won.transport.taxi.bot.client.entity.Result; +import won.transport.taxi.bot.client.entity.Parameter.Area; +import won.transport.taxi.bot.client.entity.Parameter.DepartureAddress; +import won.transport.taxi.bot.client.entity.Parameter.DestinationAddress; +import won.transport.taxi.bot.client.entity.Parameter.OrderId; +import won.transport.taxi.bot.client.entity.Parameter.Parameter; +import won.transport.taxi.bot.client.entity.Parameter.PostCode; +import won.transport.taxi.bot.client.entity.Parameter.Price; +import won.transport.taxi.bot.client.entity.Parameter.ServiceList; +import won.transport.taxi.bot.client.entity.Parameter.State; import won.transport.taxi.bot.entity.ParseableResult; +@Ignore public class MobileBookingTest { private MobileBookingImpl mobileBooking;