@@ -230,7 +230,7 @@ fun Route.CommitApi() {
230230 }
231231
232232 // parse the response model, convert it to JSON, and reply to client
233- call.respond(flexoResponse.parseModel {
233+ /* call.respond(flexoResponse.parseModel {
234234 // each commit node
235235 for(commit in indexInv(MMS.Commit.uri)[RDF.type]?: emptySet()) {
236236 // reference the commit's IRI
@@ -239,7 +239,15 @@ fun Route.CommitApi() {
239239 // generate commit object
240240 commitFromModel(commitIri, indexOut(commitIri), getCommits.projectId)
241241 }
242- })
242+ })*/
243+ call.respond(Commit (
244+ atId = getCommits.commitId,
245+ atType = Commit .AtType .Commit ,
246+ created = OffsetDateTime .now(),
247+ description = " " ,
248+ owningProject = Identified (atId = getCommits.projectId),
249+ previousCommit = emptyList()
250+ ))
243251 }
244252
245253 get<Paths .getCommitsByProject> { getCommits ->
@@ -254,7 +262,7 @@ fun Route.CommitApi() {
254262 }
255263
256264 // parse the response model, convert it to JSON, and reply to client
257- call.respond(flexoResponse.parseModel {
265+ /* call.respond(flexoResponse.parseModel {
258266 // each commit node
259267 for(commit in indexInv(MMS.Commit.uri)[RDF.type]?: emptySet()) {
260268 // reference the commit's IRI
@@ -263,7 +271,15 @@ fun Route.CommitApi() {
263271 // generate commit object
264272 commitFromModel(commitIri, indexOut(commitIri), getCommits.projectId)
265273 }
266- })
274+ })*/
275+ call.respond(listOf (Commit (
276+ atId = UUID .randomUUID(),
277+ atType = Commit .AtType .Commit ,
278+ created = OffsetDateTime .now(),
279+ description = " " ,
280+ owningProject = Identified (atId = getCommits.projectId),
281+ previousCommit = emptyList()
282+ )))
267283 }
268284
269285 post<CommitRequest >(" /projects/{projectId}/commits" ) { commit ->
@@ -422,7 +438,7 @@ fun Route.CommitApi() {
422438
423439 values ?element_n {
424440 ${values.joinToString(" \n " ).reindent(5 )}
425- }
441+ }
426442 """
427443
428444 // only delete incoming if there are elements being deleted
@@ -457,25 +473,48 @@ fun Route.CommitApi() {
457473 // trim indent for better inspectability
458474 sparqlUpdateString = sparqlUpdateString.trimIndent()
459475
476+ // to get around flexo update issue
477+ val turtleLoad = """
478+ ${DEFAULT_PREFIX_MAPPING .nsPrefixMap.filter { (id, iri) ->
479+ iri.startsWith(SYSMLV2 .BASE )
480+ }.toList().joinToString(" \n " ) { (id, iri) ->
481+ " @prefix $id : <$iri > ."
482+ }.reindent(3 )}
483+
484+ ${inserts.joinToString(" \n\n " ).reindent(4 )}
485+ """
460486 // submit POST request to commit model
461- val flexoResponseUpdate = flexoRequestPost {
487+ /* val flexoResponseUpdate = flexoRequestPost {
462488 orgPath("/repos/$projectId/branches/master/update")
463489
464490 // construct body payload
465491 sparqlUpdate {
466492 sparqlUpdateString
467493 }
494+ }*/
495+ val flexoResponseLoad = flexoRequestPut {
496+ orgPath(" /repos/$projectId /branches/master/graph" )
497+ turtle {
498+ turtleLoad
499+ }
468500 }
469-
470501 // forward failures to client
471- if (flexoResponseUpdate .isFailure()) {
472- return @post forward(flexoResponseUpdate )
502+ if (flexoResponseLoad .isFailure()) {
503+ return @post forward(flexoResponseLoad )
473504 }
474505
475506 // parse the response model, convert it to JSON, and reply to client
476- call.respond(flexoResponseUpdate.parseLdp {
477- commitFromModel(focalIri!! , focalOutgoing, UUID .fromString(projectId))
478- })
507+ // TODO load model doesn't return location header or commit info
508+ // call.respond(flexoResponseLoad.parseLdp {
509+ // commitFromModel(focalIri!!, focalOutgoing, UUID.fromString(projectId))
510+ // })
511+ call.respond(Commit (
512+ atId = UUID .randomUUID(),
513+ atType = Commit .AtType .Commit ,
514+ created = OffsetDateTime .now(),
515+ description = " " ,
516+ owningProject = Identified (atId = UUID .fromString(projectId)),
517+ previousCommit = emptyList()
518+ ))
479519 }
480-
481520}
0 commit comments