@@ -89,7 +89,7 @@ func (collec *ServiceCollection) getServices(w http.ResponseWriter, _ *http.Requ
8989
9090 serviceList := []string {}
9191 for _ , service := range collec .services {
92- serviceList = append (serviceList , service .URI )
92+ serviceList = append (serviceList , service .FullPath )
9393 }
9494
9595 response := map [string ][]string {
@@ -137,7 +137,7 @@ func generateServiceETag(repr []byte) string {
137137func (collec * ServiceCollection ) headService (w http.ResponseWriter , _ * http.Request , service model.Service ) {
138138 logrus .WithFields (logrus.Fields {"service_id" : service .InstanceID }).Debug ("Request HEAD for service" )
139139
140- repr , err := service .FnORepresentation ()
140+ repr , err := service .Description . FnORepresentation ()
141141 if err != nil {
142142 logrus .WithError (err ).Error ("Failed to generate service FnO representation" )
143143 http .Error (w , "Internal server error" , http .StatusInternalServerError )
@@ -154,7 +154,7 @@ func (collec *ServiceCollection) headService(w http.ResponseWriter, _ *http.Requ
154154func (collec * ServiceCollection ) getService (w http.ResponseWriter , _ * http.Request , service model.Service ) {
155155 logrus .WithFields (logrus.Fields {"service_id" : service .InstanceID }).Info ("Request GET for service" )
156156
157- repr , err := service .FnORepresentation ()
157+ repr , err := service .Description . FnORepresentation ()
158158 if err != nil {
159159 logrus .WithError (err ).Error ("Failed to generate service FnO representation" )
160160 http .Error (w , "Internal server error" , http .StatusInternalServerError )
@@ -199,7 +199,7 @@ func (collec *ServiceCollection) postService(w http.ResponseWriter, r *http.Requ
199199 }
200200
201201 // Extraxt service Path and Id
202- servicePath , serviceId , err := services .ValidServiceUri (service .URI )
202+ aggPath , serviceId , err := services .ValidServicePath (service .FullPath )
203203 if err != nil {
204204 http .Error (w , fmt .Sprintf ("Invalid execution URI: %v" , err ), http .StatusBadRequest )
205205 return
@@ -214,13 +214,9 @@ func (collec *ServiceCollection) postService(w http.ResponseWriter, r *http.Requ
214214 }
215215 collec .servicesMu .Unlock ()
216216
217- service .Path = servicePath
217+ service .AggPath = aggPath
218218 service .InstanceID = serviceId
219219 service .NamespaceID = serviceId + "-" + model .ID
220- service .Outputs = make (map [string ]string )
221- for pred := range service .Application .Transformation .OutputMapping {
222- service .Outputs [pred ] = service .Application .Transformation .Base + pred
223- }
224220
225221 // Create service
226222 err = services .DeployAggregatorService (service )
@@ -244,7 +240,7 @@ func (collec *ServiceCollection) postService(w http.ResponseWriter, r *http.Requ
244240 collec .servicesMu .Unlock ()
245241
246242 // Create service endpoint
247- err = collec .HandleFunc (servicePath , collec .HandleServiceEndpoint , []model.Scope {model .Read , model .Delete })
243+ err = collec .HandleFunc (aggPath , collec .HandleServiceEndpoint , []model.Scope {model .Read , model .Delete })
248244 if err != nil {
249245 logrus .WithError (err ).Errorf ("Error registering handler for service %s" , serviceId )
250246 http .Error (w , "Failed to create service from request" , http .StatusInternalServerError )
@@ -253,7 +249,7 @@ func (collec *ServiceCollection) postService(w http.ResponseWriter, r *http.Requ
253249
254250 // Create output endpoints
255251 for pred := range service .Application .Transformation .OutputMapping {
256- path := servicePath + "/" + pred
252+ path := aggPath + "/" + pred
257253 predUri := service .Application .Transformation .Base + pred
258254 outputUri , exists := service .Application .Transformation .Predicates [predUri ]
259255 if ! exists {
@@ -273,7 +269,8 @@ func (collec *ServiceCollection) postService(w http.ResponseWriter, r *http.Requ
273269 // Return service information
274270 w .Header ().Set ("Content-Type" , "text/turtle" )
275271
276- repr , err := service .FnORepresentation ()
272+ service .InitDescription ()
273+ repr , err := service .Description .FnORepresentation ()
277274 if err != nil {
278275 logrus .WithError (err ).Error ("Failed to generate service FnO representation" )
279276 http .Error (w , "Failed to serialize response" , http .StatusInternalServerError )
0 commit comments