How do I request copies anonymously printed?

Suppose I have a class ( cls), an object property ( has_part), and an individual ( ind). An individual is rdf: type'd to be (in manchester syntax) (has_part only cls). Basically, a person is said to be introduced as an anonymous class that has a part cls.

Using stardog as a triple store, how would I write a query that pulled all the faces that are of type (has_part only cls)?

Using OWLIM as a triple store, I was able to write the following:

select ?ind where {
    ?ind rdf:type ?restriction .
    ?restriction owl:onProperty has_part .
    ?restriction owl:allValuesFrom cls
}

This does not work in Stardog, as far as I can tell, no matter what level of reasoning I use. What should this query look like?

Thanks!

EDIT 1

, . , , (clsa and (has_part only clsb)), ?

select ?ind where {
    ?ind rdf:type ?restriction .
    ?restriction owl:onProperty has_part .
    ?restriction owl:allValuesFrom clsB
}

, , , .

2

. , , .

, OWLIM, Stardog. OWLIM . , , , (clsa and (has_part only clsb)), ind , clsa (has_part only clsb). Stardog , , ind (has_part only clsb), , ( ) Stardog , .

Stardog

select ?ind where {
    ?ind rdf:type ?anon.
    ?anon owl:intersectionOf ?a .
    ?a rdf:first clsa .
    ?a rdf:rest ?b .
    ?b rdf:first ?restriction .
    ?b rdf:rest rdf:nil . 
    ?restriction owl:onProperty has_part .
    ?restriction owl:allValuesFrom clsB
}

, , , , , , clsa, (has_part only clsb), , , , .

Joshua , . ( SPARQL, .)

!

3

:

select ?ind where {
    ?ind rdf:type [
        owl:intersectionOf [
            rdf:first clsa ;
            rdf:rest [
                rdf:rest rdf:nil ; 
                rdf:first [
                    owl:onProperty has_part ;
                    owl:allValuesFrom clsB ;
                ] ;
            ] ;
        ] ;
    ] ;
}
+4
2

, , SPARQL, , OWL RDF. , barrel42 :

barrel42: Barrel & sqcap; (hasApple GoodApple)

- , , . :

@prefix :      <https://stackoverflow.com/q/21607859/1281433/example#> .
@prefix rdfs:  <http://www.w3.org/2000/01/rdf-schema#> .
@prefix owl:   <http://www.w3.org/2002/07/owl#> .
@prefix xsd:   <http://www.w3.org/2001/XMLSchema#> .
@prefix rdf:   <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .

<https://stackoverflow.com/q/21607859/1281433/example>
        a       owl:Ontology .

:barrel42  a    owl:NamedIndividual ;
        a       [ a                   owl:Class ;
                  owl:intersectionOf  ( :Barrel [ a                  owl:Restriction ;
                                                  owl:allValuesFrom  :GoodApple ;
                                                  owl:onProperty     :hasApple
                                                ] )
                ] .

:GoodApple  a            owl:Class ;
        rdfs:subClassOf  :Apple .

:Apple  a       owl:Class .

:hasApple  a    owl:ObjectProperty .

:BadApple  a             owl:Class ;
        rdfs:subClassOf  :Apple .

:Barrel  a      owl:Class .

. , , , , , - Barrel hasApple GoodApple, . , OWL, :

prefix :      <https://stackoverflow.com/q/21607859/1281433/example#>
prefix rdfs:  <http://www.w3.org/2000/01/rdf-schema#>
prefix owl:   <http://www.w3.org/2002/07/owl#>

select ?individual where { 
  ?individual                                    
     a/(owl:intersectionOf/rdf:rest*/rdf:first)*
       :Barrel,
        [ owl:allValuesFrom :GoodApple ;
          owl:onProperty :hasApple ;
          a owl:Restriction ] .
}
--------------
| individual |
==============
| :barrel42  |
--------------

a/(owl:intersectionOf/rdf:rest*/rdf:first)*

. ?individual, , . " ", . , rdfs:subClassOf:

a/((owl:intersectionOf/rdf:rest*/rdf:first)|rdfs:subClassOf)*

, . OWL, , .

, , , , , , . , :

+1

Stardog ( 2.1) . , , .

+3

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


All Articles