Hi everyone,
I got it. I had to add some extra information as I was trying to find
instances of a certain class/plus sub classes and not the sub classes
itself.
This works:
SELECT DISTINCT ?a ?b ?c
WHERE { ?a ?b c?.
?b rdf:type/rdfs:subClassOf* <URI_of_class> .
}.
Thanks everyone!
On Tuesday, May 2, 2023 at 11:51:24 AM UTC+2 David Price wrote:
> FYI I checked SWP code I have used with other customers and see that
> *rdfs:subClassOf** syntax does work in WHERE clauses within SWP (inside a
> <ui:update in my case).
>
> Cheers,
> David
>
> On 2 May 2023, at 07:52, Julia S. <[email protected]> wrote:
>
> Hi,
>
> this is part of a longer customization.
> The original version determines that all properties of a specific class
> automatically get metadata (I called it "URI_of_class" in the snippet -
> classA in image).
>
> I would like this to work even if the property is of a class that is a sub
> class of the original class (sorry for all the "classes" - classA, classB
> AND classC in image).
>
> I confirmed that this code snippet is where the class for automatic
> metadata generation is determined by simply pointing to a completely
> different class and checking if that one would then also get metadata. What
> I cannot work out is how to include sub-classes.
>
> [image: class_subclass.PNG]
>
> On Wednesday, April 26, 2023 at 6:06:55 PM UTC+2 Holger Knublauch wrote:
>
>> To get all instances ?a of a given class $class, the pattern is
>>
>> SELECT DISTINCT ?a
>> WHERE {
>> ?type rdfs:subClassOf* $class .
>> ?a rdf:type ?type .
>> }
>>
>> It is not clear to me whether you are looking for instances of a class,
>> or classes that are instances of a metaclass, or maybe you can clarify in
>> prose what you mean?
>>
>> (Also: c? looks incorrect but I guess that was a copy-and-paste problem).
>>
>> Holger
>>
>> On 26 Apr 2023, at 4:52 pm, Julia S. <[email protected]> wrote:
>>
>> Hi,
>> I am trying to customize a SWP script for the first time (7.2.4) and I am
>> struggling a little bit.
>>
>> We have an existing script that does almost exactly what I want based on
>> this:
>>
>> SELECT DISTINCT ?a ?b ?c
>> WHERE { ?a ?b c?.
>> ?b a <URI_of_class> .
>> }.
>>
>> So a function is called if ?b is a specific class (specified by it's URI)
>>
>> I wanted to change this so it uses that class' children instead of the
>> class itself and found rdfs:subClassOf.
>>
>> I tried the following versions, none of which work.
>>
>> A)
>> SELECT DISTINCT ?a ?b ?c
>> WHERE { ?a ?b c?.
>> ?b rdfs:subClassOf <URI_of_class> .
>> }.
>>
>> B)
>> SELECT DISTINCT ?a ?b ?c
>> WHERE { ?a ?b c?.
>> ?b (rdfs:subClassOf)* <URI_of_class> .
>> }.
>>
>> C)
>> SELECT DISTINCT ?a ?b ?c
>> WHERE { ?a ?b c?.
>> ?b (rdfs:subClassOf)+ <URI_of_class> .
>> }.
>>
>> I double checked if rdfs:subClassOf (including * and +) works on its own
>> using a SPARQL endpoint and it gives me the expected instances.
>>
>> I am guessing I still simply use the wrong syntax for swp scripts or
>> don't understand what rdfs:subClassOf actually means.
>>
>> Any advice?
>>
>> Cheers
>> Julia
>>
>>
>> --
>> The topics of this mailing list include TopBraid EDG and related
>> technologies such as SHACL.
>> To post to this group, send email to [email protected]
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "TopBraid Suite Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/topbraid-users/85b221e7-5394-4fc4-900b-d2e2cc6d186cn%40googlegroups.com
>>
>> <https://groups.google.com/d/msgid/topbraid-users/85b221e7-5394-4fc4-900b-d2e2cc6d186cn%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>>
>>
> --
> The topics of this mailing list include TopBraid EDG and related
> technologies such as SHACL.
> To post to this group, send email to [email protected]
> ---
> You received this message because you are subscribed to the Google Groups
> "TopBraid Suite Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
>
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/topbraid-users/28ccd76f-7370-4eff-9c88-c08aa0973710n%40googlegroups.com
>
> <https://groups.google.com/d/msgid/topbraid-users/28ccd76f-7370-4eff-9c88-c08aa0973710n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> [image: class_subclass.PNG]
>
>
> UK +44 (0) 7788 561308 <+44%207788%20561308>
> US +1 (336) 283-0808 <(336)%20283-0808>
>
>
--
The topics of this mailing list include TopBraid EDG and related technologies
such as SHACL.
To post to this group, send email to [email protected]
---
You received this message because you are subscribed to the Google Groups
"TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/topbraid-users/d8fe3795-8271-4fc3-b4f0-8b4e785e361bn%40googlegroups.com.