Query with reasoning not giving anything for rdfs:label

Hi all!

I have been trying to query the following SPARQL with reasoning:

select ?report ?label
where{
	?report rdf:type reports:CollisionInvestigationReport; rdfs:label ?label.
}

However, it does not give me anything unless I get rid of rdfs:label ?label. What I want to do is to query instances of the reports:CollisionInvestigationReport which is a defined class, so reasoning is necessary. Is there any advice on how to get labels queried at the same time?

Thank you!

If you don't get anything with rdfs:label back, then there are no instances of class reports:CollisionInvestigationReport that have a label - that's all. It doesn't matter whether you use reasoning or not.

Please double-check the data.

As lorenz_b said, you do not get results likely because the reports that are CollisionInvestigationReport do not have a label.

You could do

select ?report ?label
where{
	?report rdf:type reports:CollisionInvestigationReport.
       OPTIONAL { ?report rdfs:label ?label. }
}

If you want to get them regardless of they having or not a label.

Everyone seems to be assuming that you don’t actually have any labels in there. If you do then there might be a problem. Do you have labels that you would expect to be returned?

I'm assuming you have the reasoning level set to DL as there is a known issue with annotation properties in queries in the DL mode. If you set the reasoning level to SL this query should work as expected.

Best,
Evren

Thanks. I can confirm that every instance has a label which can be queried properly without the reasoning.

Thank you but I can confirm it is not because the label was not asserted as I can query labels when the reasoning is off.

Yes. For example, after execute the following code:


select ?report ?label

where{

    ?report rdf:type reports:CollisionInvestigationReport.

}

One of the results would be:reports_resource:report_3504933049910045030.

This particular instance has rdfs:label "Collision, Lydney Town level crossing" if look into it.

The label can be queried properly without the reasoning. However, becasue reports:CollisionInvestigationReport is a defined class, I have to use the reasoning to infer what instance(report) can be classified as reports:CollisionInvestigationReport.

Is there any way to query rdfs:label alongside rdf:type in this case? Thanks!

Yes! I indeed set the reasoning level to DL. I tried to set to SL but the reasoning did not work. According to the log file, there are a few invalid axioms for SL.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.