Skip to content

Conversation

@MSattrtand
Copy link
Collaborator

@MSattrtand MSattrtand commented Jul 3, 2025

@MSattrtand MSattrtand requested a review from blcham July 3, 2025 09:36
Copy link
Contributor

@blcham blcham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done just partial review ... please rebase as well

@MSattrtand MSattrtand force-pushed the improve-pipeline-metadata branch from 12cec5c to 0f355a6 Compare July 18, 2025 13:12
@blcham blcham force-pushed the improve-pipeline-metadata branch from 0f355a6 to cdd3d2d Compare July 18, 2025 15:29
Copy link
Contributor

@blcham blcham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see my comments

public static final Property has_script = property("has-script");

public static final Property has_pipeline_execution_status = property("has-pipeline-execution-status");
public static final Property has_executed_function_name = property("has-executed-function-name");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not have in addition to this has-executed-function, that would represent IRI of the function. I.e. it should be similar to how SPIPES.has_module_id is added.

Not sure if has-execution-function-name is needed as well, but I guess we can leave it like that if you need it.

Copy link
Collaborator Author

@MSattrtand MSattrtand Jul 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It actually returns IRI like http://onto.fel.cvut.cz/ontologies/s-pipes/hello-world-example-0.1/execute-greeting, not just execute-greeting. I think I've named it like that because we already have a field has_pipeline_name, that returns Script IRI, so it follows the same naming logic

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we can resolve this one right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not quite yet. As far as I understood, it should be IRI in GraphDB too? In this case, it's still literal, so we can't. But I finally understand how to fix it, so I'll soon push it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be done now. All things that should be IRIs are actually IRIs now.

addProperty(pipelineExecution, SPIPES.has_pipeline_execution_finish_date_unix, finishDate.getTime());
addProperty(pipelineExecution, SPIPES.has_pipeline_execution_duration, computeDuration(startDate, finishDate));
addProperty(pipelineExecution, SPIPES.has_pipeline_name, pipelineName);
addProperty(pipelineExecution, SPIPES.has_pipeline_execution_status, "FINISHED");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We want to represent status using IRI instead of literal! Moreover, we should represented through specific entities which will be connected to ?execution using rdf:type.

I.e. we would have two new constants in Vocabulary.java:
http://onto.fel.cvut.cz/ontologies/dataset-descriptor/failed-pipeline-execution
http://onto.fel.cvut.cz/ontologies/dataset-descriptor/finished-pipeline-execution

And there would be an ?execution and its related triples would be:

?execution a ddo:pipeline-execution, ddo:failed-pipeline-execution

or

?execution a ddo:pipeline-execution, ddo:finished-pipeline-execution

This is done in JOPA using @types, see https://github.com/kbss-cvut/termit/blob/782f2db881d6c882ebdda810207af54f52601805/src/main/java/cz/cvut/kbss/termit/model/UserAccount.java#L183 for inspiration.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. I'm not sure that I've added it in the correct way, since s-pipes-model.ttl has Generated by the OWL API in it, so I don't know if it won't be overwritten at some point

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-- good catch w.r.t. Generated by the OWL API but it is ok : this is added here only if you are editing this file using Progege tool, which is ok.

-- however you modified s-pipes-model.ttl incorrectly see my comments on that file and try to read this thread again.

Copy link
Collaborator Author

@MSattrtand MSattrtand Jul 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done
image


String pipelineName = metadataMap.get(SPIPES.has_pipeline_name.toString()).toString();
addProperty(pipelineExecution, SPIPES.has_pipeline_name, pipelineName);
addProperty(pipelineExecution, SPIPES.has_pipeline_execution_status, "FAILED");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be IRI represented using @types ... as explained above.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not done as i can still see addProperty(pipelineExecution, SPIPES.has_pipeline_execution_status ...., why should be described elsewhere ...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's definitely an IRI now. Should be done

}

private void persistPipelineExecutionStarted(final EntityManager em, long pipelineExecutionId, Thing pipelineExecution) {
private void persistPipelineExecutionStarted(final EntityManager em, long pipelineExecutionId, Thing pipelineExecution, final String functionName, final String scriptPath) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would add scriptIRI in addition to scriptPath ... as scriptIRI is typically something that does not change even if scriptPath is changed. We want to log that !

scriptIRI basically represents the identity of the script -- it should ideally not be changed if the script is doing the same task ... it must change if it is doing something else.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It already has Script IRI like http://onto.fel.cvut.cz/ontologies/s-pipes/hello-world-example-0.1 in has_pipeline_name field, or in Script Name columns at the executions page.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not understand what do you mean by that ...

Do you mean that there is a triple:
?execution :has-pipeline-name http://onto.fel.cvut.cz/ontologies/s-pipes/hello-world-example-0.1 . ?

If so, we should call it :has-pipeline instead.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or wait ... it is not pipeline

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is :has-script right ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we have triples like ?execution :has-pipeline-name http://onto.fel.cvut.cz/ontologies/s-pipes/hello-world-example-0.1
image

We have has-script property, but it's never used

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So should I just rename has-pipeline-name and has-executed-function-name to has-pipeline and has-executed-function respectively?

Copy link
Contributor

@blcham blcham Jul 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it is pointing to IRI than it is not name ... it is the object itself ...

You are however pointing to Script and not the Pipeline ... so you should name it:
has-pipeline-name --> has-script
has-executed-function-name --> has-executed-function

See some insights into terminology here

fire((l) -> {l.pipelineExecutionFinished(pipelineExecutionId); return null;});
return outputContext;
String functionName = module.getFunctionName();
String scriptPath = module.getScriptPath();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This requires discussion.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have to wait for #406 to be resolved.

@blcham blcham self-requested a review July 23, 2025 07:45
Comment on lines 188 to 194
try {
URI script = new URI(metadataMap.get(SPIPES.has_script.toString()).toString());
addProperty(pipelineExecution, SPIPES.has_script, script);
} catch (URISyntaxException e) {
log.error("Invalid script URI in metadata map: {}", metadataMap.get(SPIPES.has_script.toString()), e);
throw new IllegalStateException("Invalid script URI in metadata map", e);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are polluting code with try block that basically cannot fail because you are using it only privately:

private static final Map<String, Object> metadataMap = new HashMap<>();

Then you have exactly same code 30 lines after this ... I am surprised that Intellij idea did not give you hint that it is duplicate code ...

Moreover, i suggest to create private method getURIFromMetadataMap() that handles all that. I.e. new code will look like:

addProperty(pipelineExecution, SPIPES.has_script, getURIFromMetadataMap(SPIPES.has_script));

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


String pipelineName = metadataMap.get(SPIPES.has_script.toString()).toString();
addProperty(pipelineExecution, SPIPES.has_script, pipelineName);
try {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see comment above.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment on lines 358 to 360
addProperty(moduleExecution, SPIPES.has_script, module.getResource().toString().replaceAll("\\/[^.]*$", ""));
if(!metadataMap.containsKey(SPIPES.has_script.toString())){
metadataMap.put(SPIPES.has_script.toString(), module.getResource().toString().replaceAll("\\/[^.]*$", ""));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
addProperty(moduleExecution, SPIPES.has_script, module.getResource().toString().replaceAll("\\/[^.]*$", ""));
if(!metadataMap.containsKey(SPIPES.has_script.toString())){
metadataMap.put(SPIPES.has_script.toString(), module.getResource().toString().replaceAll("\\/[^.]*$", ""));
String script = module.getResource().toString().replaceAll("\\/[^.]*$", "");
addProperty(moduleExecution, SPIPES.has_script, script);
if(!metadataMap.containsKey(SPIPES.has_script.toString())){
metadataMap.put(SPIPES.has_script.toString(), script);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

duplicate code but i still do not understand why we need to do this ... can you explain me whole this part what is doing, why we need it ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. It saves the script's name as a property to be added to the database, then saves it to metadataMap if it's not there. We need to have it there so we'll have access to it from any function in the logger. E.g. right now I have a code like:
private void persistPipelineExecutionStarted(final EntityManager em, long pipelineExecutionId, Thing pipelineExecution, final String functionName, final String scriptPath)
Where functionName and scriptPath are parameters of the function I've added. To avoid using them as inputs of the function, I should use metadataMap and put these parameters there. It will also allow for easy access to these parameters from any other function if needed.

public static final Property has_output_content = property("has-output-content");
public static final Property has_script = property("has-script");

public static final Property has_pipeline_execution_status = property("has-pipeline-execution-status");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

didn't we decide to move it to type of ?pipelineExecution ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@blcham blcham self-requested a review July 23, 2025 08:11
Copy link
Contributor

@blcham blcham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see my comments

Comment on lines 110 to 120
### http://onto.fel.cvut.cz/ontologies/dataset-descriptor/finished-pipeline-execution
s-pipes:finished-pipeline-execution rdf:type owl:DatatypeProperty ;
rdfs:domain ddo:module-execution ;
rdfs:range xsd:boolean ;
rdfs:label "has finished successfully" .

### http://onto.fel.cvut.cz/ontologies/dataset-descriptor/failed-pipeline-execution
s-pipes:failed-pipeline-execution rdf:type owl:DatatypeProperty ;
rdfs:domain ddo:module-execution ;
rdfs:range xsd:boolean ;
rdfs:label "has finished with error" .
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
### http://onto.fel.cvut.cz/ontologies/dataset-descriptor/finished-pipeline-execution
s-pipes:finished-pipeline-execution rdf:type owl:DatatypeProperty ;
rdfs:domain ddo:module-execution ;
rdfs:range xsd:boolean ;
rdfs:label "has finished successfully" .
### http://onto.fel.cvut.cz/ontologies/dataset-descriptor/failed-pipeline-execution
s-pipes:failed-pipeline-execution rdf:type owl:DatatypeProperty ;
rdfs:domain ddo:module-execution ;
rdfs:range xsd:boolean ;
rdfs:label "has finished with error" .
### http://onto.fel.cvut.cz/ontologies/dataset-descriptor/finished-pipeline-execution
s-pipes:finished-pipeline-execution rdf:type owl:Class ;
rdfs:subClassOf s-pipes:pipeline-execution ;
rdfs:label "Pipeline execution that finished successfully" .
### http://onto.fel.cvut.cz/ontologies/dataset-descriptor/failed-pipeline-execution
s-pipes:failed-pipeline-execution rdf:type owl:Class ;
rdfs:subClassOf s-pipes:pipeline-execution ;
rdfs:label "Pipeline execution that finished with error .```

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i guess we did not understand each other... please read my comments again.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be done

addProperty(pipelineExecution, SPIPES.has_pipeline_execution_finish_date_unix, finishDate.getTime());
addProperty(pipelineExecution, SPIPES.has_pipeline_execution_duration, computeDuration(startDate, finishDate));
addProperty(pipelineExecution, SPIPES.has_pipeline_name, pipelineName);
addProperty(pipelineExecution, SPIPES.has_pipeline_execution_status, "FINISHED");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-- good catch w.r.t. Generated by the OWL API but it is ok : this is added here only if you are editing this file using Progege tool, which is ok.

-- however you modified s-pipes-model.ttl incorrectly see my comments on that file and try to read this thread again.


String pipelineName = metadataMap.get(SPIPES.has_pipeline_name.toString()).toString();
addProperty(pipelineExecution, SPIPES.has_pipeline_name, pipelineName);
addProperty(pipelineExecution, SPIPES.has_pipeline_execution_status, "FAILED");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not done as i can still see addProperty(pipelineExecution, SPIPES.has_pipeline_execution_status ...., why should be described elsewhere ...

@MSattrtand MSattrtand force-pushed the improve-pipeline-metadata branch from 3f011cc to adc41d3 Compare October 10, 2025 10:27
@MSattrtand MSattrtand force-pushed the improve-pipeline-metadata branch from 0412d55 to 516ae21 Compare October 17, 2025 12:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix execution page not working

3 participants