Closed soderluk closed 5 years ago
cannot reproduce this error I'm afraid.
Just pushed some changes to make those get_ontology
methods are more solid. (pip install ontospy -U
to make sure you get the latest version).
If you can try again and share your RDF source file causing the error that'd be useful..
Hi,
I'm using a json-ld ontology file as the source. You can e.g. use the Hydra core ontology as the source file: https://www.w3.org/ns/hydra/core
Also, there's an issue with the match
, as it only matches http://
and not https://
. Our ontology has https
URLs, which then again fails the generation of the HTML.
if type(id) == type("string"):
uri = id
id = None
if not uri.startswith("http://"): <-- This one fails, if the uri starts with https://
match = uri
uri = None
Thanks for the feedback. It works for me. Here's what I get:
$ ontospy scan https://www.w3.org/ns/hydra/core
Parsing https://www.w3.org/ns/hydra/core...
Ontologies
-----------
http://www.w3.org/ns/hydra/core
=> http://www.w3.org/1999/02/22-rdf-syntax-ns#type
.... http://www.w3.org/2002/07/owl#Ontology
=> http://creativecommons.org/ns#attributionURL
.... http://www.hydra-cg.com/
=> http://purl.org/vocab/vann/preferredNamespacePrefix
.... hydra
=> http://www.w3.org/2000/01/rdf-schema#comment
.... A lightweight vocabulary for hypermedia-driven Web APIs
=> http://purl.org/dc/terms/description
.... The Hydra Core Vocabulary is a lightweight vocabulary to create hypermedia-driven Web APIs. By specifying a number of concepts commonly used in Web APIs it enables the creation of generic API clients.
=> http://www.w3.org/2000/01/rdf-schema#label
.... The Hydra Core Vocabulary
=> http://creativecommons.org/ns#attributionName
.... Hydra W3C Community Group
=> http://purl.org/dc/terms/rights
.... Copyright © 2012-2014 the Contributors to the Hydra Core Vocabulary Specification
=> http://purl.org/dc/terms/publisher
.... Hydra W3C Community Group
=> http://creativecommons.org/ns#license
.... http://creativecommons.org/licenses/by/4.0/
Classes
----------
hydra:Resource
----hydra:ApiDocumentation
----hydra:Class
----hydra:Collection
----hydra:IriTemplate
----hydra:IriTemplateMapping
----hydra:Link
----hydra:Operation
----hydra:PartialCollectionView
----hydra:Status
--------hydra:Error
----hydra:SupportedProperty
----hydra:TemplatedLink
----hydra:VariableRepresentation
Properties
----------
hydra:description
hydra:freetextQuery
hydra:mapping
hydra:method
hydra:property
hydra:readable
hydra:required
hydra:statusCode
hydra:template
hydra:title
hydra:totalItems
hydra:variable
hydra:variableRepresentation
hydra:writeable
SKOS Concepts
----------
None found
SHACL Shapes
----------
None found
-----------
Time: 5.63s
Try updating ontospy maybe? (PS that https problem's been fixed too)
I need to test this out. Does it work via Ontodocs? As we're using that to generate the HTML pages for our ontology.
Awesome! Thanks for fixing this. It was really a blocker for us. I have a couple of other questions, but I'll create new issues for those.
This is related to ontodocs issue https://github.com/lambdamusic/Ontodocs/issues/21. In
ontospy/core/ontospy.py
line 297 usingonto = self.get_ontology(str(uri))
theget_ontology()
function returns a list, which leads to theAttributeError: 'list' object has no attribute 'all_classes'
error. Same thing on line 376,AttributeError: 'list' object has no attribute 'all_properties'
. Line 436 uses it foronto.all_skos_concepts
.