RE: Suggestion on Limiting query results to specific vocabulary/ontology/namespace

> From: Martin Hepp [mailto:martin.hepp@ebusiness-unibw.org]
> Sent: Wednesday, November 02, 2011 04:46
> To: Amit Krishna Joshi
> Cc: semantic-web@w3.org
> Subject: Re: Suggestion on Limiting query results to specific
> vocabulary/ontology/namespace
> 
> Hi Amit:
> 
> A properly designed vocabulary will link the conceptual elements to the
> IRI defining the ontology (or the ontology document; there is a bit of
> a debate about that) using rdfs:isDefinedBy.
> 
> So e.g. for
> * http://purl.org/goodrelations/v1
> * http://purl.org/vso/ns
> * http://www.productontology.org/#
> 
> you could query for all classes from the three ontologies using
> 
> SELECT DISTINCT(?c) WHERE
> { ?c a owl:Class.
> {
>  { ?c rdfs:isDefinedBy <http://purl.org/goodrelations/v1>}
>  UNION
>  { ?c rdfs:isDefinedBy <http://purl.org/vso/ns>}
>  UNION
>  { ?c rdfs:isDefinedBy <http://www.productontology.org/#>}
> }
> }
> LIMIT 1000

While this query gets you all the classes defined by specific vocabularies
defined by their URI, it doesn't get you all the individuals defined by
the classes in these vocabularies. I think, maybe I'm wrong, that Amit
was trying to find the individuals described by classes in vocabularies
that started with the URI pattern http://purl.org/vocab/. For example:

@prefix bio:  <http://purl.org/vocab/bio/0.1/> .
@prefix frbr: <http://purl.org/vocab/frbr/core#> .
@prefix :     <> .

:E1 a bio:Emigration
  ; bio:principal <http://dbpedia.org/resource/Albert_Einstein>
  ; bio:state <http://dbpedia.org/resource/United_States>
  .

:B1 a frbr:Manifestation
  ; frbr:creator <http://dbpedia.org/resource/Albert_Einstein>
  .

Amit wants to find both :E1 & :B1 since the individual is a class in a 
vocabulary that starts with the URI http://purl.org/vocab/. I believe
that he is looking for something like (untested):

WHERE
{
  {
    ?s a ?o .
    ?o rdfs:isDefinedBy <http://purl.org/vocab/bio/0.1/> .
    ?s ?p ?o .
  }
  UNION
  {
    ?s a ?o .
    ?o rdfs:isDefinedBy <http:/purl.org/vocab/frbr/core#> .
    ?s ?p ?o .
  }
}

But the above SPARQL does assume that you know the specific vocabulary 
URIs you are looking and that vocabulary used rdfs:isDefinedBy rather 
than any vocabulary defined under a specific URI pattern.


Andy.

Received on Wednesday, 2 November 2011 14:37:43 UTC