Annex 1: Examples of scenarios that UNDO can describe

UNDO allows one to describe with a formal language (OWL and RDF) several scenarios that are typical to the documents published by the United Nations organisations (e.g. UN Resolutions). In the following sections, we illustrate some of them in RDF and we list possible natural language questions related to each scenario and their representations in SPARQL queries.

All the examples are provided in Turtle format, which is a specific linearization for RDF statements. The prefixes that are used in all the examples introduced in the following sub-sections are defined as follows:

@prefix : <https://w3id.org/akn/data/undo/> .

@prefix undo: <https://w3id.org/akn/ontology/undo/> .

@prefix allot: <https://w3id.org/akn/ontology/allot/> .

@prefix owl: <http://www.w3.org/2002/07/owl#> .

@prefix dcterms: <http://purl.org/dc/terms/> .

@prefix lan: <http://id.loc.gov/vocabulary/iso639-1/> .

@prefix oa: <http://www.w3.org/ns/oa#> .

@prefix part: <http://www.ontologydesignpatterns.org/cp/owl/participation.owl#> .

@prefix pwo: <http://purl.org/spar/pwo/> .

@prefix taskex: <http://www.ontologydesignpatterns.org/cp/owl/taskexecution.owl#> .

@prefix ti: <http://www.ontologydesignpatterns.org/cp/owl/timeinterval.owl#> .

@prefix tisit: <http://www.ontologydesignpatterns.org/cp/owl/timeindexedsituation.owl#> .

@prefix tvc: <http://www.essepuntato.it/2012/04/tvc/> .

The prefixes that are used in all the SPARQL queries provided below are defined as follows:

PREFIX : <https://w3id.org/akn/data/undo/>

PREFIX allot: <https://w3id.org/akn/ontology/allot/>

PREFIX oa: <http://www.w3.org/ns/oa#>

PREFIX owl: <http://www.w3.org/2002/07/owl#>

PREFIX undo: <https://w3id.org/akn/ontology/undo/>

PREFIX ti: <http://www.ontologydesignpatterns.org/cp/owl/timeinterval.owl#>

PREFIX tvc: <http://www.essepuntato.it/2012/04/tvc/>

PREFIX frbr: <http://purl.org/vocab/frbr/core#>

PREFIX pwo: <http://purl.org/spar/pwo/>

PREFIX taskex: <http://www.ontologydesignpatterns.org/cp/owl/taskexecution.owl#>

Scenario 1

Description: In the preface of the UN resolution A/RES/50/100 of 2 February 1996 (http://undocs.org/A/RES/50/100 ) there are references to:

the UN resolution A/RES/47/180 of 22 December 1992;

the Government of Turkey;

the United Nations Conference on Human Settlements (Habitat II).

Turtle:

# The resolution A/RES/50/100 mentions another resolution (A/RES/47/180),
# the Government of Turkey, and the conference Habitat II.

:a-res-50-100-1996-02-02 a undo:Resolution ;

allot:mentions

:a-res-47-180-1992-12-22 ,

:government-of-turkey ,

:habitat-ii .

:a-res-47-180-1992-12-22 a undo:Resolution .

:government-of-turkey a allot:Organization .

:habitat-ii a allot:Event.

Natural language question: What are all the documents that refer to the UN resolution A/RES/47/180 of 22 December 1992?

SPARQL:

SELECT DISTINCT ?document

WHERE {

?document allot:mentions :a-res-47-180-1992-12-22 .

}

Scenario 2

Description: According to the content of the UN resolution A/RES/50/100 of 2 February 1996, the General Assembly:

recalls the resolution A/RES/47/180 of 22 December 1992;

reiterates its gratitude to the Government of Turkey;

notes the progress that has been made so far in the preparations for the United Nations Conference on Human Settlements (Habitat II).

Turtle:

:a-res-50-100-1996-02-02 a undo:Resolution .

:a-res-47-180-1992-12-22 a undo:Resolution .

:general-assembly a allot:Organization .

:organization a allot:Organization .

:government-of-turkey a allot:Organization .

:habitat-ii a allot:Event .

:recall a allot:Concept .

:reiterate-its-gratitude a allot:Concept .

:note-the-progress a allot:Concept .

# This relation describes the General Assembly recalling the
# resolution A/RES/47/180.

:relation-1 a undo:Relation ;

undo:hasProponent :general-assembly ;

undo:hasSemantics :recall ;

undo:hasReceiver :a-res-47-180-1992-12-22 .

# This relation describes the General Assembly reiterating its gratitude
# to the Government of Turkey.

:relation-2 a undo:Relation ;

undo:hasProponent :general-assembly ;

undo:hasSemantics :reiterate-its-gratitude ;

undo:hasReceiver :government-of-turkey .

# This relation describes the General Assembly noting the progress for the
# preparation of Habitat II.

:relation-3 a undo:Relation ;

undo:hasProponent :general-assembly ;

undo:hasSemantics :note-the-progress ;

undo:hasReceiver :habitat-ii .

# The following are a three annotations that attached the aforementioned
# relations to the resolution A/RES/50/100 from which they have been
# extracted.

:annotation-1-a-res-50-100-1996-02-02 a undo:Annotation ;

oa:hasBody :relation-1 ;

oa:hasTarget :a-res-50-100-1996-02-02 .

:annotation-2-a-res-50-100-1996-02-02 a undo:Annotation ;

oa:hasBody :relation-2 ;

oa:hasTarget :a-res-50-100-1996-02-02 .

:annotation-3-a-res-50-100-1996-02-02 a undo:Annotation ;

oa:hasBody :relation-3 ;

oa:hasTarget :a-res-50-100-1996-02-02 .

Natural language question: What are all the entities referred by the UN resolution A/RES/50/100 of 2 February 1996?

SPARQL:

SELECT DISTINCT ?entity ?type

WHERE {

:a-res-50-100-1996-02-02 allot:mentions ?entity .

?entity a ?type .

FILTER (?type != owl:NamedIndividual)

}

Scenario 3

Description: The UN resolution A/RES/50/100 has been published in six different languages. The term "decides" has been used twice in the English version, and, in parallel, the term "decide" has been used twice in the Spanish version. Both the terms actually refer to the same higher-level concept of taking a decision, even if this aspect has not been made formally explicit in the document itself.

Turtle:

# The resolution A/RES/50/100 that has been made available in two different
# versions according to two languages.

:a-res-50-100-1996-02-02 a undo:Resolution ;

allot:hasRealization

:a-res-50-100-1996-02-02-en ,

:a-res-50-100-1996-02-02-es .

# The English version of the resolution.

:a-res-50-100-1996-02-02-en a undo:DocumentVersion ;

dcterms:language lan:en .

# The Spanish version of the resolution.

:a-res-50-100-1996-02-02-es a undo:DocumentVersion ;

dcterms:language lan:es .

# The definition of an English term describing the concept of
# ‘taking a decision’ and two distinct annotation that attach it
# to the same English version of the resolution – since the term
# appears twice in the document.

:decides a allot:Term ;

undo:hasRelatedConcept :taking-a-decision .

:annotation-1-a-res-50-100-1996-02-02-en a undo:Annotation ;

oa:hasBody :decides ;

oa:hasTarget :a-res-50-100-1996-02-02-en .

:annotation-2-a-res-50-100-1996-02-02-en a undo:Annotation ;

oa:hasBody :decides ;

oa:hasTarget :a-res-50-100-1996-02-02-en .

# A similar description of the previous term, but by means of its Spanish
# translation.

:decide a allot:Term ;

undo:hasRelatedConcept :taking-a-decision .

:annotation-1-a-res-50-100-1996-02-02-es a undo:Annotation ;

oa:hasBody :decide ;

oa:hasTarget :a-res-50-100-1996-02-02-es .

:annotation-2-a-res-50-100-1996-02-02-es a undo:Annotation ;

oa:hasBody :decide ;

oa:hasTarget :a-res-50-100-1996-02-02-es .

:taking-a-decision a allot:Concept .

Natural language question: What are all the terms that actually refer to the concept of taking a decision, and in which documents have been used?

SPARQL:

SELECT DISTINCT ?term ?document

WHERE {

?term a allot:Term ;

undo:hasRelatedConcept :taking-a-decision .

?ann a undo:Annotation ;

oa:hasBody ?term ;

oa:hasTarget ?document

}

Scenario 4

Description: Giorgio Napolitano has been President of Italy for the first time from 15th of May 2006 to 22th of April 2013, when he resigned. He has been elected again on 22th of April 2013, and he has been President of Italy for the second time until 14th of January 2015, when he resigned for the second time. He has been substituted by Sergio Mattarella, who starts his mandate as President of Italy on 3rd of February 2015, formerly judge of the Constitutional Court of Italy from 11th of October 2011 to 2nd of February 2015.

Turtle:

# Giorgio Napolitano who has been President of Italy in two distinct periods:
# the first one from 2006 to 2013, and the second one from 2013 to 2015.

:giorgio-napolitano a undo:Agent ;

tvc:hasValue

:giorgio-napolitano-president-of-italy-2006-2013 ,

:giorgio-napolitano-president-of-italy-2013-2015 .

# First mandate of Giorgio Napolitano as President of Italy.

:giorgio-napolitano-president-of-italy-2006-2013 a undo:ValueInTimeAndContext ;

tvc:withValue :president ;

tvc:atTime :2006-2013 ;

tvc:withinContext :italy .

# Second mandate of Giorgio Napolitano as President of Italy.

:giorgio-napolitano-president-of-italy-2013-2015 a undo:ValueInTimeAndContext ;

tvc:withValue :president ;

tvc:atTime :2013-2015 ;

tvc:withinContext :italy .

:president a allot:Role .

# The intervals defining the two mandates of Giorgio Napolitano as
# President of Italy.

:2006-2013 a undo:Interval ;

ti:hasIntervalStartDate "2006-05-15T00:00:00"^^xsd:dateTime ;

ti:hasIntervalEndDate "2013-04-22T00:00:00"^^xsd:dateTime .

:2013-2015 a undo:Interval ;

ti:hasIntervalStartDate "2013-04-22T00:00:00"^^xsd:dateTime ;

ti:hasIntervalEndDate "2015-01-14T00:00:00"^^xsd:dateTime .

:italy a allot:Reference .

# Sergio Mattarella in relation to its roles of judge of the Constitutional
# Court of Italy before becoming President of Italy in 2015.

:sergio-mattarella a undo:Agent ;

tvc:hasValue

:sergio-mattarella-judge-constitutional-court-of-italy-2011-2015 ,

:sergio-mattarella-president-of-italy-since-2015.

# Sergio Mattarella acting as a judge.

:sergio-mattarella-judge-constitutional-court-of-italy-2011-2015 a undo:ValueInTimeAndContext ;

tvc:withValue :judge ;

tvc:atTime :2011-2015 ;

tvc:withinContext :constitutional-court-of-italy .

# Sergio Mattarella acting as President of Italy.

:sergio-mattarella-president-of-italy-since-2015 a undo:ValueInTimeAndContext ;

tvc:withValue :president ;

tvc:atTime :since-2015 ;

tvc:withinContext :italy .

# The intervals related to Sergio Mattarella’s roles.

:2011-2015 a undo:Interval ;

ti:hasIntervalStartDate "2011-10-11T00:00:00"^^xsd:dateTime ;

ti:hasIntervalEndDate "2015-02-03T00:00:00"^^xsd:dateTime .

:since-2015 a undo:Interval ;

ti:hasIntervalStartDate "2015-02-03T00:00:00"^^xsd:dateTime .

:constitutional-court-of-italy a allot:Reference .

:judge a allot:Role .

Natural language question: What are the current roles of all the agents?

SPARQL:

SELECT DISTINCT ?agent ?role ?context

WHERE {

?agent a undo:Agent ;

tvc:hasValue ?value .

?value a undo:ValueInTimeAndContext ;

tvc:withValue ?role ;

tvc:withinContext ?context .

FILTER NOT EXISTS {

?value tvc:atTime/ti:hasIntervalEndDate ?time

}

?role a allot:Role .

}

Natural language question: What roles have been held by Sergio Mattarella during his life?

SPARQL:

SELECT DISTINCT ?role ?context ?start ?end

WHERE {

:sergio-mattarella tvc:hasValue ?value .

?value a undo:ValueInTimeAndContext ;

tvc:withValue ?role ;

tvc:withinContext ?context ;

tvc:atTime ?time .

?time a undo:Interval ;

ti:hasIntervalStartDate ?start .

OPTIONAL {

?time ti:hasIntervalEndDate ?end

}

?role a allot:Role .

}

Natural language question: How many times has an agent been assigned to a specific role?

SPARQL:

SELECT DISTINCT ?agent ?role ?context (count(?agent) AS ?count)

WHERE {

?agent a undo:Agent ;

tvc:hasValue ?value .

?value a undo:ValueInTimeAndContext ;

tvc:withValue ?role ;

tvc:withinContext ?context .

?role a allot:Role .

}

GROUP BY ?agent ?role ?context

Natural language question: Which roles are involved in particular contexts?

SPARQL:

SELECT DISTINCT ?context ?role

WHERE {

?value a undo:ValueInTimeAndContext ;

tvc:withValue ?role ;

tvc:withinContext ?context .

?role a allot:Role .

}

Scenario 5

Description: A document has been in drafting from the 14th of May to the 14th of June 2016. Then, it has been under revision for the following two months, and finally published on the 1st of September 2016.

Turtle:

# The three statuses associated to the document.

:a-document a undo:Document ;

tvc:hasValue

:document-in-drafting ,

:document-under-revision ,

:document-published .

# The status of being in drafting.

:document-in-drafting a undo:ValueInTimeAndContext ;

tvc:withValue :in-drafting ;

tvc:atTime :in-drafting-interval .

# The status of being under revision.

:document-under-revision a undo:ValueInTimeAndContext ;

tvc:withValue :under-revision ;

tvc:atTime :under-revision-interval .

# The status of being published.

:document-published a undo:ValueInTimeAndContext ;

tvc:withValue :published ;

tvc:atTime :published-interval .

# The intervals defining how long the aforementioned status have been
# assigned to the document in consideration.

:in-drafting-interval a undo:Interval ;

ti:hasIntervalStartDate "2016-05-14T00:00:00"^^xsd:dateTime ;

ti:hasIntervalEndDate "2016-06-14T00:00:00"^^xsd:dateTime .

:under-revision-interval a undo:Interval ;

ti:hasIntervalStartDate "2016-06-14T00:00:00"^^xsd:dateTime ;

ti:hasIntervalEndDate "2016-08-14T00:00:00"^^xsd:dateTime .

:published-interval a undo:Interval ;

ti:hasIntervalStartDate "2016-09-01T00:00:00"^^xsd:dateTime .

:in-drafting a undo:Status .

:under-revision a undo:Status .

:published a undo:Status .

Natural language question: What are all the statuses that have been associated to all the documents?

SPARQL:

SELECT DISTINCT ?document ?status ?start ?end

WHERE {

?document a undo:Document ;

tvc:hasValue ?value .

?value a undo:ValueInTimeAndContext ;

tvc:withValue ?status ;

tvc:atTime ?time .

?time a undo:Interval ;

ti:hasIntervalStartDate ?start .

OPTIONAL {

?time ti:hasIntervalEndDate ?end

}

?status a undo:Status .

}

Scenario 6

Description: The publication of a document should go through four phases, or steps:

write, which will produce a document;

review, that will produce comments starting from the input document;

revision, that will produce a new version of the previous document corrected considering the comments produced by the previous step;

publication, which will assign the “published” status to that document.

Turtle:

# The four steps composing the workflow.

:publication a undo:Workflow ;

pwo:hasStep

:step-1 ,

:step-2 ,

:step-3 ,

:step-4 .

# The definition of each step according to its type, including the link to
# the other step that follows the one in consideration (in any).

:step-1 a undo:Step ;

undo:hasStepType :write ;

pwo:hasNextStep :step-2 .

:write a undo:StepType .

:step-2 a undo:Step ;

undo:hasStepType :review ;

pwo:hasNextStep :step-3 .

:review a undo:StepType .

:step-3 a undo:Step ;

undo:hasStepType :revise ;

pwo:hasNextStep :step-4 .

:revise a undo:StepType .

:step-4 a undo:Step ;

undo:hasStepType :publish .

:publish a undo:StepType .

Natural language question: In which step of all the workflows the first version of a document has been produced?

SPARQL:

SELECT ?doc ?step

WHERE {

?step a undo:Step ;

pwo:produces ?doc .

?doc a undo:DocumentVersion .

FILTER NOT EXISTS {

?another_step a undo:Step ;

pwo:produces ?prev_version .

?prev_version frbr:revision+ ?doc

}

}

Natural language question: How many steps (on average) are used in each workflow?

SPARQL:

SELECT (avg(?n_step) as ?average)

WHERE {

{

SELECT ?workflow (count(?step) as ?n_step)

{

?workflow a undo:Workflow ;

pwo:hasStep ?step .

} GROUP BY ?workflow

}

} GROUP BY ?workflow

Scenario 7

Description: The Assistant of a Representative writes the first draft of a resolution from the 1st of March 2017 to the 5th of March 2017. On the 7th of March, the Representative revises it, and extends the introduction. From the 9th of March to the 10th of March, Assistant of the Representative finalizes the document. On the 11th of March, the State Member makes it available for review.

On the 12th of March, the Office of the Presidency of the General Assembly read the draft. From the 13th of March to the 20th of March, the Office of the Presidency of the General Assembly writes a comment highlighting issues. The comment is then made available to the President of the General Assembly on the 21st of March.

From the 22nd to the 27th of March, the Committee Number 1 revises the draft and addresses the main issues raised by the Office of the Presidency of the General Assembly. On the 28th, the draft is sent to the General Assembly.

The General Assembly approves and publishes the resolution on the 31st of March.

Turtle:

# A document that will become a resolution after the workflow execution,
# accompanied by all the versions that have been created during the process.

:future-resolution a undo:Document ;

allot:hasRealization

:assistant-first-draft-resolution ,

:member-rep-extended-introduction-first-draft ,

:final-first-draft ,

:revised-draft .

# The first draft created by the assistant of the representative, and
# the related action of writing it.

:assistant-member-rep a undo:Agent .

:assistant-first-draft-resolution a undo:DocumentVersion .

:2017-03-01_05 a undo:Interval ;

ti:hasIntervalStartDate "2017-03-01T00:00:00"^^xsd:dateTime ;

ti:hasIntervalEndDate "2017-03-05T23:59:59"^^xsd:dateTime .

:writing-first-draft a undo:Action ;

taskex:executesTask :step-1 ;

part:hasParticipant

:assistant-member-rep ,

:assistant-first-draft-resolution ;

pwo:happened :2017-03-01_05 .

# The revision proposed by the representative, who extended
# the previous draft.

:member-rep a undo:Agent .

:assistant-first-draft-resolution

frbr:revision :member-rep-extended-introduction-first-draft .

:member-rep-extended-introduction-first-draft a undo:DocumentVersion .

:2017-03-07 a undo:Interval ;

ti:hasIntervalStartDate "2017-03-07T00:00:00"^^xsd:dateTime ;

ti:hasIntervalEndDate "2017-03-07T23:59:59"^^xsd:dateTime .

:extending-first-draft a undo:Action ;

taskex:executesTask :step-1 ;

part:hasParticipant

:member-rep ,

:assistant-first-draft-resolution ,

:member-rep-extended-introduction-first-draft ;

pwo:happened :2017-03-07 .

# The submission of the draft by the state member to the General Assembly.

:member-rep-extended-introduction-first-draft

frbr:revision :final-first-draft .

:final-first-draft a undo:DocumentVersion .

:2017-03-09_10 a undo:Interval ;

ti:hasIntervalStartDate "2017-03-09T00:00:00"^^xsd:dateTime ;

ti:hasIntervalEndDate "2017-03-10T23:59:59"^^xsd:dateTime .

:revision-first-draft a undo:Action ;

taskex:executesTask :step-1 ;

part:hasParticipant

:assistant-member-rep ,

:member-rep-extended-introduction-first-draft ,

:final-first-draft ;

pwo:happened :2017-03-09_10 .

:member a undo:Agent .

:2017-03-11 a undo:Interval ;

ti:hasIntervalStartDate "2017-03-11T00:00:00"^^xsd:dateTime ;

ti:hasIntervalEndDate "2017-03-11T23:59:59"^^xsd:dateTime .

:making-available-first-draft a undo:Action ;

taskex:executesTask :step-1 ;

part:hasParticipant

:member ,

:final-first-draft ;

pwo:happened :2017-03-11 .

:step-1 pwo:produces :final-first-draft .

# The reading done by the Office of the Presidency of the General Assembly
# to the draft submitted.

:office-presidency-ga a undo:Agent .

:2017-03-12 a undo:Interval ;

ti:hasIntervalStartDate "2017-03-12T00:00:00"^^xsd:dateTime ;

ti:hasIntervalEndDate "2017-03-12T23:59:59"^^xsd:dateTime .

:reading-final-first-draft a undo:Action ;

taskex:executesTask :step-2 ;

part:hasParticipant

:office-presidency-ga ,

:final-first-draft ;

pwo:happened :2017-03-12 .

# The creation of a comment that explains issues and proposes modification
# to the submitted draft.

:2017-03-13_20 a undo:Interval ;

ti:hasIntervalStartDate "2017-03-13T00:00:00"^^xsd:dateTime ;

ti:hasIntervalEndDate "2017-03-20T23:59:59"^^xsd:dateTime .

:comment a undo:Document ;

allot:hasRealization :comment-content .

:comment-content a undo:DocumentVersion .

:writing-comment a undo:Action ;

taskex:executesTask :step-2 ;

part:hasParticipant

:office-presidency-ga ,

:final-first-draft ,

:comment-content ;

pwo:happened :2017-03-13_20 .

# The comment is made available by the President of the General Assembly.

:president-ga a undo:Agent .

:2017-03-21 a undo:Interval ;

ti:hasIntervalStartDate "2017-03-12T00:00:00"^^xsd:dateTime ;

ti:hasIntervalEndDate "2017-03-12T23:59:59"^^xsd:dateTime .

:making-available-comment a undo:Action ;

taskex:executesTask :step-2 ;

part:hasParticipant

:office-presidency-ga ,

:president-ga ,

:comment-content ;

pwo:happened :2017-03-21 .

:step-2

pwo:needs :final-first-draft ;

pwo:produces :comment-content .

# The Committee 1 revising the draft according to the comment.

:committee-1 a undo:Agent .

:final-first-draft

frbr:revision :revised-draft .

:revised-draft a undo:DocumentVersion .

:2017-03-22_27 a undo:Interval ;

ti:hasIntervalStartDate "2017-03-22T00:00:00"^^xsd:dateTime ;

ti:hasIntervalEndDate "2017-03-27T23:59:59"^^xsd:dateTime .

:revision-final-first-draft a undo:Action ;

taskex:executesTask :step-3 ;

part:hasParticipant

:committee-1 ,

:final-first-draft ,

:comment ,

:revised-draft ;

pwo:happened :2017-03-22_27 .

# The Committee 1 that sends the revision o the General Assembly.

:ga a undo:Agent .

:2017-03-28 a undo:Interval ;

ti:hasIntervalStartDate "2017-03-28T00:00:00"^^xsd:dateTime ;

ti:hasIntervalEndDate "2017-03-28T23:59:59"^^xsd:dateTime .

:sending-revision a undo:Action ;

taskex:executesTask :step-3 ;

part:hasParticipant

:committee-1 ,

:revised-draft ,

:ga ;

pwo:happened :2017-03-28 .

:step-3

pwo:needs :final-first-draft , :comment ;

pwo:produces :revised-draft .

# The draft resolution is reconfigured as a proper resolution, that is thus
# published by the General Assembly.

:future-resolution

frbr:transformation :resolution .

:resolution a undo:Resolution ;

allot:hasRealization :resolution-text .

:resolution-text a undo:DocumentVersion .

:2017-03-31 a undo:Interval ;

ti:hasIntervalStartDate "2017-03-31T00:00:00"^^xsd:dateTime ;

ti:hasIntervalEndDate "2017-03-31T23:59:59"^^xsd:dateTime .

:approving-and-publishing-resolution a undo:Action ;

taskex:executesTask :step-4 ;

part:hasParticipant

:revised-draft ,

:resolution-text ,

:ga ;

pwo:happened :2017-03-31 .

:step-4

pwo:needs :revised-draft ;

pwo:produces :resolution-text .

# The definition of the workflow execution, including all the actions
# that have been performed.

:publication-execution a undo:WorkflowExecution ;

pwo:executes :publication ;

pwo:involvesAction

:writing-first-draft ,

:extending-first-draft ,

:revision-first-draft ,

:making-available-first-draft ,

:reading-final-first-draft ,

:writing-comment ,

:making-available-comment ,

:revision-final-first-draft ,

:sending-revision ,

:approving-and-publishing-resolution .

Natural language question: How much did it take to executing each step in each workflow execution?

SPARQL:

SELECT ?execution ?step (round(?end - ?start) as ?minutes)

WHERE {

{

SELECT ?execution ?step (min(?s_date) as ?start) (max(?e_date) as ?end)

{

?execution a undo:WorkflowExecution ;

pwo:involvesAction ?action .

?action a undo:Action ;

taskex:executesTask ?step ;

pwo:happened ?time .

?time a undo:Interval ;

ti:hasIntervalStartDate ?s_date ;

ti:hasIntervalEndDate ?e_date .

} GROUP BY ?execution ?step

}

}

Natural language question: What were the last entities produced by all the workflow executions?

SPARQL:

SELECT ?execution ?entity {

?execution a undo:WorkflowExecution ;

pwo:involvesAction/taskex:executesTask ?step .

?step a undo:Step ;

pwo:produces ?entity .

FILTER NOT EXISTS {

?step pwo:hasNextStep ?another_step .

}

}