cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

call n10s.onto.import.fetch doesn't work for indirect ontology

fan_123
Node Link

I am using "call n10s.onto.import.fetch" to import the ontology which I generated from Protege. In that ontology file, I refer to some existing ontology files on the internet, as shown below. 

fan_123_0-1662565148959.png

I found that I can't import this indirect ontology with "call n10s.onto.import.fetch" function, can anybody help me?

 

4 REPLIES 4

Hi @fan_123 , thanks for your interest!

The n10s.*.import methods don't follow import links but you can do it with a couple of lines.

All you got to do is do a second pass with the n10s.rdf.stream.* method that returns the triples in your RDF file, extract the subject, predicate, object where the predicate is owl:imports and for use the object as the URL for an n10s.onto.import.fetch request. 

Here's how:

call n10s.rdf.stream.inline('http://your.onto.with.imports',"RDF/XML") yield subject, predicate, object
where predicate = "http://www.w3.org/2002/07/owl#imports"
with object as importedOntoUri
call n10s.onto.import.fetch(importedOntoUri,"RDF/XML") yield terminationStatus, triplesLoaded, extraInfo
return importedOntoUri, terminationStatus, triplesLoaded, extraInfo

 I've tried it with your capabilityModel onto and I get this result:

╒══════════════════════════════════════════════════════════════════════╤═══════════════════╤═══════════════╤═══════════╕
│"importedOntoUri"                                                     │"terminationStatus"│"triplesLoaded"│"extraInfo"│
╞══════════════════════════════════════════════════════════════════════╪═══════════════════╪═══════════════╪═══════════╡
│"https://resourcedescription.rd.tuni.fi/ontology/processTaxonomyModel"│"OK"               │715            │""         │
├──────────────────────────────────────────────────────────────────────┼───────────────────┼───────────────┼───────────┤
│"https://resourcedescription.rd.tuni.fi/ontology/commonConcepts"      │"OK"               │6              │""         │
└──────────────────────────────────────────────────────────────────────┴───────────────────┴───────────────┴───────────┘

Cheers,

 

JB.

 

PS: Note there are some HTTP redirection issues in some of the ontologies.  https://resourcedescription.rd.tuni.fi/ontology/capabilityModel gets redirected to http://150.146.207.114/lode/extract?owlapi=true&url=https://resourcedescription.rd.tuni.fi/ontology/... causing a protocol mismatch exception.

Dear Jesus, thanks a lot! However, when I am using the n10s.rdf.stream.inline function, I met this error

fan_123_0-1667391421543.png

 

The inline procedure takes RDF payload, not the url. The url is for the fetch procedures.

Make sure you pass to the n10s methods the url of the raw RDF (https://raw.githubusercontent.com/mf093087/Ontology/main/Ontology_EMS.ttl), not the pretty formated html version (https://github.com/mf093087/Ontology/blob/main/Ontology_EMS.ttl) otherwise the parser will not be getting Turtle, but HTML.