Skip to content
Snippets Groups Projects
Commit 5359ebdb authored by Daniel's avatar Daniel
Browse files

MAINT: Refactoring for new upstream repository

parent e8365df6
No related branches found
No related tags found
No related merge requests found
......@@ -23,7 +23,7 @@
#
variables:
CI_REGISTRY_IMAGE: $CI_REGISTRY/caosdb-mysqlbackend-testenv:latest
CI_REGISTRY_IMAGE: $CI_REGISTRY/caosdb-sqlbackend-testenv:latest
# With dind the docker deamon is available on the network
DOCKER_HOST: tcp://docker:2375/
# When using dind, it's wise to use the overlayfs driver for
......@@ -45,8 +45,8 @@ trigger_build:
script:
- /usr/bin/curl -X POST
-F token=8f29e5eeb7db2123d9c2bb84634da2
-F "variables[MYSQLBACKEND]=$CI_COMMIT_REF_NAME"
-F "variables[TriggerdBy]=MYSQLBACKEND"
-F "variables[SQLBACKEND]=$CI_COMMIT_REF_NAME"
-F "variables[TriggerdBy]=SQLBACKEND"
-F "variables[TriggerdByHash]=$CI_COMMIT_SHORT_SHA"
-F ref=master https://gitlab.indiscale.com/api/v4/projects/14/trigger/pipeline
......
......@@ -14,7 +14,7 @@ setup this code.
# Further Reading
Please refer to the [official gitlab repository of the CaosDB
project](https://gitlab.gwdg.de/bmp-caosdb/caosdb) for more information.
project](https://gitlab.com/caosdb/caosdb) for more information.
# License
......
# Multipurpose subdomains #
Multipurpose subdomains are generically used to work with composite
properties. Currently implemented examples are:
- Properties with units (if multiple Properties exist)
- Lists
- Name overrides
## Example ##
Let's have a look at this *Record* (simplified XML):
```xml
<R1>
<P1 name="Comment">Hello World</P1>
<P2 name="voltage" unit="V">
23
</P2>
<P3 comment="list of something">
V1, V2, V3, V4, ...
</P3>
</R1>
```
......@@ -22,6 +22,21 @@
*/
SET @@SESSION.max_sp_recursion_depth=25;
-- Inheritance:
--
-- 0
-- |
-- 1
-- |
-- 2
-- / \
-- 3 4
-- \ /
-- 5
-- |
-- 6
--
SET FOREIGN_KEY_CHECKS = 0;
delete from isa_cache;
-- simple 1->0
......@@ -203,7 +218,7 @@ call isSubtype(1,2);
call isSubtype(0,2);
call isSubtype(0,1);
-- remove 2->1
-- remove 2->1
CREATE TEMPORARY TABLE expected1 SELECT * from isa_cache;
call deleteIsa(2);
select "subtypes:";
......@@ -253,7 +268,7 @@ call isSubtype(0,1);
-- and add 2->1 again
call insertIsa(2,1);
SELECT A.*, B.* FROM isa_cache AS A LEFT JOIN expected1 AS B ON (A.child = B.child AND A.parent=B.parent AND A.rpath=B.rpath) WHERE A.child IS NULL OR B.child IS NULL;
SELECT A.*, B.* FROM isa_cache AS A LEFT JOIN expected1 AS B ON (A.child = B.child AND A.parent=B.parent AND A.rpath=B.rpath) WHERE A.child IS NULL OR B.child IS NULL;
SELECT A.*, B.* FROM isa_cache AS A RIGHT JOIN expected1 AS B ON (A.child = B.child AND A.parent=B.parent AND A.rpath=B.rpath) WHERE A.child IS NULL OR B.child IS NULL;
-- remove 4->2
......@@ -306,7 +321,7 @@ call isSubtype(5,6);
-- and add 4->2 again
call insertIsa(4,2);
SELECT A.*, B.* FROM isa_cache AS A LEFT JOIN expected1 AS B ON (A.child = B.child AND A.parent=B.parent AND A.rpath=B.rpath) WHERE A.child IS NULL OR B.child IS NULL;
SELECT A.*, B.* FROM isa_cache AS A LEFT JOIN expected1 AS B ON (A.child = B.child AND A.parent=B.parent AND A.rpath=B.rpath) WHERE A.child IS NULL OR B.child IS NULL;
SELECT A.*, B.* FROM isa_cache AS A RIGHT JOIN expected1 AS B ON (A.child = B.child AND A.parent=B.parent AND A.rpath=B.rpath) WHERE A.child IS NULL OR B.child IS NULL;
-- remove 5->4 and 5->3
......@@ -407,7 +422,7 @@ call isSubtype(6,3);
-- and add 5->3 again
call insertIsa(5,3);
SELECT A.*, B.* FROM isa_cache AS A LEFT JOIN expected1 AS B ON (A.child = B.child AND A.parent=B.parent AND A.rpath=B.rpath) WHERE A.child IS NULL OR B.child IS NULL;
SELECT A.*, B.* FROM isa_cache AS A LEFT JOIN expected1 AS B ON (A.child = B.child AND A.parent=B.parent AND A.rpath=B.rpath) WHERE A.child IS NULL OR B.child IS NULL;
SELECT A.*, B.* FROM isa_cache AS A RIGHT JOIN expected1 AS B ON (A.child = B.child AND A.parent=B.parent AND A.rpath=B.rpath) WHERE A.child IS NULL OR B.child IS NULL;
-- add cycle 0->3
......@@ -428,7 +443,7 @@ call isSubtype(3,2);
-- remove cycle 0->3
call deleteIsa(0);
SELECT A.*, B.* FROM isa_cache AS A LEFT JOIN expected1 AS B ON (A.child = B.child AND A.parent=B.parent AND A.rpath=B.rpath) WHERE A.child IS NULL OR B.child IS NULL;
SELECT A.*, B.* FROM isa_cache AS A LEFT JOIN expected1 AS B ON (A.child = B.child AND A.parent=B.parent AND A.rpath=B.rpath) WHERE A.child IS NULL OR B.child IS NULL;
SELECT A.*, B.* FROM isa_cache AS A RIGHT JOIN expected1 AS B ON (A.child = B.child AND A.parent=B.parent AND A.rpath=B.rpath) WHERE A.child IS NULL OR B.child IS NULL;
call deleteIsa(1);
......
......@@ -30,11 +30,33 @@ BEGIN
-- foreach supertype of p
-- INSERT (c, supertype, p);
INSERT IGNORE INTO isa_cache SELECT c AS child, i.parent AS parent, IF(p=i.rpath or i.rpath=parent, p, concat(p, ">", i.rpath)) AS rpath FROM isa_cache AS i WHERE i.child = p;
INSERT IGNORE INTO isa_cache SELECT
c
AS child,
i.parent
AS parent,
IF(p=i.rpath or i.rpath=parent,
p,
concat(p, ">", i.rpath))
AS rpath
FROM isa_cache AS i WHERE i.child = p;
-- foreach subtype of c insert each supertype of p
INSERT IGNORE INTO isa_cache SELECT l.child, r.parent, if(l.rpath=l.child and r.rpath=c, c, concat(if(l.rpath=l.child,c,concat(l.rpath, '>', c)), if(r.rpath=c,'',concat('>', r.rpath)))) AS rpath FROM isa_cache as l INNER JOIN isa_cache as r ON (l.parent = r.child AND l.parent=c);
INSERT IGNORE INTO isa_cache SELECT
l.child,
r.parent,
if(l.rpath=l.child and r.rpath=c,
c,
concat(if(l.rpath=l.child,
c,
concat(l.rpath, '>', c)),
if(r.rpath=c,
'',
concat('>', r.rpath))))
AS rpath
FROM isa_cache as l
INNER JOIN isa_cache as r ON (l.parent = r.child AND l.parent=c);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment