Re: [Question] How to define class instances by intention, in OWL (with a SPARQL query)

You can do this in OWL 2, which is now in CR. I've attached your
example which can be opened in protege4. If you run the classifier you
will find that Austria is inferred to be an instance of
birthPlaceOfRomanticComposer, and that birthPlaceOfRomanticComposer is
inferred to subclass of place. I've also attached a screenshot of the
inferred view. On the right, hilited in yellow, are the things that
are inferred.

Note that in the real definition you don't really need the conditions
on birth and death, since you've already restricted to romantic
composers, though perhaps you meant to query over all composers
instead. Also note I adjusted the condition to birth > 1700 versus
birth >1800, since wikipedia didn't list any romantic composers born
after 1800.

Using Manchester Syntax, it looks like this:

Namespace: romantic <http://purl.org/NET/romantic/>
Namespace: property <http://dbpedia.org/property/>
Namespace: yago <http://dbpedia.org/class/yago/>

Ontology: <http://purl.org/NET/romantic.owl>

/* define birthPlace */
ObjectProperty: property:birthPlace
    Range:
        romantic:place

/* define birth and death properties */
DataProperty: property:death
DataProperty: property:birth

/* define desired class - note use of inv(property:birthPlace) to mean
the inverse property, and slightly modified condition birth > 1700,
since wikipedia doesn't list any romantic composers born after 1800.
*/

Class: romantic:birthPlaceOfRomanticComposer
    EquivalentTo:
         inv (property:birthPlace) some
	   (yago:RomanticComposers
              and (property:birth some integer[> 1700])
              and (property:death some integer[< 1900]))

/* Define place (could have looked up the dbpedia class but was lazy.
Places and composers are disjoint */
Class: romantic:place
    DisjointWith:
        yago:RomanticComposers

/* Define yago:RomanticComposers */
Class: yago:RomanticComposers
    DisjointWith:
        romantic:place

/* Now create some individuals to test classification */
Individual: romantic:Austria
    Types:
        romantic:place,

Individual: romantic:Schubert
    Types:
        yago:RomanticComposers,
    Facts:
        property:birthPlace  romantic:Austria,
        property:death  1828,
        property:birth  1797


http://www.w3.org/2007/OWL/wiki/OWL_Working_Group
http://protege.stanford.edu/download/registered.html#p4

-Alan


On Tue, Aug 4, 2009 at 9:29 AM, Pierre-Yves
Vandenbussche<pierre-yves.vandenbussche@mondeca.com> wrote:
>
> Hello,
>
> I'm currently working on dynamic collection definition and try to express it
> in OWL format.
>
> I would like to specify a class for which all instances are defined in
> intention by a query. The only way I found is to put a property "query"
> which has a literal value and contained the query.
> As far as i know, this representation, by the mean of OWL restriction, is
> not possible (i may be wrong) .
>
> Example : The class of native places of 19th century romantic composers, as
> retrieved by the following SPARQL Query on dbpedia
>
>       SELECT ?x
>       WHERE
>           {
>           ?c  dbpprop:birthPlace  ?x.
>           ?c a <http://dbpedia.org/class/yago/RomanticComposers>.
>           ?c  dbpprop:birth  ?b.
>           ?c  dbpprop:death ?d.
>           FILTER (?b > 1800)
>           FILTER (?d <1900)
>            }
>
>
> Is there a way to define in OWL, membership of a class with a query ?
>
> Thank you,
>
> Pierre-Yves.
>

Received on Wednesday, 5 August 2009 13:49:13 UTC