Some inference rules work, others don't. Unable to query for rules

I have the following text towards the bottom of a named graph .ttl file (titled: <urn:customer-journey:model:026:model>). The first object property definition is unimportant, other than I have the rules written after the classes, datatype, and object properties are defined in the .ttl file.

### MORE DEFINITIONS ABOVE

customer-journey:is_obsolete a owl:ObjectProperty ;
    rdfs:comment "Filter by obsolete (OBS) \"Operator Status Code\"" ;
    rdfs:label "is obsolete" ;
    so:domainIncludes customer-journey:table_1 ;
    so:rangeIncludes customer-journey:obsolete .


## Rule definitions 

[
    a <tag:stardog:api:rule:SPARQLRule> ;
    rdfs:label "last event Rule" ;
    <tag:stardog:api:rule:content> """IF {
  {
    ?sub a <urn:customer-journey:model:table_3> .
    ?sub <urn:customer-journey:model:begin_date> ?dat_0 . 
    {
        SELECT ?sub (MAX(?dat_0) AS ?lastEventDate) 
        WHERE {
            ?sub a <urn:customer-journey:model:table_3> .
            ?sub <urn:customer-journey:model:begin_date> ?dat_0 .
            
            ?current_date_table a <urn:customer-journey:model:hive_metastore.stardog.current_date_table> .
            ?current_date_table <urn:customer-journey:model:current_date> ?current_date .
            FILTER(?dat_0 <= ?current_date)
        } GROUP BY ?sub
    }
    FILTER (?dat_0 = ?lastEventDate) .
  }
}
THEN {
  ?sub <urn:customer-journey:model:last_event> ?sub .
}"""
] .

### MORE RULES BELOW

This rule doesn't work (meaning that if I request the <urn:customer-journey:model:last_Event> URN in a query, no records populate (however, if I remove it the query returns records)). However, a simpler one does:

[
    a <tag:stardog:api:rule:SPARQLRule> ;
    rdfs:label "upcoming event Rule" ;
    <tag:stardog:api:rule:content> """IF {
  {
    ?sub a <urn:customer-journey:model:table_3> .
    ?sub <urn:customer-journey:model:begin_date> ?dat_0 . 

    ?current_date_table a <urn:customer-journey:model:hive_metastore.stardog.current_date_table> .
    ?current_date_table <urn:customer-journey:model:current_date> ?current_date .
    ?current_date_table <urn:customer-journey:model:future_date> ?future_date .
    
    FILTER (?dat_0 > ?current_date && ?dat_0 <= ?future_date) .
  }
}
THEN {
  ?sub <urn:customer-journey:model:upcoming_Event> ?sub .
}"""
] .

One thing to know is that the SPARQL query in the IF statement of the last event rule functions if run by itself (meaning as a query not within a rule).

Moreover, when I attempt to query for any rule (to see what the deal is) no results are produced. SPARQL query below:

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

# Query Builder Search (SELECT)
SELECT ?rule
FROM <virtual://customer-journey>
FROM <urn:customer-journey:model:026:model>
WHERE {
    ?rule a <tag:stardog:api:rule:SPARQLRule> .
}

Is there an obvious bug in my code?

Maybe something is up with Stardog Cloud. I decided to move on to combining virtual graphs with aliases, and the resulting graph returns empty as well (though I know there is data in the individual virtual graphs).

For example, I have two virtual graphs - that I'm looking to combine - that contain data:

All well and good, Now let's combine them using graph aliases:

Looks pretty good. Now let's query from :alias, cause I expect to see something but there's no records produced.

It appears rules with simple logic work, while rules with more complex logic fail.

For example the rule below works (i.e., produces output when used in a SPARQL query):

IF {
  {
    ?sub a customer-journey:event .
    ?sub customer-journey:parent_event_id ?parent_event_id . 
    FILTER(?parent_event_id != \"0\"^^xsd:integer) .
  }
}
THEN {
  ?sub customer-journey:is_parent_event ?sub .
}

However, rules with sub-queries do not work (i.e., produces no output when used in a SPARQL query):

IF {
  {
    ?sub a customer-journey:model:event .
    ?sub customer-journey:model:parent_event_id ?parent_event_id .

    {
        SELECT ?parent_event_id
        WHERE {
            ?parent a customer-journey:model:event .
            ?parent customer-journey:model:event_id ?parent_event_id .
            ?parent customer-journey:model:parent_event_id ?parent_id . 
            FILTER(?parent_id = \"0\"^^xsd:integer) .
        }
    }
  }
}
THEN {
  ?sub customer-journey:is_child_event ?sub
}

This wasn't the case a week ago. Both rules above functioned, along with the more complex one listed above ("last event Rule").

Any pointers or solutions to have all the rules work again?

Are you sure that those rules worked before? According to the docs and especially about limitations of rule syntax , I'd say that subqueries aren't supported in a rule.

The last statment in bulletpoint 2. is

Other SPARQL features are not allowed in rules.

And subqueries haven't been mentioned before as supported features. Also, the expressivity is similar to SWRL, thus, I'd say inference is monotonic and aggregates are beyond this.

Indeed, I might be wrong and it should work, a Stardog and logics expert like @pavel will know better than me and correct me in that case.

Thank you for the feedback. I have memories of the more-complex rule functioning properly (I tested it the same way I had prior to last week) but not actual evidence!

That said, I agree with you in that the Stardog information page indicates that sub-queries are likely out of scope.