Active
Project:
RDF entity
Version:
2.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
16 Jan 2023 at 09:35 UTC
Updated:
25 Jan 2023 at 10:07 UTC
Jump to comment: Most recent
This query doesn't work:
// Gimme all top-level terms from 'topic' vocab.
$tids = \Drupal::entityTypeManager::getStorage('taxonomy_term')
->getQuery()
->accessCheck(FALSE)
->condition('vid', 'topic')
->condition('parent', '0')
->execute();
Especially after #3332666: Latest core taxonomy changes are breaking rdf_taxonomy, fixing this became trickier as we define a top-level term in two ways:
Write a kernel regression test
Some hints:
hook_query_sparql_reference_alter() and check for a 'parent' condition (=, !=, <>, IN, NOT IN) with '0' value.None.
None.
None.
None.
Comments
Comment #2
claudiu.cristeaComment #3
dimilias commentedAnother approach to this would be to alter the queries for the RDF terms to include the vocabulary ID as a root term.
This is because the concepts have a concept scheme they are related to and usually this gets the part of the URI that is common to all.
For example, a vocabulary (concept scheme) with URI
http://example.com/myVoc#would have terms likehttp://example.com/myVoc#term1etc. Though even if the above rule is not written in stone, still, the concept scheme is the correct way to structure a vocabulary.That way we could avoid trying to build OR conditions and replace the '0' with the concept scheme.
For the record, I am not claiming that this is necessarily an easier task, though I assume it is.
Edit: An idea would be to simply not add the condition if the requested field is not mapped. If it is very hard to not add it generically, we can alter the query and remove the condition if it is there.
Comment #4
claudiu.cristeaComment #5
claudiu.cristeaWhat if the vocab condition is missing? Let's throw an exception that this is a limitation when querying for parent '0'