Assembler: Mode.DEFAULT / Mode.REUSE are not considered and result in Mode.CREATE
- Dominant language
- Java
- Stars
- 1.4k
- Forks
- 712
- Avg merge
- 15h 41m
- Merged PRs (30d)
- 53
Description
### Version
4.6.0-SNAPSHOT
### What happened?
(Credits to @LorenzBuehmann for spotting this)
While creating an assembler config that creates two services with different configurations over the same spatial dataset we noticed that the spatial index was unexpectedly loaded twice. The assembler framework documentation suggests that - by default - the same Java object created from an RDF resource should be reused wherever that RDF resource is referenced in the assembler spec.
However, in the code, the Mode flag is eventually ignored and always a fresh Java object is returned:
```java
public abstract class DatasetAssembler {
@Override
public Dataset open(Assembler a, Resource root, Mode mode) {
DatasetGraph dsg = createDataset(a, root) ;
return DatasetFactory.wrap(dsg);
}
}
```
I am not yet sure of the assembler life-cycle: Whether the cache of created objects would have to be an additional argument to the assembler, or whether it can be an attribute of the assembler.
### Are you interested in making a pull request?
Maybe
Contributor guide
Research direction
Start at DatasetAssembler.open and trace how the assembler lifecycle handles the Mode argument and created-object cache. Read the assembler framework documentation referenced in the issue and identify where DEFAULT, REUSE, and CREATE are interpreted. Done means shared RDF resources reuse one Java object for DEFAULT or REUSE, while CREATE still returns a fresh object, with coverage added for the reported duplicate spatial-index case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100