Same individual filter in toy dataset: 5 seconds -> 5 minutes

I have an ontology with just 150 A-box triples: three blood pressure measurements, from three dates, for one person. I wrote three rules in the Stardog syntax to see if the person meets the criteria, as an adult, for the documented hypertensive phenotype http://purl.obolibrary.org/obo/HTN_00000004. Besides the three rules, there's almost no T-box.

With all three rules enabled, my query takes 5 minutes, even with lots of RAM allocated. Removing one filter takes it down to five seconds. What am I doing wrong?

Rules, in English. (See also the turtle file linked above):

  1. was the person over 18 years old at the time of the health care encounters? (subtract birth date from encounter date)
  2. were the blood pressure measurements elevated? (over 120 mmHg)
  3. were there at least two of these over-18, over-120 blood pressure measurement datums, for the same person, from three different health care encounters. This rule uses the new-individual-creation feature.

If the third rule is left out of the ontology, queries based on the first two rules return expected results in a few seconds. A query with the same where block as the third rule also returns the expected result, but it takes 5 minutes.

PREFIX obo: <http://purl.obolibrary.org/obo/> 
PREFIX ontologies: <http://transformunify.org/ontologies/> 
select * 
where 
{
    ?h1 a ontologies:TURBO_0010335 ;
        obo:OBI_0000299 ?o18o1201 .
    ?o18o1201 a ontologies:TURBO_0010334 ;
              obo:IAO_0000136 ?SBP1 .
    ?SBP1 a obo:VSO_0000038 ;
          obo:RO_0000052 ?p1 .
    ?p1 a obo:NCBITaxon_9606 .
    ?h2 a ontologies:TURBO_0010335 ;
        obo:OBI_0000299 ?o18o1202 .
    ?o18o1202 a ontologies:TURBO_0010334 ;
              obo:IAO_0000136 ?SBP2 .
    ?SBP2 a obo:VSO_0000038 ;
          obo:RO_0000052 ?p2 .
    ?p2 a obo:NCBITaxon_9606 .
    filter(?h1 != ?h2) 
    filter(?p1 = ?p2) 
    bind(uuid() as ?pheno) 
}

If the third rule is added to database, a query that depends on inferences from all three rules fails with a GC error, using the default memory settings.

PREFIX obo: <http://purl.obolibrary.org/obo/> 
select ?pheno ?p1 where {
    ?pheno a obo:HTN_00000004 ;
           obo:RO_0000052 ?p1 .
    ?p1 a obo:NCBITaxon_9606 .
}

But it does complete in five minutes if Stardog is given extra memory... I don't know where the exact cutoff is.

export STARDOG_SERVER_JAVA_ARGS="-Xms30g -Xmx30g -XX:MaxDirectMemorySize=30g"

I noticed that all of these queries can be run in just a few seconds if the queries or the rules don't require the two elevated blood pressure measurements to be about the same person. I.e, removing filter(?p1 = ?p2) Is there a more efficient way to assert this requirement? Should I be using some different reasoning level or other system settings? I'd like to apply this to tens of thousands of people.

Hi Mark,

Let's work on the query you pasted above first. I think the problem with the filter is that both variables, ?p1 and ?p2, appear only in the object position of triple patterns. As such, they can technically be bound to literals, not just IRIs. For literals equality is defined differently in SPARQL and requires expensive checks which also prevent use of efficient join algorithms.

You can try 2 options: i) use the same variable name ?p in both cases. ii) use #pragma equality.identity ?p1,?p2 in the beginning of WHERE. The first option is better, esp. with rules.

Let us know if it helps with the query. If not, please attach the query plan in plain text.

Best,
Pavel

1 Like

enforcing a single person by reusing a single variable:

Still 5 minutes. Additional thoughts:

  1. I had already required that ?p1 and ?p2 be instances of class obo:NCBITaxon_9606 (and used them in the subject position), so literals shouldn't have allowed there, right?
  2. Did you see that my third rule <http://example.org/docdHypertensionPheno> uses the new individual creation trick?
PREFIX obo: <http://purl.obolibrary.org/obo/> 
PREFIX ontologies: <http://transformunify.org/ontologies/> 
select * 
where 
{
    ?h1 a ontologies:TURBO_0010335 ;
        obo:OBI_0000299 ?o18o1201 .
    ?o18o1201 a ontologies:TURBO_0010334 ;
              obo:IAO_0000136 ?SBP1 .
    ?SBP1 a obo:VSO_0000038 ;
          obo:RO_0000052 ?p .
    ?p a obo:NCBITaxon_9606 .
    ?h2 a ontologies:TURBO_0010335 ;
        obo:OBI_0000299 ?o18o1202 .
    ?o18o1202 a ontologies:TURBO_0010334 ;
              obo:IAO_0000136 ?SBP2 .
    ?SBP2 a obo:VSO_0000038 ;
          obo:RO_0000052 ?p .
    filter(?h1 != ?h2) 
    bind(uuid() as ?pheno) 
}

Using a pragma

Still 5 minutes

PREFIX obo: <http://purl.obolibrary.org/obo/> 
PREFIX ontologies: <http://transformunify.org/ontologies/> 
select * 
where 
{
    #pragma equality.identity ?p1,?p2
    ?h1 a ontologies:TURBO_0010335 ;
        obo:OBI_0000299 ?o18o1201 .
    ?o18o1201 a ontologies:TURBO_0010334 ;
              obo:IAO_0000136 ?SBP1 .
    ?SBP1 a obo:VSO_0000038 ;
          obo:RO_0000052 ?p1 .
    ?p1 a obo:NCBITaxon_9606 .
    ?h2 a ontologies:TURBO_0010335 ;
        obo:OBI_0000299 ?o18o1202 .
    ?o18o1202 a ontologies:TURBO_0010334 ;
              obo:IAO_0000136 ?SBP2 .
    ?SBP2 a obo:VSO_0000038 ;
          obo:RO_0000052 ?p2 .
    ?p2 a obo:NCBITaxon_9606 .
    filter(?h1 != ?h2) 
    filter(?p1 = ?p2) 
    bind(uuid() as ?pheno) 
}

Plan (applied to query with pragma immediately above)

prefix obo: <http://purl.obolibrary.org/obo/>
prefix ontologies: <http://transformunify.org/ontologies/>

Distinct [#1]
`─ Projection(?h1, ?o18o1201, ?SBP1, ?p1, ?h2, ?o18o1202, ?SBP2, ?p2, ?pheno) [#1]
   `─ Bind(?p1 AS ?p2) [#1]
      `─ Bind(UUID() AS ?pheno) [#1]
         `─ Filter(((("P18Y"^^xsd:duration < (?gcazsxxf - ?hujctdru) && "120"^^xsd:integer < ?nsjsyqly) && "120"^^xsd:integer < ?wqmpjvbm) && "P18Y"^^xsd:duration < (?wovedbqf - ?hpokrtgp))) [#1]
            `─ NestedLoopJoin(_) [#1]
               +─ NestedLoopJoin(_) [#1]
               │  +─ HashJoin(?asmnkdjh) [#1]
               │  │  +─ Filter(?h1 != ?h2) [#1]
               │  │  │  `─ HashJoin(?o18o1202) [#1]
               │  │  │     +─ HashJoin(?SBP2) [#1]
               │  │  │     │  +─ HashJoin(?SBP1) [#1]
               │  │  │     │  │  +─ HashJoin(?o18o1201) [#1]
               │  │  │     │  │  │  +─ HashJoin(?vymmvtim) [#1]
               │  │  │     │  │  │  │  +─ HashJoin(?ihbirrol) [#1]
               │  │  │     │  │  │  │  │  +─ MergeJoin(?h1) [#1]
               │  │  │     │  │  │  │  │  │  +─ Sort(?h1) [#1]
               │  │  │     │  │  │  │  │  │  │  `─ MergeJoin(?ihbirrol) [#1]
               │  │  │     │  │  │  │  │  │  │     +─ Scan[POSC](?ihbirrol, <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>, obo:BFO_0000035) [#1]
               │  │  │     │  │  │  │  │  │  │     `─ Scan[PSOC](?ihbirrol, obo:RO_0002223, ?h1) [#1]
               │  │  │     │  │  │  │  │  │  `─ NaryJoin(?h1) [#1]
               │  │  │     │  │  │  │  │  │     +─ Scan[PSOC](?h1, obo:BFO_0000055, ?vymmvtim) [#1]
               │  │  │     │  │  │  │  │  │     +─ Scan[PSOC](?h1, obo:OBI_0000299, ?o18o1201) [#1]
               │  │  │     │  │  │  │  │  │     `─ Scan[POSC](?h1, <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>, obo:OGMS_0000097) [#1]
               │  │  │     │  │  │  │  │  `─ NaryJoin(?ptbejnhg) [#1]
               │  │  │     │  │  │  │  │     +─ Scan[PSOC](?ptbejnhg, obo:IAO_0000004, ?gcazsxxf) [#1]
               │  │  │     │  │  │  │  │     +─ Scan[POSC](?ptbejnhg, <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>, obo:IAO_0000416) [#1]
               │  │  │     │  │  │  │  │     `─ Scan[PSOC](?ptbejnhg, obo:IAO_0000136, ?ihbirrol) [#1]
               │  │  │     │  │  │  │  `─ MergeJoin(?najnqhor) [#1]
               │  │  │     │  │  │  │     +─ Scan[POSC](?najnqhor, <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>, obo:NCBITaxon_9606) [#1]
               │  │  │     │  │  │  │     `─ Sort(?najnqhor) [#1]
               │  │  │     │  │  │  │        `─ MergeJoin(?vymmvtim) [#1]
               │  │  │     │  │  │  │           +─ Scan[POSC](?vymmvtim, <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>, obo:OMRSE_00000011) [#1]
               │  │  │     │  │  │  │           `─ Scan[PSOC](?vymmvtim, obo:RO_0000052, ?najnqhor) [#1]
               │  │  │     │  │  │  `─ MergeJoin(?rftuuvyg) [#1]
               │  │  │     │  │  │     +─ Sort(?rftuuvyg) [#1]
               │  │  │     │  │  │     │  `─ MergeJoin(?omfgapfa) [#1]
               │  │  │     │  │  │     │     +─ Sort(?omfgapfa) [#1]
               │  │  │     │  │  │     │     │  `─ MergeJoin(?o18o1201) [#1]
               │  │  │     │  │  │     │     │     +─ Sort(?o18o1201) [#1]
               │  │  │     │  │  │     │     │     │  `─ MergeJoin(?zonwhvrc) [#1]
               │  │  │     │  │  │     │     │     │     +─ Scan[POSC](?zonwhvrc, <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>, obo:OGMS_0000097) [#1]
               │  │  │     │  │  │     │     │     │     `─ Scan[PSOC](?zonwhvrc, obo:OBI_0000299, ?o18o1201) [#1]
               │  │  │     │  │  │     │     │     `─ NaryJoin(?o18o1201) [#1]
               │  │  │     │  │  │     │     │        +─ Scan[PSOC](?o18o1201, obo:IAO_0000136, ?SBP1) [#1]
               │  │  │     │  │  │     │     │        +─ Scan[PSOC](?o18o1201, obo:IAO_0000136, ?omfgapfa) [#1]
               │  │  │     │  │  │     │     │        +─ Scan[POSC](?o18o1201, <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>, obo:HTN_00000001) [#1]
               │  │  │     │  │  │     │     │        `─ Scan[PSOC](?o18o1201, obo:OBI_0001938, ?rftuuvyg) [#1]
               │  │  │     │  │  │     │     `─ Scan[POSC](?omfgapfa, <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>, obo:VSO_0000038) [#1]
               │  │  │     │  │  │     `─ NaryJoin(?rftuuvyg) [#1]
               │  │  │     │  │  │        +─ Scan[PSOC](?rftuuvyg, obo:OBI_0002135, ?wqmpjvbm) [#1]
               │  │  │     │  │  │        +─ Scan[POSC](?rftuuvyg, <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>, obo:OBI_0001933) [#1]
               │  │  │     │  │  │        `─ Scan[POSC](?rftuuvyg, obo:IAO_0000039, obo:UO_0000272) [#1]
               │  │  │     │  │  `─ MergeJoin(?p1) [#1]
               │  │  │     │  │     +─ Sort(?p1) [#1]
               │  │  │     │  │     │  `─ MergeJoin(?SBP1) [#1]
               │  │  │     │  │     │     +─ Scan[POSC](?SBP1, <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>, obo:VSO_0000038) [#1]
               │  │  │     │  │     │     `─ Scan[PSOC](?SBP1, obo:RO_0000052, ?p1) [#1]
               │  │  │     │  │     `─ MergeJoin(?p1) [#1]
               │  │  │     │  │        +─ Scan[POSC](?p1, <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>, obo:NCBITaxon_9606) [#1]
               │  │  │     │  │        `─ Sort(?p1) [#1]
               │  │  │     │  │           `─ MergeJoin(?SBP2) [#1]
               │  │  │     │  │              +─ Scan[POSC](?SBP2, <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>, obo:VSO_0000038) [#1]
               │  │  │     │  │              `─ Scan[PSOC](?SBP2, obo:RO_0000052, ?p1) [#1]
               │  │  │     │  `─ MergeJoin(?eeifbqdc) [#1]
               │  │  │     │     +─ Sort(?eeifbqdc) [#1]
               │  │  │     │     │  `─ MergeJoin(?ybohlkeh) [#1]
               │  │  │     │     │     +─ Sort(?ybohlkeh) [#1]
               │  │  │     │     │     │  `─ MergeJoin(?o18o1202) [#1]
               │  │  │     │     │     │     +─ Sort(?o18o1202) [#1]
               │  │  │     │     │     │     │  `─ MergeJoin(?thdgxgoy) [#1]
               │  │  │     │     │     │     │     +─ Scan[POSC](?thdgxgoy, <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>, obo:OGMS_0000097) [#1]
               │  │  │     │     │     │     │     `─ Scan[PSOC](?thdgxgoy, obo:OBI_0000299, ?o18o1202) [#1]
               │  │  │     │     │     │     `─ NaryJoin(?o18o1202) [#1]
               │  │  │     │     │     │        +─ Scan[PSOC](?o18o1202, obo:IAO_0000136, ?SBP2) [#1]
               │  │  │     │     │     │        +─ Scan[POSC](?o18o1202, <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>, obo:HTN_00000001) [#1]
               │  │  │     │     │     │        +─ Scan[PSOC](?o18o1202, obo:IAO_0000136, ?ybohlkeh) [#1]
               │  │  │     │     │     │        `─ Scan[PSOC](?o18o1202, obo:OBI_0001938, ?eeifbqdc) [#1]
               │  │  │     │     │     `─ Scan[POSC](?ybohlkeh, <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>, obo:VSO_0000038) [#1]
               │  │  │     │     `─ NaryJoin(?eeifbqdc) [#1]
               │  │  │     │        +─ Scan[POSC](?eeifbqdc, obo:IAO_0000039, obo:UO_0000272) [#1]
               │  │  │     │        +─ Scan[PSOC](?eeifbqdc, obo:OBI_0002135, ?nsjsyqly) [#1]
               │  │  │     │        `─ Scan[POSC](?eeifbqdc, <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>, obo:OBI_0001933) [#1]
               │  │  │     `─ HashJoin(?gvvxnorv) [#1]
               │  │  │        +─ MergeJoin(?h2) [#1]
               │  │  │        │  +─ Sort(?h2) [#1]
               │  │  │        │  │  `─ MergeJoin(?gvvxnorv) [#1]
               │  │  │        │  │     +─ Scan[POSC](?gvvxnorv, <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>, obo:BFO_0000035) [#1]
               │  │  │        │  │     `─ Scan[PSOC](?gvvxnorv, obo:RO_0002223, ?h2) [#1]
               │  │  │        │  `─ NaryJoin(?h2) [#1]
               │  │  │        │     +─ Scan[PSOC](?h2, obo:BFO_0000055, ?asmnkdjh) [#1]
               │  │  │        │     +─ Scan[PSOC](?h2, obo:OBI_0000299, ?o18o1202) [#1]
               │  │  │        │     `─ Scan[POSC](?h2, <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>, obo:OGMS_0000097) [#1]
               │  │  │        `─ NaryJoin(?keovchtj) [#1]
               │  │  │           +─ Scan[PSOC](?keovchtj, obo:IAO_0000004, ?wovedbqf) [#1]
               │  │  │           +─ Scan[POSC](?keovchtj, <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>, obo:IAO_0000416) [#1]
               │  │  │           `─ Scan[PSOC](?keovchtj, obo:IAO_0000136, ?gvvxnorv) [#1]
               │  │  `─ MergeJoin(?brsgpgcf) [#1]
               │  │     +─ Scan[POSC](?brsgpgcf, <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>, obo:NCBITaxon_9606) [#1]
               │  │     `─ Sort(?brsgpgcf) [#1]
               │  │        `─ MergeJoin(?asmnkdjh) [#1]
               │  │           +─ Scan[POSC](?asmnkdjh, <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>, obo:OMRSE_00000011) [#1]
               │  │           `─ Scan[PSOC](?asmnkdjh, obo:RO_0000052, ?brsgpgcf) [#1]
               │  `─ MergeJoin(?ouewczzm) [#1]
               │     +─ Sort(?ouewczzm) [#1]
               │     │  `─ NaryJoin(?xszmkrfi) [#1]
               │     │     +─ Scan[PSOC](?xszmkrfi, obo:IAO_0000136, ?ouewczzm) [#1]
               │     │     +─ Scan[PSOC](?xszmkrfi, obo:IAO_0000004, ?hpokrtgp) [#1]
               │     │     `─ Scan[POSC](?xszmkrfi, <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>, <http://www.ebi.ac.uk/efo/EFO_0004950>) [#1]
               │     `─ MergeJoin(?ouewczzm) [#1]
               │        +─ Scan[POSC](?ouewczzm, <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>, obo:UBERON_0035946) [#1]
               │        `─ Scan[POSC](?ouewczzm, <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>, ontologies:TURBO_0010201) [#1]
               `─ MergeJoin(?hhhssner) [#1]
                  +─ Sort(?hhhssner) [#1]
                  │  `─ NaryJoin(?cueiywfu) [#1]
                  │     +─ Scan[PSOC](?cueiywfu, obo:IAO_0000136, ?hhhssner) [#1]
                  │     +─ Scan[POSC](?cueiywfu, <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>, <http://www.ebi.ac.uk/efo/EFO_0004950>) [#1]
                  │     `─ Scan[PSOC](?cueiywfu, obo:IAO_0000004, ?hujctdru) [#1]
                  `─ MergeJoin(?hhhssner) [#1]
                     +─ Scan[POSC](?hhhssner, <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>, ontologies:TURBO_0010201) [#1]
                     `─ Scan[POSC](?hhhssner, <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>, obo:UBERON_0035946) [#1]

Ah, you're right re: ?p1 a obo:NCBITaxon_9606, that eliminates the literal possibility.

Thanks for the plan, we will take a look.

Best,
Pavel

1 Like

Hi Mark,

We have identified an issue in Stardog's reasoner which is responsible for the slow behavior here. It should be fixed by the next release but we'll update this thread later if there's a short-term workaround for you.

Meanwhile here's one odd thing in your >18 rule:

IF {
   ?person a <http://purl.obolibrary.org/obo/NCBITaxon_9606> .
   ?dobDatum a <http://www.ebi.ac.uk/efo/EFO_0004950> ;
             <http://purl.obolibrary.org/obo/IAO_0000136> ?birthInst ;
             <http://purl.obolibrary.org/obo/IAO_0000004> ?dobVal .
   ?birthInst a <http://purl.obolibrary.org/obo/UBERON_0035946> , <http://transformunify.org/ontologies/TURBO_0010201> .
   ?hce a <http://purl.obolibrary.org/obo/OGMS_0000097> ;
        <http://purl.obolibrary.org/obo/BFO_0000055> ?patRole .
   ?patRole a <http://purl.obolibrary.org/obo/OMRSE_00000011> ;
            <http://purl.obolibrary.org/obo/RO_0000052> ?person .
   ?hceStart a <http://purl.obolibrary.org/obo/BFO_0000035> ;
             <http://purl.obolibrary.org/obo/RO_0002223> ?hce .
   ?hceStartDate a <http://purl.obolibrary.org/obo/IAO_0000416> ;
                 <http://purl.obolibrary.org/obo/IAO_0000136> ?hceStart ;
                 <http://purl.obolibrary.org/obo/IAO_0000004> ?hceStartDateVal .
   FILTER ((?hceStartDateVal - ?dobVal)>\"P18Y\"^^<http://www.w3.org/2001/XMLSchema#duration>)
}
THEN {
   ?hce a <http://transformunify.org/ontologies/TURBO_0010335> .
}

Unless I'm again missing something there seems to be no connection between the patterns which bind ?dobDatum/?dobVal/?birthInst and the patterns which bind ?person (and the rest). How are people related to their DOBs in your modeling?

Cheers,
Pavel

1 Like

Great, I'm looking forward to the next version or a short term workaround.

Regarding dates of birth...does this make sense? I used prefixes to create human-readable aliases for some of my predicates. In summary:

htnExp:Yves was bornOn: htnExp:Yves_birth_inst
htnExp:Yves_DOB_datum isAbout: htnExp:Yves_birth_inst
...and hasMeasurementValue: "1994-12-15"^^xsd:date

prefix htnExp: <http://example.org/hypertension_experimentation#>
prefix obo: <http://purl.obolibrary.org/obo/>
prefix turbo: <http://transformunify.org/ontologies/>
prefix efo: <http://www.ebi.ac.uk/efo/>
prefix xsd: <http://www.w3.org/2001/XMLSchema#>

prefix bornOn: <http://transformunify.org/ontologies/TURBO_0000303>
prefix isAbout: <http://purl.obolibrary.org/obo/IAO_0000136>
prefix hasMeasurementValue: <http://purl.obolibrary.org/obo/IAO_0000004>

htnExp:Yves
  a obo:NCBITaxon_9606 ;
  bornOn: htnExp:Yves_birth_inst .

htnExp:Yves_birth_inst a obo:UBERON_0035946, turbo:TURBO_0010201 .

htnExp:Yves_DOB_datum
  a efo:EFO_0004950 ;
  isAbout: htnExp:Yves_birth_inst ;
  hasMeasurementValue: "1994-12-15"^^xsd:date .

so turning the first several lines of the rule you cited, and making them into a query

select * where {
    ?person a <http://purl.obolibrary.org/obo/NCBITaxon_9606> .
    ?dobDatum a <http://www.ebi.ac.uk/efo/EFO_0004950> ;
              <http://purl.obolibrary.org/obo/IAO_0000136> ?birthInst ;
              <http://purl.obolibrary.org/obo/IAO_0000004> ?dobVal .
    ?birthInst a <http://purl.obolibrary.org/obo/UBERON_0035946> , <http://transformunify.org/ontologies/TURBO_0010201> .
}

returns

{
  "head": {
    "vars": [
      "person",
      "dobDatum",
      "birthInst",
      "dobVal"
    ]
  },
  "results": {
    "bindings": [
      {
        "dobVal": {
          "datatype": "http://www.w3.org/2001/XMLSchema#date",
          "type": "literal",
          "value": "1994-12-15"
        },
        "person": {
          "type": "uri",
          "value": "http://example.org/hypertension_experimentation#Yves"
        },
        "birthInst": {
          "type": "uri",
          "value": "http://example.org/hypertension_experimentation#Yves_birth_inst"
        },
        "dobDatum": {
          "type": "uri",
          "value": "http://example.org/hypertension_experimentation#Yves_DOB_datum"
        }
      }
    ]
  }
}

Yes, the RDF snippet makes sense. The person node :Yves is related to :Yves_birth_inst via :bornOn and :Yves_birth_inst is related to :Yves_DOB_datum via isAbout.

However your query is missing the :bornOn link between the ?person and ?birthInst. As such, it computes the full Cartesian product between people and values of ?birthInst. Your data has only one person so it may be hard to see but if you visually draw your query (by making variables nodes link them with predicates), you'll see how it's disconnected. Stardog Studio will at some point help spotting this.

Cheers,
Pavel

Wow, I'm really glad you caught that.

It would be really cool if Studio returned a message if the query contained a cartesian product since it seems like 99% of the time it's there it's a mistake. "warning: your query contains a cartesian product and it's probably slow. Did you really mean to do that?"

Along those same lines it would also be cool if Studio flagged each statement in a BGP that would return zero bindings for a query that returned no results.

something like

select * where {
  ?company :name ?name;
                    :sells "berders";
}

might highlight the second line ":sells "berders" because you mispelled "burgers" and

select * where { ?company :sells "berders" }

would return zero results. I'm thinking of something for the times that you write a query expecting results and get nothing and you made a typo.

Yes, we do have an open ticket for Studio to give hints like that to the user and I was referring to that. We've noticed this kind of things on multiple occasions.

Thanks,
Pavel