Skip to content
Snippets Groups Projects
Verified Commit 07c540b1 authored by Daniel Hornung's avatar Daniel Hornung
Browse files

STY: Mainly styling and typos.

parent 28ffe80a
No related branches found
No related tags found
3 merge requests!17Release 6.0,!15External String IDs,!11DRAFT: file system cleanup
Pipeline #42075 passed
...@@ -51,7 +51,7 @@ This is a major update. Switching from integer ids for internal and external use ...@@ -51,7 +51,7 @@ This is a major update. Switching from integer ids for internal and external use
### Removed ### ### Removed ###
* Deactivate procedure `delete_all_entity_versions`. This might be used in the * Deactivate procedure `delete_all_entity_versions`. This might be used in the
future, that why we keep the code in a comment. future, that is why we keep the code in a comment.
* Drop procedure `retrieveSubEntity` * Drop procedure `retrieveSubEntity`
* Drop procedure `retrieveDatatype` * Drop procedure `retrieveDatatype`
* Drop procedure `retrieveGroup` * Drop procedure `retrieveGroup`
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
# #
# This file is a part of the CaosDB Project. # This file is a part of the CaosDB Project.
# #
# Copyright (C) 2022 IndiScale GmbH <info@indiscale.com> # Copyright (C) 2023 IndiScale GmbH <info@indiscale.com>
# Copyright (C) 2022 Timm Fitschen <t.fitschen@indiscale.com> # Copyright (C) 2023 Timm Fitschen <t.fitschen@indiscale.com>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
......
...@@ -26,10 +26,10 @@ DROP PROCEDURE IF EXISTS db_5_0.getDependentEntities; ...@@ -26,10 +26,10 @@ DROP PROCEDURE IF EXISTS db_5_0.getDependentEntities;
delimiter // delimiter //
/* /*
* Return all entities which either reference the given entity, use the given * * Return all entities which either reference the given entity, use the given
* reference as data type, or are direct children of the given entity. * reference as data type, or are direct children of the given entity.
* *
* This function is being used to make sure that no entity can be deleted which * This function used to make sure that no entity can be deleted which
* is still needed by others. * is still needed by others.
* *
* Parameters * Parameters
...@@ -47,48 +47,48 @@ BEGIN ...@@ -47,48 +47,48 @@ BEGIN
DECLARE InternalEntityID INT UNSIGNED DEFAULT NULL; DECLARE InternalEntityID INT UNSIGNED DEFAULT NULL;
DROP TEMPORARY TABLE IF EXISTS refering; DROP TEMPORARY TABLE IF EXISTS referring;
CREATE TEMPORARY TABLE refering ( CREATE TEMPORARY TABLE referring (
id INT UNSIGNED UNIQUE id INT UNSIGNED UNIQUE
); );
SELECT internal_id INTO InternalEntityID from entity_ids WHERE id = EntityID; SELECT internal_id INTO InternalEntityID from entity_ids WHERE id = EntityID;
INSERT IGNORE INTO refering (id) SELECT entity_id FROM reference_data WHERE (value=InternalEntityID OR property_id=InternalEntityID) AND domain_id=0 AND entity_id!=InternalEntityID; INSERT IGNORE INTO referring (id) SELECT entity_id FROM reference_data WHERE (value=InternalEntityID OR property_id=InternalEntityID) AND domain_id=0 AND entity_id!=InternalEntityID;
INSERT IGNORE INTO refering (id) SELECT domain_id FROM reference_data WHERE (value=InternalEntityID OR property_id=InternalEntityID) AND domain_id!=InternalEntityID AND entity_id!=InternalEntityID AND domain_id!=0; INSERT IGNORE INTO referring (id) SELECT domain_id FROM reference_data WHERE (value=InternalEntityID OR property_id=InternalEntityID) AND domain_id!=InternalEntityID AND entity_id!=InternalEntityID AND domain_id!=0;
INSERT IGNORE INTO refering (id) SELECT entity_id FROM text_data WHERE property_id=InternalEntityID AND domain_id=0 AND entity_id!=InternalEntityID; INSERT IGNORE INTO referring (id) SELECT entity_id FROM text_data WHERE property_id=InternalEntityID AND domain_id=0 AND entity_id!=InternalEntityID;
INSERT IGNORE INTO refering (id) SELECT domain_id FROM text_data WHERE property_id=InternalEntityID AND domain_id!=InternalEntityID AND entity_id!=InternalEntityID AND domain_id!=0; INSERT IGNORE INTO referring (id) SELECT domain_id FROM text_data WHERE property_id=InternalEntityID AND domain_id!=InternalEntityID AND entity_id!=InternalEntityID AND domain_id!=0;
INSERT IGNORE INTO refering (id) SELECT entity_id FROM enum_data WHERE property_id=InternalEntityID AND domain_id=0 AND entity_id!=InternalEntityID; INSERT IGNORE INTO referring (id) SELECT entity_id FROM enum_data WHERE property_id=InternalEntityID AND domain_id=0 AND entity_id!=InternalEntityID;
INSERT IGNORE INTO refering (id) SELECT domain_id FROM enum_data WHERE property_id=InternalEntityID AND domain_id!=InternalEntityID AND entity_id!=InternalEntityID AND domain_id!=0; INSERT IGNORE INTO referring (id) SELECT domain_id FROM enum_data WHERE property_id=InternalEntityID AND domain_id!=InternalEntityID AND entity_id!=InternalEntityID AND domain_id!=0;
INSERT IGNORE INTO refering (id) SELECT entity_id FROM name_data WHERE property_id=InternalEntityID AND domain_id=0 AND entity_id!=InternalEntityID; INSERT IGNORE INTO referring (id) SELECT entity_id FROM name_data WHERE property_id=InternalEntityID AND domain_id=0 AND entity_id!=InternalEntityID;
INSERT IGNORE INTO refering (id) SELECT domain_id FROM name_data WHERE property_id=InternalEntityID AND domain_id!=InternalEntityID AND entity_id!=InternalEntityID AND domain_id!=0; INSERT IGNORE INTO referring (id) SELECT domain_id FROM name_data WHERE property_id=InternalEntityID AND domain_id!=InternalEntityID AND entity_id!=InternalEntityID AND domain_id!=0;
INSERT IGNORE INTO refering (id) SELECT entity_id FROM integer_data WHERE property_id=InternalEntityID AND domain_id=0 AND entity_id!=InternalEntityID; INSERT IGNORE INTO referring (id) SELECT entity_id FROM integer_data WHERE property_id=InternalEntityID AND domain_id=0 AND entity_id!=InternalEntityID;
INSERT IGNORE INTO refering (id) SELECT domain_id FROM integer_data WHERE property_id=InternalEntityID AND domain_id!=InternalEntityID AND entity_id!=InternalEntityID AND domain_id!=0; INSERT IGNORE INTO referring (id) SELECT domain_id FROM integer_data WHERE property_id=InternalEntityID AND domain_id!=InternalEntityID AND entity_id!=InternalEntityID AND domain_id!=0;
INSERT IGNORE INTO refering (id) SELECT entity_id FROM double_data WHERE property_id=InternalEntityID AND domain_id=0 AND entity_id!=InternalEntityID; INSERT IGNORE INTO referring (id) SELECT entity_id FROM double_data WHERE property_id=InternalEntityID AND domain_id=0 AND entity_id!=InternalEntityID;
INSERT IGNORE INTO refering (id) SELECT domain_id FROM double_data WHERE property_id=InternalEntityID AND domain_id!=InternalEntityID AND entity_id!=InternalEntityID AND domain_id!=0; INSERT IGNORE INTO referring (id) SELECT domain_id FROM double_data WHERE property_id=InternalEntityID AND domain_id!=InternalEntityID AND entity_id!=InternalEntityID AND domain_id!=0;
INSERT IGNORE INTO refering (id) SELECT entity_id FROM datetime_data WHERE property_id=InternalEntityID AND domain_id=0 AND entity_id!=InternalEntityID; INSERT IGNORE INTO referring (id) SELECT entity_id FROM datetime_data WHERE property_id=InternalEntityID AND domain_id=0 AND entity_id!=InternalEntityID;
INSERT IGNORE INTO refering (id) SELECT domain_id FROM datetime_data WHERE property_id=InternalEntityID AND domain_id!=InternalEntityID AND entity_id!=InternalEntityID AND domain_id!=0; INSERT IGNORE INTO referring (id) SELECT domain_id FROM datetime_data WHERE property_id=InternalEntityID AND domain_id!=InternalEntityID AND entity_id!=InternalEntityID AND domain_id!=0;
INSERT IGNORE INTO refering (id) SELECT entity_id FROM date_data WHERE property_id=InternalEntityID AND domain_id=0 AND entity_id!=InternalEntityID; INSERT IGNORE INTO referring (id) SELECT entity_id FROM date_data WHERE property_id=InternalEntityID AND domain_id=0 AND entity_id!=InternalEntityID;
INSERT IGNORE INTO refering (id) SELECT domain_id FROM date_data WHERE property_id=InternalEntityID AND domain_id!=InternalEntityID AND entity_id!=InternalEntityID AND domain_id!=0; INSERT IGNORE INTO referring (id) SELECT domain_id FROM date_data WHERE property_id=InternalEntityID AND domain_id!=InternalEntityID AND entity_id!=InternalEntityID AND domain_id!=0;
INSERT IGNORE INTO refering (id) SELECT entity_id FROM null_data WHERE property_id=InternalEntityID AND domain_id=0 AND entity_id!=InternalEntityID; INSERT IGNORE INTO referring (id) SELECT entity_id FROM null_data WHERE property_id=InternalEntityID AND domain_id=0 AND entity_id!=InternalEntityID;
INSERT IGNORE INTO refering (id) SELECT domain_id FROM null_data WHERE property_id=InternalEntityID AND domain_id!=InternalEntityID AND entity_id!=InternalEntityID AND domain_id!=0; INSERT IGNORE INTO referring (id) SELECT domain_id FROM null_data WHERE property_id=InternalEntityID AND domain_id!=InternalEntityID AND entity_id!=InternalEntityID AND domain_id!=0;
INSERT IGNORE INTO refering (id) SELECT entity_id from data_type WHERE datatype=InternalEntityID AND domain_id=0 AND entity_id!=InternalEntityID; INSERT IGNORE INTO referring (id) SELECT entity_id from data_type WHERE datatype=InternalEntityID AND domain_id=0 AND entity_id!=InternalEntityID;
INSERT IGNORE INTO refering (id) SELECT domain_id from data_type WHERE datatype=InternalEntityID; INSERT IGNORE INTO referring (id) SELECT domain_id from data_type WHERE datatype=InternalEntityID;
INSERT IGNORE INTO refering (id) SELECT child FROM isa_cache WHERE parent = InternalEntityID AND rpath=child; INSERT IGNORE INTO referring (id) SELECT child FROM isa_cache WHERE parent = InternalEntityID AND rpath = child;
SELECT e.id FROM refering AS r LEFT JOIN entity_ids AS e ON r.id = e.internal_id WHERE r.id!=0 AND e.internal_id!=InternalEntityID; SELECT e.id FROM referring AS r LEFT JOIN entity_ids AS e ON r.id = e.internal_id WHERE r.id!=0 AND e.internal_id!=InternalEntityID;
DROP TEMPORARY TABLE refering; DROP TEMPORARY TABLE referring;
END; END;
// //
......
...@@ -53,7 +53,7 @@ BEGIN ...@@ -53,7 +53,7 @@ BEGIN
DECLARE Transaction VARBINARY(255) DEFAULT NULL; DECLARE Transaction VARBINARY(255) DEFAULT NULL;
DECLARE InternalEntityID INT UNSIGNED DEFAULT NULL; DECLARE InternalEntityID INT UNSIGNED DEFAULT NULL;
-- insert the acl. the new acl id is being written (c-style) into the -- insert the acl. The new acl id is written (c-style) into the
-- variable NewACLID. -- variable NewACLID.
call entityACL(NewACLID, ACL); call entityACL(NewACLID, ACL);
......
...@@ -26,12 +26,12 @@ DELIMITER // ...@@ -26,12 +26,12 @@ DELIMITER //
/* /*
* Create and initialize two new temporary tables. * Create and initialize two new temporary tables.
* *
* This is being used to initialize the filterin for backreferences to a * This is used to initialize the filterin for backreferences to a
* particular entity (specified by EntityID or EntityName) or using a * particular entity (specified by EntityID or EntityName) or using a
* particular property (specified by PropertyID or PropertyName). * particular property (specified by PropertyID or PropertyName).
* *
* The propertiesTable contains all properties matching the PropertyID or * The propertiesTable contains all properties matching the PropertyID or
* PropertyName. The entitiesTable container all entities matching EntityID or * PropertyName. The entitiesTable contains all entities matching EntityID or
* EntityName. * EntityName.
* Parameters * Parameters
......
...@@ -27,8 +27,8 @@ DROP PROCEDURE IF EXISTS db_5_0.initPOVPropertiesTable// ...@@ -27,8 +27,8 @@ DROP PROCEDURE IF EXISTS db_5_0.initPOVPropertiesTable//
/* /*
* Create and initialize a new temporary table. * Create and initialize a new temporary table.
* *
* This is being used to initialize the POV filtering. The resulting table * This is used to initialize the POV filtering. The resulting table
* container all properties machting the Property component of the POV filter. * contains all properties matching the Property component of the POV filter.
* *
* Parameters * Parameters
* ---------- * ----------
...@@ -112,8 +112,8 @@ DROP PROCEDURE IF EXISTS db_5_0.initPOVRefidsTable // ...@@ -112,8 +112,8 @@ DROP PROCEDURE IF EXISTS db_5_0.initPOVRefidsTable //
/* /*
* Create and initialize a new temporary table. * Create and initialize a new temporary table.
* *
* This is being used to initialize the POV filtering. The resulting table * This used to initialize the POV filtering. The resulting table
* container all entities machting the Value component of the POV filter (i.e. * contains all entities matching the Value component of the POV filter (i.e.
* the referenced entities). * the referenced entities).
* *
* Parameters * Parameters
......
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
* *
* Copyright (C) 2018 Research Group Biomedical Physics, * Copyright (C) 2018 Research Group Biomedical Physics,
* Max-Planck-Institute for Dynamics and Self-Organization Göttingen * Max-Planck-Institute for Dynamics and Self-Organization Göttingen
* Copyright (C) 2023 IndiScale GmbH <info@indiscale.com>
* Copyright (C) 2023 Timm Fitschen <t.fitschen@indiscale.com>
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
...@@ -24,7 +26,7 @@ DROP PROCEDURE IF EXISTS db_5_0.initSubEntity; ...@@ -24,7 +26,7 @@ DROP PROCEDURE IF EXISTS db_5_0.initSubEntity;
DELIMITER // DELIMITER //
/* /*
* Initialize a new temporary by loading an entity and all of it's children * Initialize a new temporary table by loading an entity and all of its children
* into the table (i.e. their internal ids). * into the table (i.e. their internal ids).
* *
* This is used by initPOVRefidsTable and initBackReference for sub-property filtering. * This is used by initPOVRefidsTable and initBackReference for sub-property filtering.
......
...@@ -24,7 +24,7 @@ DROP PROCEDURE IF EXISTS db_5_0.retrieveOverrides; ...@@ -24,7 +24,7 @@ DROP PROCEDURE IF EXISTS db_5_0.retrieveOverrides;
delimiter // delimiter //
/* /*
* Retrieve the overriden (overwriting the Abstract Property's) name, description, and datatype. * Retrieve the overridden (overriding the Abstract Property's) name, description, and datatype.
* *
* Parameters * Parameters
* ---------- * ----------
...@@ -44,7 +44,7 @@ delimiter // ...@@ -44,7 +44,7 @@ delimiter //
* type_override, # the datatype, e.g. DOUBLE * type_override, # the datatype, e.g. DOUBLE
* entity_id, # same as input EntityID * entity_id, # same as input EntityID
* InternalPropertyID, # internal property id, to be used when property_id * InternalPropertyID, # internal property id, to be used when property_id
* # is NULL because a replacement is being using. * # is NULL because a replacement is used.
* property_id, # the property id * property_id, # the property id
*/ */
CREATE PROCEDURE db_5_0.retrieveOverrides( CREATE PROCEDURE db_5_0.retrieveOverrides(
...@@ -62,7 +62,9 @@ retrieveOverridesBody: BEGIN ...@@ -62,7 +62,9 @@ retrieveOverridesBody: BEGIN
-- which are internal ids by definition (and do not have external -- which are internal ids by definition (and do not have external
-- equivalents). That's why we do the UNION here, falling back to the -- equivalents). That's why we do the UNION here, falling back to the
-- EntityID. -- EntityID.
SELECT temp.internal_id INTO InternalEntityID FROM (SELECT internal_id AS internal_id FROM entity_ids WHERE id = EntityID UNION SELECT EntityID AS internal_id) AS temp LIMIT 1; SELECT temp.internal_id INTO InternalEntityID
FROM (SELECT internal_id AS internal_id FROM
entity_ids WHERE id = EntityID UNION SELECT EntityID AS internal_id) AS temp LIMIT 1;
-- DomainID != 0 are always normal (i.e. external) Entity ids. -- DomainID != 0 are always normal (i.e. external) Entity ids.
SELECT internal_id INTO InternalDomainID from entity_ids WHERE id = DomainID; SELECT internal_id INTO InternalDomainID from entity_ids WHERE id = DomainID;
......
...@@ -42,7 +42,7 @@ drop procedure if exists db_5_0.retrieveEntityProperties // ...@@ -42,7 +42,7 @@ drop procedure if exists db_5_0.retrieveEntityProperties //
* --------- * ---------
* InternalPropertyID * InternalPropertyID
* Internal property id, to be used when PropertyID * Internal property id, to be used when PropertyID
* is NULL because a replacement is being using. * is NULL because a replacement is used.
* PropertyID * PropertyID
* The property id * The property id
* PropertyValue * PropertyValue
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment