Search Mailing List Archives


Limit search to: Subject & Body Subject Author
Sort by: Reverse Sort
Limit to: All This Week Last Week This Month Last Month
Select Date Range     through    

[protege-owl] Sparql query with string data type

Chema . chema.ar at gmail.com
Thu Aug 23 11:08:24 PDT 2007


Hi Lisa, Sparql is used to query RDF and some OWL features can not be
asked (directly) with sparql. However, you can create a where clause
using all properties as you need.

This query shows how to get class and value of a datatypeProperty from
B subclasses.

SELECT DISTINCT ?class  ?value
WHERE {           	
            ?class rdfs:subClassOf ?restriction.
            ?class rdfs:subClassOf :B. //Put your superclass
            ?restriction owl:onProperty ?prop.
            ?prop ?type owl:DatatypeProperty. //there is no need
            ?restriction owl:hasValue ?value
 }

In this link you can check a thread about this topic:
http://www.nabble.com/Creating-a-SPARQL-query-to-list-all-the-datatype-properties-%28including-the-inherited-ones%29-tf4264104.html#a12135447.

My advice is read RDF code (ontology) before build a sparql query.

I expect that this mail can help you.

Cheers!.



On 8/23/07, Lisa G. H. <lisa_gh81 at yahoo.com.sg> wrote:
> Hi everybody
>
>   I am using Protege 3.2.1 , Win XP and my ontology is in OWL.
>
>   I have a data type property p1 with domain MyClass1 and range string. If I
> do not put any restrictions regarding the value of p1, and just fill in the
> value, I can access the value of this property (using sparql) with no
> problems :
>
>   Sample query:
>
>   Select ?pd ?text
>   Where { ?a kb:something ?pd.
>              ?pd kb:p1 ?text.
> }
>
>   The text is returned to me - OK
>
>   But when I put restriction on some of subclasses of MyClass1 , I am not
> able to run the same query (I don't get results)
>
>   for example I have subclass1 and subclass2 are subclasses of MyClass1 and
> the restriction is as follows:
>
>   for subclass1:
>   p1 has "Some text 1"
>
>   Could you please tell me how to solve this problem ?
>
>   Most appreciate your help
>   Lisa
>
>
> ---------------------------------
>
>  Real people. Real questions. Real answers. Share what you know.



More information about the protege-owl mailing list