sparqlprotege

Sparql Query for every Individual with specific label


I would like to query for every individual in my ontology with a label, which contains a specific string ("PK1"). Then I would like to see every property an value that those individuals have. I tried this code:

SELECT ?Probe ?Property ?Value
WHERE
{
         ?Probe ?Property ?Value.
         ?Probe rdfs:label ?Name.
         FILTER(STRENDS(?Name, "PK1"))
}

However it marks the Variable ?Property in Line 4 as wrong:

Expected one of: VARIABLE, rdfs:subClassOf, etc.

Does anyone have an idea why this happens?


Solution

  • I found the answer to my Question. Like Stefan - brox IT-Solutions pointed out, the Problem is a limitation of the Snap Sparql Plugin for Protege. However the Query works if you define the Variable of the predicate. The following code works for me:

    SELECT ?Probe ?Property ?Value
    WHERE
    {
        ?Property a owl:ObjectProperty .
        ?Probe ?Property ?Value .
        ?Probe rdfs:label ?Name .
        FILTER(STRENDS(?Name, "PK1"))
    }
    

    As i said as long as the Variable ?Property is defined as a ObjectProperty or DatatypeProperty it works.

    Thank you for your ideas!