2

I have created the following OWL in Protege and when I am executing the SPARQL in dbpedia.org/sparql it doesn't return anything.

@prefix : <http://www.wad.nistorandrei.com/ontology.owl#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .

<http://www.wad.nistorandrei.com/ontology.owl> a owl:Ontology .
# 
# 
# #################################################################
# #
# #    Object Properties
# #
# #################################################################
# 
# 
# http://www.wad.nistorandrei.com/ontology.owl#type

:type a owl:ObjectProperty ;
    rdfs:isDefinedBy rdf:type ;
    rdfs:label "type" .
# 
# 
# 
# #################################################################
# #
# #    Classes
# #
# #################################################################
# 
# 
# http://www.wad.nistorandrei.com/ontology.owl#Church

:Church a owl:Class ;
    rdfs:subClassOf :Place .
# 
# http://www.wad.nistorandrei.com/ontology.owl#Place

:Place a owl:Class .
# 
# Generated by the OWL API (version 4.1.3.20151118-2017) https://github.com/owlcs/owlapi

This is the query I am trying to execute

PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
            PREFIX dbo: <http://dbpedia.org/ontology/>
            PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
            PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
            PREFIX dcterms: <http://purl.org/dc/terms/>
            PREFIX ontology: <http://wad.nistorandrei.com/ontology.owl>

            SELECT DISTINCT * WHERE {
                            ?s a dbo:Place;
                            geo:lat ?lat;
                            geo:long ?lng;
                            ontology:type ?type;
                            rdfs:label ?label;
                            dcterms:subject ?sub;
                            dbo:abstract ?description;
                            dbo:thumbnail ?thumbnail .

                        FILTER( lang(?label) = "en" )
                        FILTER( lang(?description) = "en" ) . FILTER ( ( ?lng > 27.577898 && ?lng < 27.597898 && ?lat > 47.144996 && ?lat < 47.164996 ) ) }
        ORDER BY ?s

If you change "ontology:type ?type;" to "rdf:type ?type" it will return the information I need.

What I am trying to achieve (if I am doing this wrong) is to map more types to one type. For example ontology:Church to **dbo:ReligiousBuilding or some other that is related to churches **.

The important thing is for the query that uses ontology:type to work.

Can anyone give me a hint?

Thank you.

Joshua Taylor
  • 84,998
  • 9
  • 154
  • 353
Adore
  • 71
  • 7
  • If the idea is to create RDF data based on the data in DBpedia, you'll probably want to use a **construct** query to create the corresponding triples. There's a similar question that may help, [Is there a way to convert the data format of an RDF vocabulary to SKOS](http://stackoverflow.com/questions/24447249/is-there-a-way-to-convert-the-data-format-of-an-rdf-vocabulary-to-skos). – Joshua Taylor Feb 02 '16 at 21:23
  • [You commented on my answer](http://stackoverflow.com/questions/35161499/extend-owl-of-other-ontology/35164167?noredirect=1#comment58074686_35164167), *"Thank yuo for your response. Is there a way to merge 2 ontologies and return the needed information?"* It's still not clear what "the needed information is". Can you show an example of the results that you'd like to get? Aside from that, we're just guessing at what you're trying to do. – Joshua Taylor Feb 03 '16 at 13:54
  • If you change in the query "ontology:type ?type;" to "rdf:type ?type;" and execute the query in http://dbpedia/sparql you will see the results. – Adore Feb 03 '16 at 14:02
  • But why not just run that query then? The query is looking for triples in DBpedia data. DBpedia has triples of the form `a rdf:type b`, but it doesn't have any of the form `a yourontology:type b`. You can't do what it sounds like you're trying to do. – Joshua Taylor Feb 03 '16 at 14:09
  • Understood, thank you for you help. – Adore Feb 03 '16 at 21:23

1 Answers1

3

Issues

There are a couple of issues here.

Wrong Prefix

The first is that you're using

PREFIX ontology: <http://wad.nistorandrei.com/ontology.owl>
#-- ...
   ontology:type ?type

which means that ontology:type stands for

        http://wad.nistorandrei.com/ontology.owltype (no # in there)

whereas the property that you've declared in your ontology is

        http://www.wad.nistorandrei.com/ontology.owl#type (with a #)

so you're actually using different IRIs. You should declare your prefix as:

PREFIX ontology: <http://wad.nistorandrei.com/ontology.owl#>

DBpedia doesn't know about your ontology

That said, even if you fix that, you still won't get any results. The query doesn't return anything, because DBpedia doesn't have any data from your ontology. Declaring a prefix just means that you can write certain URIs in a shorter way. It doesn't mean that DBpedia has somehow loaded your ontology or has any data using those IRIs.

Checking languages

This probably won't keep your query from working, but note that you should generally compare language tags using langMatches, not by = and lang. E.g., you should use something like

filter langMatches(lang(?var), "en")

That will handle regional variants correctly. For instance, if ?var was bound to "colour"@en-gb, it would still match.

Joshua Taylor
  • 84,998
  • 9
  • 154
  • 353
  • Thank yuo for your response. Is there a way to merge 2 ontologies and return the needed information ? – Adore Feb 03 '16 at 13:51
  • What do you want to merge? Do you know how big the DBpedia dataset is? Merging would mean to setup your own triple store locally, and then load DBpedia and your ontology into it. But even then, none of the resources contains data which uses your vocabulary. – UninformedUser Feb 03 '16 at 21:55