Subclass of Sparql or EquivalentTo

I want to request the entire nicotine subclass (product).
the result should be (Nasal form of nicotine, Oropharyngeal from ni .. (4 subjects) .. see the picture) I'm trying to fulfill a request for rdfs: subClassOf + and owl: equalClass +, but this code does not work, try this example code here.

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>           
PREFIX owl: <http://www.w3.org/2002/07/owl#>        
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>         
SELECT * WHERE 
{       
  ?s owl:equivalentClass+ ?o . # and try   ?s rdfs:subClassOf ?o    
  filter(?s=<http://snomed.info/id/323283001>)       
}

This image is from a protege Thank you.

The first request is difficult to explain and make, because for such a large file some IRI is not a subclass, but not an equivalent class, I am changing the request method from this instead

<owl:Class rdf:about="http://snomed.info/id/323283001">
    <rdfs:label xml:lang="en">Nicotine (product)</rdfs:label>
    <rdfs:subClassOf>
        <owl:Class>
            <owl:intersectionOf rdf:parseType="Collection">
                <rdf:Description rdf:about="http://snomed.info/id/420383004"/>
                <rdf:Description rdf:about="http://snomed.info/id/425288007"/>
                <owl:Restriction>
                    <owl:onProperty rdf:resource="http://snomed.info/id/127489000"/>
                    <owl:someValuesFrom rdf:resource="http://snomed.info/id/68540007"/>
                </owl:Restriction>
            </owl:intersectionOf>
        </owl:Class>
    </rdfs:subClassOf>
</owl:Class>

I want to request all id (id / 420383004, id / 425288007, id / 127489000 and id / 68540007)

from owl: rdf class: about = "http://snomed.info/id/323283001", please tell me some ideas. thanks

+3
1

-, SPARQL . * + , filter values. , / . , , , - , OWL, OWL, SPARQL

, + *

, , , *, . ,

:MyClass owl:equivalentClass :MyClass

?myClass owl:equivalentClass+ :MyClass

(:MyClass)

?myClass owl:equivalentClass* :MyClass

, owl:equivalentClass (.. a owl:equivalentClass b b owl:equivalentClass a), ,

?myClass (owl:equivalentClass|^owl:equivalentClass)* :MyClass

values filter

, IRI ; filter, :

filter(?s=<http://snomed.info/id/323283001>)

, values,

values ?superclass { <http://snomed.info/id/323283001> }
?subclass (rdfs:subClassOf|owl:equivalentClass)* ?superclass

OWL SPARQL

, (, ) - , OWL-. RDF- OWL, , SPARQL. , rdfs:subClassOf owl:equivalentClass, , :

?subclass (rdfs:subClassOf|owl:equivalentClass|^owl:equivalentClass)* ?superclass

, , Protégé SPARQL, | , :

?subclass (rdfs:subClassOf|(owl:equivalentClass|^owl:equivalentClass))* ?superclass

, , . OWL

A subClassOf (B and C)

, , , A, ( ) , , B C.

A subClassOf B
A subClassOf C

, . , , ,

A subClassOf (B C (p D))

, A B, C (p D). , A p D. :

TiredManWearingHat subClassOf (Man TiredPerson ( )

, , , , - , , , ( ), , . , , :

simple structure in Protégé

<rdf:RDF
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:owl="http://www.w3.org/2002/07/owl#"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
    xmlns="https://stackoverflow.com/q/21092246/1281433/data.owl#">
  <owl:Ontology rdf:about="https://stackoverflow.com/q/21092246/1281433/data.owl"/>
  <owl:Class rdf:about="https://stackoverflow.com/q/21092246/1281433/data.owl#C"/>
  <owl:Class rdf:about="https://stackoverflow.com/q/21092246/1281433/data.owl#B"/>
  <owl:Class rdf:about="https://stackoverflow.com/q/21092246/1281433/data.owl#A">
    <rdfs:subClassOf>
      <owl:Class>
        <owl:intersectionOf rdf:parseType="Collection">
          <owl:Class rdf:about="https://stackoverflow.com/q/21092246/1281433/data.owl#B"/>
          <owl:Class rdf:about="https://stackoverflow.com/q/21092246/1281433/data.owl#C"/>
          <owl:Restriction>
            <owl:onProperty>
              <owl:ObjectProperty rdf:about="https://stackoverflow.com/q/21092246/1281433/data.owl#p"/>
            </owl:onProperty>
            <owl:someValuesFrom>
              <owl:Class rdf:about="https://stackoverflow.com/q/21092246/1281433/data.owl#D"/>
            </owl:someValuesFrom>
          </owl:Restriction>
        </owl:intersectionOf>
      </owl:Class>
    </rdfs:subClassOf>
  </owl:Class>
</rdf:RDF>

, OWL, , , , , . , , - , JARK SPARQL.

prefix :      <https://stackoverflow.com/q/21092246/1281433/data.owl#> 
prefix rdfs:  <http://www.w3.org/2000/01/rdf-schema#> 
prefix owl:   <http://www.w3.org/2002/07/owl#> 
prefix rdf:   <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 

select ?superclass where {
  :A (rdfs:subClassOf|(owl:intersectionOf/rdf:rest*/rdf:first))* ?superclass .
}
--------------
| superclass |
==============
| :A         |
| _:b0       |
| :B         |
| :C         |
| _:b1       |
--------------

. , :

prefix :      <https://stackoverflow.com/q/21092246/1281433/data.owl#> 
prefix rdfs:  <http://www.w3.org/2000/01/rdf-schema#> 
prefix owl:   <http://www.w3.org/2002/07/owl#> 
prefix rdf:   <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 

select ?superclass where {
  :A (rdfs:subClassOf|(owl:intersectionOf/rdf:rest*/rdf:first))* ?superclass .
  filter(!isBlank(?superclass))
}
--------------
| superclass |
==============
| :A         |
| :B         |
| :C         |
--------------

^owl:equivalentClass|owl:equivalentClass , .

Protégé

, Jena. , Protégé, , , , . , , A B Protégé; C - :

enter image description here

(.. filter ):

enter image description here

, , Protégé, , .

+12

Source: https://habr.com/ru/post/1525648/


All Articles