It was not my question, but again, the property path * operator is used
in his query - and this can also mean 0 occurrences of the relation
rdfs:subClassOf . Maybe I don't understand the meaning of * - I'll check
the W3C recommendation.


In the meantime, I tried it with the following minimal example and
Apache Jena 3.1.0


Dataset

@prefix ex:<http://example.org/test/> .
ex:a a ex:A .


Query 1

PREFIX ex: <http://example.org/test/>
select * where {
?s a ex:A .
}

Result 1

--------
| s      |
====
| ex:a |
--------


Query 2

PREFIX ex: <http://example.org/test/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

select * where {
?s a ?cls .
?cls rdfs:subClassOf ex:A
}

Result 2

EMPTY RESULT (as expected as there is no rdfs:subClassOf triple in the data)


Query 3 (with property path)

PREFIX ex: <http://example.org/test/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

select * where {
?s a ?cls .
?cls rdfs:subClassOf* ex:A
}

Result 3

-----------------
| s      | cls    |
========
| ex:a | ex:A |
-----------------


Query 4 (with property path sequence / and *)

PREFIX ex: <http://example.org/test/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

select * where {
?s a/rdfs:subClassOf* ex:A
}

Result 4

--------
| s      |
====
| ex:a |
--------


But maybe Jena is wrong here(although it returns what I would expect,
but I'm not a SPARQL expert). I'll try to contact one of the developers.


Regards,
Lorenz


On 09.01.2017 12:53, Kingsley Idehen wrote:
> On 1/9/17 5:38 AM, Lorenz Buehmann wrote:
>>
>> @Hugh : the asterisk operator means 0 .. n occurrences, thus,
>>
>>
>> #constraint 1
>>     ?A rdf:type ?A_SubClassOf.
>>     ?A_SubClassOf rdfs:subClassOf* :mytype1.
>>
>>
>> should also cover the case
>>
>>
>>     ?A rdf:type :mytype1 .
>>
>>
>> Or am I wrong?
>>
>>
>> I mean the property path expression should also work and is
>> equivalent to the constraint
>>
>> ?A rdf:type/rdfs:subClassOf* :mytype1 .
>>  
>>
>> Cheers,
>>
>> Lorenz
>>
>
> Lorenz,
>
> You are using rdfs:subClassOf in your query, but it doesn't exist in
> your dataset. Putting it in a property path doesn't magically create
> what's missing in your dataset.
>
> Kingsley
>>
>>
>> On 09.01.2017 00:50, Hugh Williams wrote:
>>> Hi Oliver,
>>>
>>> There are no rdfs:subClassOf or rdfs:subPropertyOf relations in the
>>> graph of the inserted data:
>>>
>>> SQL> SPARQL SELECT * FROM <mygraph> WHERE {?s ?p ?o};
>>> s                                                                  
>>>               p                                                    
>>>                             o
>>> LONG VARCHAR                                                        
>>>              LONG VARCHAR                                          
>>>                            LONG VARCHAR
>>> _______________________________________________________________________________
>>>
>>> urn:my:graphX1                                                      
>>>              http://www.w3.org/1999/02/22-rdf-syntax-ns#type        
>>>                           urn:my:graphmytype2
>>> urn:my:graphX2                                                      
>>>              http://www.w3.org/1999/02/22-rdf-syntax-ns#type        
>>>                           urn:my:graphmytype2
>>> urn:my:graphC                                                      
>>>               http://www.w3.org/1999/02/22-rdf-syntax-ns#type      
>>>                             urn:my:graphmytype1
>>> urn:my:graphB                                                      
>>>               http://www.w3.org/1999/02/22-rdf-syntax-ns#type      
>>>                             urn:my:graphmytype1
>>> urn:my:graphA                                                      
>>>               http://www.w3.org/1999/02/22-rdf-syntax-ns#type      
>>>                             urn:my:graphmytype1
>>> urn:my:graphC                                                      
>>>               urn:my:graphmyrel                                    
>>>                             urn:my:graphX1
>>> urn:my:graphA                                                      
>>>               urn:my:graphmyrel                                    
>>>                             urn:my:graphX1
>>> urn:my:graphB                                                      
>>>               urn:my:graphmyrel                                    
>>>                             urn:my:graphX2
>>>
>>> 8 Rows. -- 5 msec.
>>> SQL>
>>>
>>> Please refer to the following documentation on Virtuoso inference
>>> and reasoning  and rdfs:subClassOf & rdfs:subPropertyOf support …
>>>
>>> http://docs.openlinksw.com/virtuoso/rdfsparqlrulesubclassandsubprop/
>>>
>>> Best Regards
>>> Hugh Williams
>>> Professional Services
>>> OpenLink Software, Inc.      //              http://www.openlinksw.com/
>>> Weblog   -- http://www.openlinksw.com/blogs/
>>> LinkedIn -- http://www.linkedin.com/company/openlink-software/
>>> Twitter  -- http://twitter.com/OpenLink
>>> Google+  -- http://plus.google.com/100570109519069333827/
>>> Facebook -- http://www.facebook.com/OpenLinkSoftware
>>> Universal Data Access, Integration, and Management Technology Providers
>>>
>>>
>>>
>>>> On 6 Jan 2017, at 09:42, Olivier Filangi <olivier.fila...@inra.fr>
>>>> wrote:
>>>>
>>>> Dear all,
>>>>
>>>> I have a strange behaviour with a kind of query with Virtuoso
>>>> (07.20.3217).
>>>>
>>>> Accoding the following tripplet I put with a insert query :
>>>>
>>>> PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
>>>> PREFIX    :<urn:my:graph>
>>>>
>>>>
>>>> INSERT DATA
>>>>   {
>>>>  GRAPH <mygraph> {
>>>>    :A rdf:type :mytype1.
>>>>    :B rdf:type :mytype1.
>>>>    :C rdf:type :mytype1.
>>>>
>>>>    :X1 rdf:type :mytype2.
>>>>    :X2 rdf:type :mytype2.
>>>>
>>>>    :A :myrel :X1.
>>>>    :B :myrel :X2.
>>>>    :C :myrel :X1.
>>>>  }
>>>> }
>>>>
>>>> When I request with on data with the query :
>>>>
>>>> PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
>>>> PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
>>>> PREFIX    :<urn:my:graph>
>>>>
>>>> SELECT DISTINCT ?A ?B
>>>> WHERE
>>>> {
>>>>     ?A ?subProperty8 ?B.
>>>>     ?subProperty8 rdfs:subPropertyOf* :myrel.
>>>>
>>>> #constraint 1
>>>>     ?A rdf:type ?A_SubClassOf.
>>>>     ?A_SubClassOf rdfs:subClassOf* :mytype1.
>>>>
>>>> #constraint 2
>>>>     ?B rdf:type ?B_SubClassOf.
>>>>     ?B_SubClassOf rdfs:subClassOf* :mytype2.
>>>> }
>>>>
>>>> I get only one result  :
>>>> urn:my:graphA     urn:my:graphX1
>>>>
>>>> If I remove the first or the second constraint, I get all results
>>>> that I
>>>> should find :
>>>> urn:my:graphA     urn:my:graphX1
>>>> urn:my:graphC     urn:my:graphX1
>>>> urn:my:graphB     urn:my:graphX2
>>>>
>>>> Could you say me if I did a wrong sparql insertion/request or if
>>>> it's a
>>>> bug ?
>>>>
>>>> Regards,
>>>> Olivier F.
>>>>
>>>>
>>>> -- 
>>>> Filangi Olivier
>>>> +33 (0)2 23 48 51 48
>>>> Biodiversity and Polyploidy team - UMR1349 IGEPP - INRA -
>>>> Agrocampus Ouest
>>>> +33 (0)2 99 84 74 22
>>>> GenOuest Bioinformatics Platform - IRISA
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> Check out the vibrant tech community on one of the world's most
>>>> engaging tech sites, SlashDot.org <http://slashdot.org>!
>>>> http://sdm.link/slashdot
>>>> _______________________________________________
>>>> Virtuoso-users mailing list
>>>> Virtuoso-users@lists.sourceforge.net
>>>> <mailto:Virtuoso-users@lists.sourceforge.net>
>>>> https://lists.sourceforge.net/lists/listinfo/virtuoso-users
>>>
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Check out the vibrant tech community on one of the world's most 
>>> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
>>>
>>>
>>> _______________________________________________
>>> Virtuoso-users mailing list
>>> Virtuoso-users@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/virtuoso-users
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Check out the vibrant tech community on one of the world's most 
>> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
>>
>>
>> _______________________________________________
>> Virtuoso-users mailing list
>> Virtuoso-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/virtuoso-users
>
>
> -- 
> Regards,
>
> Kingsley Idehen             
> Founder & CEO 
> OpenLink Software   (Home Page: http://www.openlinksw.com)
>
> Weblogs (Blogs):
> Legacy Blog: http://www.openlinksw.com/blog/~kidehen/
> Blogspot Blog: http://kidehen.blogspot.com
> Medium Blog: https://medium.com/@kidehen
>
> Profile Pages:
> Pinterest: https://www.pinterest.com/kidehen/
> Quora: https://www.quora.com/profile/Kingsley-Uyi-Idehen
> Twitter: https://twitter.com/kidehen
> Google+: https://plus.google.com/+KingsleyIdehen/about
> LinkedIn: http://www.linkedin.com/in/kidehen
>
> Web Identities (WebID):
> Personal: http://kingsley.idehen.net/dataspace/person/kidehen#this
>         : 
> http://id.myopenlink.net/DAV/home/KingsleyUyiIdehen/Public/kingsley.ttl#this
>
>
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most 
> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
>
>
> _______________________________________________
> Virtuoso-users mailing list
> Virtuoso-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/virtuoso-users

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Virtuoso-users mailing list
Virtuoso-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/virtuoso-users

Reply via email to