Provenance & DC

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

Provenance & DC

Margento
Hi Jiba & all, Do you guys happen to know a source for/iri/version of Provenance that is Owlready-loadable? Here are the ones that I have tried so far and all of them output parsing errors, #onto8 = get_ontology("http://www.w3.org/ns/prov#/").load() #onto8 = get_ontology("https://www.w3.org/TR/2013/REC-prov-o-20130430/").load() #onto8 = get_ontology("http://www.w3.org./ns/prov-o").load() #onto8 = get_ontology("prov-o.owl").load() #onto8 = get_ontology("https://www.w3.org/ns/prov").load() #onto8 = get_ontology("http://www.w3.org/ns/prov.owl").load() #onto8 = get_ontology("http://www.w3.org/TR/prov-o/").load() #onto8 = get_ontology("http://www.w3.org/TR/prov-dm/").load() #onto8 = get_ontology("http://www.w3.org/TR/2013/REC-prov-dm-20130430/").load() #onto8 = get_ontology("http://www.w3.org/TR/2011/WD-prov-o-20111026/").load() Also, for Dublin Core, I only managed to find just one location that will load, but then (for whatever reason) the loaded ontology has 0 classes... (and it's not the only ontology that behaves that way when loaded, I'm afraid). Any suggestion would be much, much appreciated. M
gp
Reply | Threaded
Open this post in threaded view
|

Re: Provenance & DC

gp
I did a quick test with http://www.w3.org/ns/prov-o

It indeed fails. Looking into the details, there are newline characters which one could find a bit unexpected. And indeed changing
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix : <http://www.w3.org/ns/prov#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

rdfs:comment 
    a owl:AnnotationProperty ;
    rdfs:comment ""@en ;
    rdfs:isDefinedBy <http://www.w3.org/ns/prov-o#> .

rdfs:isDefinedBy
    a owl:AnnotationProperty .

to (note the removed newline char at line 7)
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix : <http://www.w3.org/ns/prov#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

rdfs:comment a owl:AnnotationProperty ;
    rdfs:comment ""@en ;
    rdfs:isDefinedBy <http://www.w3.org/ns/prov-o#> .

rdfs:isDefinedBy
    a owl:AnnotationProperty .

makes the parser explode at line 11 rather than 7.

Until Jiba has a beautiful fix, you might want to the remove the extra newline chars, which should not be too hard using regex hopefully.

Hope this helps.
GP
Reply | Threaded
Open this post in threaded view
|

Re: Provenance & DC

Jiba
Administrator
Hi,

This looks like a N3 file, not a NTriple; Owlready can only load NTriple, RDF/XML and OWL/XML.

However, you can translate it to RDF/XML using Protégé.

Best regards,
Jiba
Reply | Threaded
Open this post in threaded view
|

Re: Provenance & DC

Margento
Thanks so much, Jiba, will try that! And will keep you posted.
GP, a big thank you to you too.
gp
Reply | Threaded
Open this post in threaded view
|

Re: Provenance & DC

gp
Note, rdflib might be able to perform the conversion too if ever you needed to automate the process. If not I guess it is better or as good to go via Protege.
Reply | Threaded
Open this post in threaded view
|

Re: Provenance & DC

SamiT
Hi guys,

i encountered the same issue (line 7 exception) when running the code in PyCharm. What was quite interesting is that when i ran it from the python console in PyCharm.. i had no issue:

>>> o = get_ontology("http://www.w3.org/ns/prov-o").load()
>>> for c in o.classes():
    print(c)
   
owl.Thing
prov.Activity
prov.ActivityInfluence
prov.Agent
prov.AgentInfluence
prov.Association
...
...
...
prov.Role
prov.SoftwareAgent
prov.Start
prov.Usage

why do you think it behaves as such?

Sami
Reply | Threaded
Open this post in threaded view
|

Re: Provenance & DC

Jiba
Administrator
Hi,

The problem is caused by the fact that this ontology includes some properties that are both ObjectProperty and AnnotationProperty. This is not supported by Owlready (and I'm not sure it is valid with regards to OWL).

Owlready includes some workaround for fixing such properties by assigning them a single type. I've improved it in the development version so as you can now load this ontology.

Jiba