Skip to content

Commit

Permalink
fix(event): Remove label from event restrictions
Browse files Browse the repository at this point in the history
OpenSILEX/opensilex-dev!1262
  • Loading branch information
ABIDRISA authored and HART Maximilian committed Jul 23, 2024
1 parent 658c76d commit 50eb4a5
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 60 deletions.
28 changes: 18 additions & 10 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
<!-- TOC -->
* [Changelog](#changelog)
* [[1.3.2]](#132)
* [[1.3.3]](#133)
* [Fixed](#fixed)
* [[1.3.2]](#132)
* [Fixed](#fixed-1)
* [Changes and new features](#changes-and-new-features)
* [[1.3.1]](#131)
* [Fixed](#fixed-1)
* [Fixed](#fixed-2)
* [[1.3.0] - Dizzy Diamond](#130---dizzy-diamond-)
* [Changes and new features](#changes-and-new-features-1)
* [Fixed or optimized](#fixed-or-optimized)
Expand All @@ -22,9 +24,9 @@
* [Changes and new features](#changes-and-new-features-2)
* [Fixed or optimized](#fixed-or-optimized-5)
* [[1.2.2]](#122)
* [Fixed](#fixed-2)
* [[1.2.1]](#121)
* [Fixed](#fixed-3)
* [[1.2.1]](#121)
* [Fixed](#fixed-4)
* [[1.2.0] - Caramelized Crystal](#120---caramelized-crystal)
* [Highlight](#highlight-1)
* [Changes and new features](#changes-and-new-features-3)
Expand Down Expand Up @@ -58,13 +60,13 @@
* [Added or changed](#added-or-changed-1)
* [Fixed or optimized](#fixed-or-optimized-14)
* [[1.0.0-rc+4.1] - 2022-07-13](#100-rc41---2022-07-13)
* [Fixed](#fixed-4)
* [Fixed](#fixed-5)
* [[1.0.0-rc+4] - 2022-06-13](#100-rc4---2022-06-13)
* [Added or changed](#added-or-changed-2)
* [Fixed](#fixed-5)
* [Fixed](#fixed-6)
* [[1.0.0-rc+3] - 2022-05-05](#100-rc3---2022-05-05)
* [Added or changed](#added-or-changed-3)
* [Fixed](#fixed-6)
* [Fixed](#fixed-7)
* [[1.0.0-rc+2] - 2022-01-23](#100-rc2---2022-01-23)
* [Added](#added)
* [Added in pre-production](#added-in-pre-production)
Expand All @@ -80,15 +82,15 @@
* [Major bugs identified](#major-bugs-identified)
* [[1.0.0-beta+2.1] - 2021-07-27](#100-beta21---2021-07-27)
* [Added](#added-3)
* [Fixed](#fixed-7)
* [Fixed](#fixed-8)
* [[1.0.0-beta+2] - 2021-05-07](#100-beta2---2021-05-07)
* [Added](#added-4)
* [Changed](#changed-1)
* [[1.0.0-beta+1] - 2021-04-27](#100-beta1---2021-04-27)
* [Fixed](#fixed-8)
* [Fixed](#fixed-9)
* [[1.0.0-beta] - 2021-04-20](#100-beta---2021-04-20)
* [Added](#added-5)
* [Fixed](#fixed-9)
* [Fixed](#fixed-10)
* [[1.0.0-alpha] - 2020-11-30](#100-alpha---2020-11-30)
* [Added](#added-6)
<!-- TOC -->
Expand All @@ -100,6 +102,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.3.3]

### Fixed

- (!1262) Fixed Move import template generation, and Move import

## [1.3.2]

### Fixed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,19 @@ public List<EventModel> getList(List<URI> uris, AccountModel user) throws Except
}

protected void appendInTargetsValues(SelectBuilder select, Stream<URI> targets, int size) {
appendInTargetsValuesInner(select, targets, size, eventGraph);
}

/**
*
*Temporary function, the inTargets filter will be handled in a cleaner way when the events logic layer gets merged
* For now just call this protected function from either appendInTargetsValues or MoveDao's appendTargetFilter
* TODO delete this
*/
protected void appendInTargetsValuesInner(SelectBuilder select, Stream<URI> targets, int size, Node graph) {

ElementGroup rootElementGroup = select.getWhereHandler().getClause();
ElementGroup eventGraphGroupElem = SPARQLQueryHelper.getSelectOrCreateGraphElementGroup(rootElementGroup, eventGraph);
ElementGroup eventGraphGroupElem = SPARQLQueryHelper.getSelectOrCreateGraphElementGroup(rootElementGroup, graph);
eventGraphGroupElem.addTriplePattern(targetTriple);

SPARQLQueryHelper.addWhereUriValues(select, EventModel.TARGETS_FIELD, targets, size);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -614,21 +614,6 @@ public FindIterable<MoveEventNoSqlModel> getIntersectPosition(List<MoveEventNoSq
return moveEventCollection.find(query);
}

private void appendTargetFilter(ElementGroup targetGraphGroupElem, URI target) throws Exception {
if (target != null) {

Var uriVar = SPARQLQueryHelper.makeVar(MoveModel.URI_FIELD);
Var targetVar = SPARQLQueryHelper.makeVar(MoveModel.TARGET_FIELD);

Triple targetTriple = new Triple(uriVar, Oeev.concerns.asNode(), targetVar);

targetGraphGroupElem.addTriplePattern(targetTriple);

Expr targetEqExpr = SPARQLQueryHelper.eq(MoveModel.TARGET_FIELD, target);
targetGraphGroupElem.addElementFilter(new ElementFilter(targetEqExpr));
}

}

/**
* Count total of moves associated to a target URI
Expand All @@ -640,11 +625,7 @@ public int countMoves(URI target) throws Exception {

Node moveGraph = sparql.getDefaultGraph(MoveModel.class);
return sparql.count(moveGraph, MoveModel.class,null,countBuilder -> {

ElementGroup rootElementGroup = countBuilder.getWhereHandler().getClause();
ElementGroup moveGraphGroupElem = SPARQLQueryHelper.getSelectOrCreateGraphElementGroup(rootElementGroup,moveGraph);

appendTargetFilter(moveGraphGroupElem, target);
super.appendInTargetsValuesInner(countBuilder, Stream.of(target), 1, moveGraph);
},null);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,6 @@
)
public class MoveModel extends EventModel {

@SPARQLProperty(
ontology = OA.class,
property = "hasTarget"
)
private List<URI> target;
public static final String TARGET_FIELD = "target";

@SPARQLProperty(
ontology = Oeev.class,
Expand Down Expand Up @@ -63,15 +57,6 @@ public void setFrom(FacilityModel from) {
this.from = from;
}

public List<URI> getTarget() {
return target;
}

public void setTarget(List<URI> target) {
this.target = target;
}


public MoveEventNoSqlModel getNoSqlModel() {
return noSqlModel;
}
Expand Down
14 changes: 0 additions & 14 deletions opensilex-core/src/main/resources/ontologies/oeso-core.owl
Original file line number Diff line number Diff line change
Expand Up @@ -1640,13 +1640,6 @@ OESO</rdfs:label>
<owl:onDataRange rdf:resource="http://www.w3.org/2001/XMLSchema#boolean"/>
</owl:Restriction>
</rdfs:subClassOf>
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource="http://www.w3.org/2000/01/rdf-schema#label"/>
<owl:qualifiedCardinality rdf:datatype="http://www.w3.org/2001/XMLSchema#nonNegativeInteger">1</owl:qualifiedCardinality>
<owl:onDataRange rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
</owl:Restriction>
</rdfs:subClassOf>
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource="http://www.w3.org/2000/01/rdf-schema#comment"/>
Expand Down Expand Up @@ -1721,13 +1714,6 @@ OESO</rdfs:label>
<owl:onClass rdf:resource="http://www.opensilex.org/vocabulary/oeso#Facility"/>
</owl:Restriction>
</rdfs:subClassOf>
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource="http://www.w3.org/ns/oa#hasTarget"/>
<owl:minQualifiedCardinality rdf:datatype="http://www.w3.org/2001/XMLSchema#nonNegativeInteger">0</owl:minQualifiedCardinality>
<owl:onDataRange rdf:resource="http://www.w3.org/2001/XMLSchema#anyURI"/>
</owl:Restriction>
</rdfs:subClassOf>
</owl:Class>


Expand Down
6 changes: 6 additions & 0 deletions opensilex-doc/src/main/resources/release/1.3.3.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Migrate to 1.3.3


## Reset ontologies

You will need to update the ontologies on your triple store for the fix to work.

0 comments on commit 50eb4a5

Please sign in to comment.