To me this looks like a regression from 5.0.3 to 5.0.4, in that I expected the result from 5.0.3 as the correct one. To reproduce:
Create a database with the following data:
@prefix : <http://example.com#> .
:study1 a :Study ;
rdfs:label "study 1" ;
.
:donor1 a :Donor ;
rdfs:label "donor 1" ;
:isClassifiedBy :study1 ;
.
:sample1 a :CollectedSample ;
rdfs:label "sample 1" ;
:isClassifiedBy :study1 ;
.
:sample2 a :CollectedSample ;
rdfs:label "sample 2" ;
:wasDerivedFrom :donor1 ;
.
And run the following query:
PREFIX : <http://example.com#>
SELECT
*
WHERE {
VALUES ?studyIRI { :study1 }
?studyIRI a :Study ;
rdfs:label ?studyLabel .
?sampleIRI a :CollectedSample ;
:wasDerivedFrom * / :isClassifiedBy ?studyIRI ;
rdfs:label ?sampleLabel
}
On a 5.0.3 server I get what I expect; two results:
+---------------------------+------------+----------------------------+-------------+
| studyIRI | studyLabel | sampleIRI | sampleLabel |
+---------------------------+------------+----------------------------+-------------+
| http://example.com#study1 | "study 1" | http://example.com#sample2 | "sample 2" |
| http://example.com#study1 | "study 1" | http://example.com#sample1 | "sample 1" |
+---------------------------+------------+----------------------------+-------------+
But for a database created on 5.0.4 I get only one result:
+---------------------------+------------+----------------------------+-------------+
| studyIRI | studyLabel | sampleIRI | sampleLabel |
+---------------------------+------------+----------------------------+-------------+
| http://example.com#study1 | "study 1" | http://example.com#sample1 | "sample 1" |
+---------------------------+------------+----------------------------+-------------+