cgrain commented on issue #3463:
URL: https://github.com/apache/jena/issues/3463#issuecomment-3323689970

   My bad, I was too much busy debugging my original query, so I unintentially 
shared the quote-unquote 'fixed' query. 
   I was wondering about issues with the following query: 
   
   ```
   PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
   PREFIX nen2660: <https://w3id.org/nen2660/def#>
   PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
   PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
   PREFIX owl: <http://www.w3.org/2002/07/owl#>
   
   SELECT DISTINCT *
   WHERE {
     # Bind the search term at the top level, as intended.
     # This makes the variable accessible to both UNION branches.
     BIND('' AS ?search_term) .
   #     ?iri a/rdfs:subClassOf* nen2660:RealObject .
     {
       # This branch handles finding roots.
       # It will only execute if ?search_term is empty.
       FILTER(?search_term = '')
        ?iri_parent skos:prefLabel ?iriLabel .
       ?iri_parent rdfs:subClassOf* nen2660:RealObject .
       # Find an IRI that is not the object of a hasPart relationship.
       FILTER NOT EXISTS {
         ?parent1 nen2660:hasPart ?iri_parent .
       }
       BIND("R" AS ?Test )
       
     }
    UNION {
       # This branch handles the search functionality.
       # It will only execute if ?search_term is not empty.
       FILTER(?search_term != '')
       ?iri_search rdfs:subClassOf* nen2660:RealObject .
        
       # Perform a case-insensitive search on label and notation.
       ?iri_search skos:prefLabel ?labelSearch .
       FILTER (regex(?labelSearch, ?search_term, "i")) .
   
       BIND("S" AS ?Test )
     }
     
     BIND ( COALESCE (?iri_search, ?iri_parent ) AS ?iri ) .
     
     OPTIONAL {
                        ?iri nen2660:hasPart ?child. 
                        BIND(true AS ?inner_hasChildren) .
                }
                BIND(COALESCE(?inner_hasChildren, false) as ?hasChildren) . 
   }
   ```
   
   This query doesn't contain results. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to