Skip to content

Commit

Permalink
fix: add a fix to cover infinity recursive call
Browse files Browse the repository at this point in the history
  • Loading branch information
shpran committed Nov 14, 2024
1 parent 52391ee commit 6cc2005
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
8 changes: 1 addition & 7 deletions core/kernel/classes/class.Resource.php
Original file line number Diff line number Diff line change
Expand Up @@ -763,13 +763,7 @@ public function equals(core_kernel_classes_Resource $resource): bool
*/
public function isInstanceOf(core_kernel_classes_Class $class): bool
{
foreach ($this->getTypes() as $type) {
if ($class->equals($type) || $type->isSubClassOf($class)) {
return true;
}
}

return false;
return in_array($class->getUri(), $this->getParentClassesIds(), true);
}

public function getRootId(): string
Expand Down
8 changes: 5 additions & 3 deletions core/kernel/persistence/smoothsql/class.Resource.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
* 2017 (update and modification) Open Assessment Technologies SA (under the project TAO-PRODUCT);
*/

use oat\generis\model\GenerisRdf;
use oat\generis\model\OntologyRdf;
use oat\generis\model\OntologyRdfs;
use oat\oatbox\session\SessionService;
Expand Down Expand Up @@ -120,7 +121,7 @@ public function getParentClassesIds(string $resourceUri): array
JOIN statements_tree st
ON s.subject = st.object
AND s.predicate IN (?, ?)
AND s.object NOT IN (?, ?, ?, ?)
AND s.object NOT IN (?, ?, ?, ?, ?)
)
SELECT object FROM statements_tree;
SQL;
Expand All @@ -136,8 +137,9 @@ public function getParentClassesIds(string $resourceUri): array
OntologyRdf::RDF_TYPE,
'http://www.tao.lu/Ontologies/TAO.rdf#AssessmentContentObject',
'http://www.tao.lu/Ontologies/TAO.rdf#TAOObject',
'http://www.tao.lu/Ontologies/generis.rdf#generis_Ressource',
'http://www.w3.org/2000/01/rdf-schema#Resource',
GenerisRdf::CLASS_GENERIS_RESOURCE,
OntologyRdfs::RDFS_RESOURCE,
OntologyRdfs::RDFS_CLASS,
]
);

Expand Down

0 comments on commit 6cc2005

Please sign in to comment.