Working with SOSA ONTOLOGY, problem with namespaces

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Working with SOSA ONTOLOGY, problem with namespaces

aicarrera
Hi, I am not experienced working with ontologies, I am trying to follow the tutorial from the book (Ontologies with Python)  to populate an ontologies with a csv  and it works with the example in the book, but then I tried to populate SOSA ontology (https://www.w3.org/ns/sosa/) I transformed it to rdf/xml and this one class I populated



This is the code. I am using the namespace to access properties


the saved individuals look like this:
 

The problem is that when I tried to show the information of the properties using other example of the book, it just shows an empty list even when I see that the information is there.  
I think is because of the namespaces, but I have no idea how to fixit, I´ve tried to use the namespace but I got an error


how it shows


I think when I saved the individuals no longer uses the whole uri, just the abreviature, I don't know if has something to do with that.

Please help :(


Reply | Threaded
Open this post in threaded view
|

Re: Working with SOSA ONTOLOGY, problem with namespaces

Jiba
Administrator
Hi,

The ontology population seems ok, the problem is probably in the dynamic website code.

Could you send me that code and the ontology (or a small part of it), so I can try to debug the problem?

Jiba
Reply | Threaded
Open this post in threaded view
|

Re: Working with SOSA ONTOLOGY, problem with namespaces

aicarrera
Hi! Thank u so much for your reply

This is the link of the code in python:

https://drive.google.com/file/d/1FFBkQr2bdQxJ2cJ4t0QCIpGqk-Vkjh48/view?usp=sharing

This is the link of the ontology (The individuals are at the end):

https://drive.google.com/file/d/1ALDOZQ5-hE_Z5GQrEk1svLEdqcZqh0Wm/view?usp=sharing

The whole project is in here:
https://drive.google.com/drive/folders/1XuzssOPH-1RvZfaZSjTncaTMrxDdZ4jm?usp=sharing

Thanks again
Reply | Threaded
Open this post in threaded view
|

Re: Working with SOSA ONTOLOGY, problem with namespaces

Jiba
Administrator
Hi,

I think there is a problem in the ontology:
 * The ontology IRI is "http://www.w3.org/ns/sosa" (abbreviated sosa:)

 * Entities are defined with just their name, e.g. "<owl:Class rdf:about="Observation">". The resulting IRI is obtained by combining the ontology IRI with the name, leading to "http://www.w3.org/ns/Observation" (notice the absence of "/sosa" in the IRI, caused by the absence of a / to separate the ontology IRI and the name)

 * Entities are then referred as e.g. sosa:Observation, corresponding to the IRI "http://www.w3.org/ns/sosa/Observation", which is NOT the IRI that was used to define them. Consequently, the class, properties, etc are not well referenced. If you open you ontology in Protégé, you will see 2 distinct Observation classes.

In such circumstances, you should use full IRI when defining entities, e.g. "<owl:Class rdf:about="http://www.w3.org/ns/sosa/Observation">". Protégé does that.

BTW, there is also another mistake in sensor_showOG.py: in ontology_page(), "return html" should not be inside the loop.

Jiba