kbss-cvut / s-pipes

Tool for execution of RDF-based pipelines.
GNU Lesser General Public License v3.0
4 stars 5 forks source link

Remove loadConfiguration where it is possible #276

Closed palagdan closed 1 month ago

palagdan commented 2 months ago

Resolves #274.

I removed loadConfiguration() where possible in s-pipes-modules. However, there are three main reasons why I couldn't remove it from some other modules:

blcham commented 2 months ago
palagdan commented 2 months ago

@blcham

I have removed all loadConfiguration() methods from the modules and replaced them with loadManualConfiguration(). Also I removed manual configuration for fields that can be configured using annotations.

palagdan commented 1 month ago

@blcham I believe we can easily replace Integer with int because it is only used in one place, as follows:

module.setPageSize(10);
palagdan commented 1 month ago

@blcham

I’m not sure why, but when I try to test locally with mvn clean install, I get the same error that we solved in a previous ticket. However, all the tests pass in the GitHub environment. Do you have any suggestions on how I can fix this?

error_parameter

One more thing I wanted to discuss: how can I easily test all the modules that I modified in the current ticket? I want to be sure that I didn’t break anything and that everything works as expected. Some modules don’t have tests at all. Maybe it would be a good idea to implement tests for these modules in a separate ticket before I continue with the current ticket?

palagdan commented 1 month ago

@blcham

Also, I’m stuck on the problem of removing manual configuration for the classes that call super.loadConfiguration(). I will try to explain.

There is module ApplyConstructAbstractModule

class ApplyConstructAbstractModule extends AnnotatedAbstractModule 

Some modules extend this class to have configured fields, such as constructQueries, isReplace, and parseText.

for example this module:

class ApplyConstructWithChunkedValuesModule extends ApplyConstructAbstractModule

As it was before, the ApplyConstructWithChunkedValuesModule called super.loadConfiguration(), which was overridden in ApplyConstructAbstractModule to manually configure the fields.

However, when I remove this overriding method from the parent, I’m unsure how to configure it from the child class using annotations. If we call super.loadConfiguration() from the child, it will see that the parent did not implement it and will then call loadConfiguration from AnnotatedAbstractModule, which only configures the child class.

Therefore, I’m not sure how to resolve the problem without manually configuring all the fields in ApplyConstructAbstractModule within the loadManualConfiguration() method and then calling it from the child modules.

blcham commented 1 month ago

I’m not sure why, but when I try to test locally with mvn clean install, I get the same error that we solved in a previous ticket.

Maybe you have local changes there, try this to be sure:

git clone -b 274-load-configuration-parallel 'https://github.com/kbss-cvut/s-pipes'
cd s-pipes
mvn clean install

Therefore, I’m not sure how to resolve the problem without manually configuring all the fields in ApplyConstructAbstractModule within the loadManualConfiguration() method and then calling it from the child modules.

Yes, that is also option.

But how about reimplementing loadConfiguration() to process also parent classes? Would it solve the issue? I mean to process @Parameter annotations of all classes from something like this.getClass().getSuperclass().

palagdan commented 1 month ago

But how about reimplementing loadConfiguration() to process also parent classes? Would it solve the issue? I mean to process @parameter annotations of all classes from something like this.getClass().getSuperclass().

@blcham

Thank you for the idea! It should be better than doing it manually.