From bca3e0a3554d68291a6912e81f48484b5301b94a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Aur=C3=A9lien=20Lamercerie?=
 <aurelien.lamercerie@laposte.net>
Date: Thu, 2 Sep 2021 11:03:31 +0200
Subject: [PATCH] Fix perf problem in some queries

---
 config/transduction-schemes.ttl | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/config/transduction-schemes.ttl b/config/transduction-schemes.ttl
index 357a3d82..70b19cc2 100644
--- a/config/transduction-schemes.ttl
+++ b/config/transduction-schemes.ttl
@@ -390,6 +390,8 @@ WHERE {
    ?net1 net:node ?uw1.
    ?net1 net:entityClass ?entityClass.
    ?net1 net:concept ?mainEntity.	
+   # condition: mod(net1, net2)
+   ?uw1 unl:mod ?uw2.
    # net2: complement modList
    ?net2 a net:Instance.
    ?net2 net:type net:complement_mod_list.
@@ -400,8 +402,6 @@ WHERE {
    # --old --- ?net2 net:concept ?subConcept.	
    # Filter
    FILTER ( ?uw1 != ?uw3  ).
-   # condition: mod(net1, net2)
-   ?uw1 unl:mod ?uw2.
    # UW: type UW-Occurrence and substructure of req sentence
    # --old --- ?uw1 rdf:type unl:UW_Occurrence.
    # --old --- ?uw2 rdf:type unl:UW_Occurrence.
@@ -459,6 +459,8 @@ WHERE {
    ?net1 net:node ?uw1.
    ?net1 net:entityClass ?entityClass1.
    ?net1 net:concept ?mainEntity.	
+   # condition: mod(net1, net2)
+   ?uw1 unl:mod ?uw2.
    # net2: entity modList
    ?net2 a net:Instance.
    ?net2 net:type net:entity_mod_list.
@@ -472,8 +474,6 @@ WHERE {
    # Filter
    FILTER ( ?uw1 != ?uw3  ).
    FILTER ( ?entityClass1 != ?entityClass2  ).
-   # condition: mod(net1, net2)
-   ?uw1 unl:mod ?uw2.
    # UW: type UW-Occurrence and substructure of req sentence
    # --old --- ?uw1 rdf:type unl:UW_Occurrence.
    # --old --- ?uw2 rdf:type unl:UW_Occurrence.
@@ -531,6 +531,8 @@ WHERE {
    ?net1 net:node ?uw1.
    ?net1 net:entityClass ?entityClass1.
    ?net1 net:concept ?mainEntity.	
+   # condition: mod(net1, net2)
+   ?uw1 unl:mod ?uw2.
    # net2: entity modList
    ?net2 a net:Instance.
    ?net2 net:type net:entity_mod_list.
@@ -543,8 +545,6 @@ WHERE {
    # Filter
    FILTER ( ?uw1 != ?uw3  ).
    FILTER ( ?entityClass1 = ?entityClass2  ).
-   # condition: mod(net1, net2)
-   ?uw1 unl:mod ?uw2.
    # UW: type UW-Occurrence and substructure of req sentence
    # --old --- ?uw1 rdf:type unl:UW_Occurrence.
    # --old --- ?uw2 rdf:type unl:UW_Occurrence.
@@ -792,12 +792,13 @@ CONSTRUCT {
 }
 WHERE {
    # UW: type UW-Occurrence and substructure of req sentence
-   ?uwSource rdf:type unl:UW_Occurrence.
+   ?uw0 rdf:type unl:UW_Occurrence.
+   ?uw0 unl:is_substructure_of ?req.
+   # selection: target UW of modifier (mod)
+   ?uw0 unl:mod ?uw1.
+   # UW: type UW-Occurrence and substructure of req sentence
    ?uw1 rdf:type unl:UW_Occurrence.
-   ?uwSource unl:is_substructure_of ?req.
    ?uw1 unl:is_substructure_of ?req.
-   # selection: target UW of modifier (mod)
-   ?uwSource unl:mod ?uw1.
    # Label(s) / URI
    ?uw1 rdfs:label ?uw1Label.
    cprm:Config_Parameters cprm:netURI ?netURI.
-- 
GitLab