andrecastro0o / ontology2smw

automating an RDF ontology import into Semantic Mediawiki
GNU General Public License v3.0
16 stars 5 forks source link

Import own ontology #60

Closed danielriedmueller closed 3 years ago

danielriedmueller commented 3 years ago

Hello!

I am unable to import an ontology and maybe you can help me with this. There are nor errors, but also nothing gets imported. I am using Python 3.8 and checked out the master branch. I was hoping that its just going to work after issue31 has been merged to master. Maybe i have to do additional steps?

If you want to have a look, here is the uploaded .ttl file: vocabularies.log (Unfortunately GitHub does not allow to upload .ttl files, so i changed the file ending to .log)

Many thanks!

andrecastro0o commented 3 years ago

@danielriedmueller I see what you mean. I also ran it with the vocabularies.ttl that you attached and no terms have been imported.

That got me a bit puzzled. So I simply ran the sparql query https://github.com/TIBHannover/ontology2smw/blob/master/ontology2smw/queries/ontology_terms.rq which gets the term from the ontology file against your ontology and was surprised to see no terms returned.

I have to look into it. Either it is something in the vocabularies.ttl or the https://github.com/TIBHannover/ontology2smw/blob/master/ontology2smw/queries/ontology_terms.rq is failing to handle that use case.

Will keep you posted.

(venv) $ arq --query ontology2smw/queries/ontology_terms.rq --data ~/Downloads/vocabularies.ttl 
----------------------------------------------------------------------------------
| term | termType | label | range | subclassof | subpropertyof | smw_import_info |
==================================================================================
----------------------------------------------------------------------------------
(venv) $ arq --query=ontology2smw/queries/ontology_terms.rq --data ~/Documents/TIB/ontologies/foaf.ttl 
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| term                                                   | termType             | label | range        | subclassof                                             | subpropertyof                                | smw_import_info |
==================================================================================================================================================================================================================================
| dcterm:Agent                                           | owl:Class            |       |              |                                                        |                                              |                 |
| <http://schema.org/CreativeWork>                       | owl:Class            |       |              |                                                        |                                              |                 |
| <http://schema.org/ImageObject>                        | owl:Class            |       |              |                                                        |                                              |                 |
danielriedmueller commented 3 years ago

Thank you!

andrecastro0o commented 3 years ago

Hi @danielriedmueller Have look at your ontology file and the ontology2smw/queries/ontology_terms.rq

And the reason for no results being returned from the query, and hence the terms not being imported to SMW, results from you using skos terms as classes ie. retv-genre:tg a skos:ConceptScheme ; retv-genre:ko a skos:Concept ; and ontology2smw/queries/ontology_terms.rq is not querying skos:Concept or skos:ConceptScheme.

I am only superficially familiar with SKOS, but from what I could read in the official documentation:

3.5.1. SKOS Concepts, OWL Classes and OWL Properties Other than the assertion that skos:Concept is an instance of owl:Class, this specification does not make any additional statement about the formal relationship between the class of SKOS concepts and the class of OWL classes. The decision not to make any such statement has been made to allow applications the freedom to explore different design patterns for working with SKOS in combination with OWL.

Hence the recommendation seems to be, add owl:Class or owl:ObjectProperty to the term definition, in your case, something like: retv-genre:ko a skos:Concept, owl:Class ;

Having said that my ontology2smw SPARQL queries and code is probably ready to handle the full SKOS based ontologies. Probably keep me posted on your progress.

Hope was able to help.

andrecastro0o commented 3 years ago

I will close the issue then

danielriedmueller commented 3 years ago

Thank you, now we were able to get it work!

andrecastro0o commented 3 years ago

You are welcomed! That's great to hear.