diff --git a/CHANGELOG.md b/CHANGELOG.md index 5bc1533ad0daaf92801a07ad69d9330590e59fbf..d674221f0d4de2c6584d2ca68335b1caa9d1d39d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -51,7 +51,7 @@ This is a major update. Switching from integer ids for internal and external use ### Removed ### * 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 `retrieveDatatype` * Drop procedure `retrieveGroup` diff --git a/patches/patch20221122-6.0-SNAPSHOT/patch.sh b/patches/patch20221122-6.0-SNAPSHOT/patch.sh index 7348ac0cff33b557b4251ee35f3e64ae87ccc86a..54208ab713ae9cc7bc6db8ae7501f1266e2bec86 100755 --- a/patches/patch20221122-6.0-SNAPSHOT/patch.sh +++ b/patches/patch20221122-6.0-SNAPSHOT/patch.sh @@ -2,8 +2,8 @@ # # This file is a part of the CaosDB Project. # -# Copyright (C) 2022 IndiScale GmbH <info@indiscale.com> -# Copyright (C) 2022 Timm Fitschen <t.fitschen@indiscale.com> +# 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 # it under the terms of the GNU Affero General Public License as diff --git a/procedures/getDependentEntities.sql b/procedures/getDependentEntities.sql index 6272fd00f9329e3f176563d8fce01a63e0849d20..0940e440661c0d73f2eea03e3e10d10082c9eb9e 100644 --- a/procedures/getDependentEntities.sql +++ b/procedures/getDependentEntities.sql @@ -26,10 +26,10 @@ DROP PROCEDURE IF EXISTS db_5_0.getDependentEntities; 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. * - * 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. * * Parameters @@ -47,48 +47,48 @@ BEGIN DECLARE InternalEntityID INT UNSIGNED DEFAULT NULL; - DROP TEMPORARY TABLE IF EXISTS refering; - CREATE TEMPORARY TABLE refering ( + DROP TEMPORARY TABLE IF EXISTS referring; + CREATE TEMPORARY TABLE referring ( id INT UNSIGNED UNIQUE ); 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 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 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 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 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 entity_id FROM text_data WHERE property_id=InternalEntityID AND domain_id=0 AND entity_id!=InternalEntityID; + 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 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 entity_id FROM enum_data WHERE property_id=InternalEntityID AND domain_id=0 AND entity_id!=InternalEntityID; + 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 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 entity_id FROM name_data WHERE property_id=InternalEntityID AND domain_id=0 AND entity_id!=InternalEntityID; + 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 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 entity_id FROM integer_data WHERE property_id=InternalEntityID AND domain_id=0 AND entity_id!=InternalEntityID; + 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 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 entity_id FROM double_data WHERE property_id=InternalEntityID AND domain_id=0 AND entity_id!=InternalEntityID; + 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 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 entity_id FROM datetime_data WHERE property_id=InternalEntityID AND domain_id=0 AND entity_id!=InternalEntityID; + 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 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 entity_id FROM date_data WHERE property_id=InternalEntityID AND domain_id=0 AND entity_id!=InternalEntityID; + 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 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 entity_id FROM null_data WHERE property_id=InternalEntityID AND domain_id=0 AND entity_id!=InternalEntityID; + 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 refering (id) SELECT domain_id from data_type WHERE datatype=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 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; // diff --git a/procedures/insertEntity.sql b/procedures/insertEntity.sql index 4b385f202e66b8dea2a8ebe1aa66322718e629a9..816fe8bae65c8a92569d4229993815d6ac0634af 100644 --- a/procedures/insertEntity.sql +++ b/procedures/insertEntity.sql @@ -53,7 +53,7 @@ BEGIN DECLARE Transaction VARBINARY(255) 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. call entityACL(NewACLID, ACL); diff --git a/procedures/overrideName.sql b/procedures/overrideName.sql index b651c49ac5036c76bd86b9cb6e643753896654cd..cbd74fd00de550630e8a402b048cbc242479389c 100644 --- a/procedures/overrideName.sql +++ b/procedures/overrideName.sql @@ -26,7 +26,7 @@ DROP PROCEDURE IF EXISTS db_5_0.overrideType; DELIMITER // /* - *Insert a name override. + * Insert a name override. * * Parameters * ---------- diff --git a/procedures/query/initBackReference.sql b/procedures/query/initBackReference.sql index 0a5be1b455710d14e372a8e8916bb7ee4df0c9ac..2999fb999615ffc47879dfda2a9f89e6b2b387d5 100644 --- a/procedures/query/initBackReference.sql +++ b/procedures/query/initBackReference.sql @@ -26,12 +26,12 @@ DELIMITER // /* * 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 property (specified by PropertyID or PropertyName). * * 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. * Parameters diff --git a/procedures/query/initPOV.sql b/procedures/query/initPOV.sql index 69713297aa00680c0179bc6d34f37596801d4fe9..31347ba9a7f2cde33e619e50e7721875232b8628 100644 --- a/procedures/query/initPOV.sql +++ b/procedures/query/initPOV.sql @@ -27,8 +27,8 @@ DROP PROCEDURE IF EXISTS db_5_0.initPOVPropertiesTable// /* * Create and initialize a new temporary table. * - * This is being used to initialize the POV filtering. The resulting table - * container all properties machting the Property component of the POV filter. + * This is used to initialize the POV filtering. The resulting table + * contains all properties matching the Property component of the POV filter. * * Parameters * ---------- @@ -112,8 +112,8 @@ DROP PROCEDURE IF EXISTS db_5_0.initPOVRefidsTable // /* * Create and initialize a new temporary table. * - * This is being used to initialize the POV filtering. The resulting table - * container all entities machting the Value component of the POV filter (i.e. + * This used to initialize the POV filtering. The resulting table + * contains all entities matching the Value component of the POV filter (i.e. * the referenced entities). * * Parameters diff --git a/procedures/query/initSubEntity.sql b/procedures/query/initSubEntity.sql index 6bddd134fab294e8e5d093889fd77ffc4dba522e..c60ddb61df7370f52ae8218720ad69c5d2bf5023 100644 --- a/procedures/query/initSubEntity.sql +++ b/procedures/query/initSubEntity.sql @@ -3,6 +3,8 @@ * * Copyright (C) 2018 Research Group Biomedical Physics, * 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 * it under the terms of the GNU Affero General Public License as @@ -24,7 +26,7 @@ DROP PROCEDURE IF EXISTS db_5_0.initSubEntity; 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). * * This is used by initPOVRefidsTable and initBackReference for sub-property filtering. diff --git a/procedures/retrieveEntityOverrides.sql b/procedures/retrieveEntityOverrides.sql index 61a28a0d610a7e3e25d01dd32d2ab748b2eabe50..f552a2c3b7ceafae5255ee69655af426f44b8bb7 100644 --- a/procedures/retrieveEntityOverrides.sql +++ b/procedures/retrieveEntityOverrides.sql @@ -24,7 +24,7 @@ DROP PROCEDURE IF EXISTS db_5_0.retrieveOverrides; 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 * ---------- @@ -44,7 +44,7 @@ delimiter // * type_override, # the datatype, e.g. DOUBLE * entity_id, # same as input EntityID * 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 */ CREATE PROCEDURE db_5_0.retrieveOverrides( @@ -62,7 +62,9 @@ retrieveOverridesBody: BEGIN -- which are internal ids by definition (and do not have external -- equivalents). That's why we do the UNION here, falling back to the -- 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. SELECT internal_id INTO InternalDomainID from entity_ids WHERE id = DomainID; diff --git a/procedures/retrieveEntityProperties.sql b/procedures/retrieveEntityProperties.sql index a7026d9589d4f51a1755634fac1fbc0ee694e557..024f3b0cf2dfb6a83eb41078ec30060c88693f2c 100644 --- a/procedures/retrieveEntityProperties.sql +++ b/procedures/retrieveEntityProperties.sql @@ -42,7 +42,7 @@ drop procedure if exists db_5_0.retrieveEntityProperties // * --------- * InternalPropertyID * Internal property id, to be used when PropertyID - * is NULL because a replacement is being using. + * is NULL because a replacement is used. * PropertyID * The property id * PropertyValue