Giter VIP home page Giter VIP logo

lambdamusic / ontospy Goto Github PK

View Code? Open in Web Editor NEW
218.0 14.0 52.0 23.91 MB

Python library and command-line interface for inspecting and visualizing RDF models aka ontologies.

Home Page: http://lambdamusic.github.io/Ontospy/

License: MIT License

Python 7.93% Shell 0.05% CSS 0.71% HTML 31.72% JavaScript 36.95% SCSS 11.34% Less 11.31%
rdf python ontology owl visualization documentation cli

ontospy's Introduction

Ontospy

Python library and command-line interface for inspecting and visualizing RDF models.

Links

Description

Ontospy is a lightweight Python library and command line tool for inspecting and visualizing vocabularies encoded using W3C Semantic Web standards, that is, RDF or any of its dialects (RDFS, OWL, SKOS).

The basic workflow is simple: load a graph by instantiating the Ontospy class with a file containing RDFS, OWL or SKOS definitions. You get back a object that lets you interrogate the ontology. That's all!

The same functionalities are accessible also via a command line application. This is an interactive environment (like a repl) that allows to load ontologies from a local repository, interrogate them and cache them so that they can be quickly reloaded for inspection later on.

Downloads

Generating ontology documentation

Ontospy can be used to generate HTML documentation for an ontology pretty much out-of-the-box.

See the website Examples of ontology documentation generated via Ontospy, or jump straight to the sample CIDOC-CRM or FOAF documentation pages.

From version 2.0, the documentation generation libraries are installed by default with Ontospy. Previously, third party dependencies (e.g. Django) had to be installed separately.

Status

Maintenance

I have little time to spend on this project these days, so I'm mainly focusing on bug fixes and maintenance. Happy to review PRs if you want to add more functionalities!

Development

# git clone the repo first
$ mkvirtualenv ontospy
$ pip install -r requirements.txt
$ pip install -e .

Documentation

http://lambdamusic.github.io/Ontospy/

ontospy's People

Contributors

ajnelson-nist avatar bakulf avatar balon avatar bosforox avatar cthoyt avatar dependabot[bot] avatar jindrichmynarz avatar lambdamusic avatar satra avatar sumutcan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ontospy's Issues

use an option for output format, rather than keyboard input

$ ontodocs -o ontology --theme readable model/ebg-ontology.ttl
OntoDocs v1.2 (OntoSpy v1.9)
------------
Please choose an output format for the ontology visualization: (q=quit)

1) Html: single-page
2) Html: multi-page
3) Markdown: multi-page
4) D3 Dendogram

It's much better to control the output through a command-line option, rather than keyboard input. Guess I could do this, but it's a round-about way.

echo 2 | ontodocs -o ontology --theme readable model/ebg-ontology.ttl

Tree container spans too far & prefix issue

The tree container which shows the hierarchy on the class page spans out of view, and adds a horizontal scrollbar. See attached image.
image

Also, the ontology prefix is wrong, it should be pot:Building, but apparently because the ontology URL ends in pot.jsonld# it somehow sets the prefix to that. Is it possible to actually use the correct preferredPrefix?

more intelligent handling of output folder

If there's something in the output folder, it causes this error:

PermissionError: [WinError 5] Access is denied: 'ontology'

Then it deletes the folder (not just folder contents), which is:

  • not user friendly since if I had something useful there...
  • not useful, since it cannot run when the output folder does not exist

I'd suggest it should create the folder if missing, and have an option to overwrite an existing folder

-e option fails if no arguments are provided

[michele.pasin]@Tartaruga:~>ontospy -e
OntoSpy v1.8.6
------------
You passed the arguments:
Traceback (most recent call last):
  File "/usr/local/bin/ontospy", line 11, in <module>
    sys.exit(main_cli())
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/ontospy/main.py", line 172, in main_cli
    g = Ontospy(sparql_endpoint=sources[0], verbose=verbose)
IndexError: tuple index out of range

add dependency to Pygmentize

I guess Pygmentize is used to highlight the Turtle sources ("implementation" of each term).

2) Html: multi-page
Loading graph...
Building visualization...
Error: Pygmentize Failed (30 times)

Add such dependency, or at least describe in the README how to install it.

Get names of individuals

I would like to get the name of all of the instances of a given class, but without the URI prefix. I think this is more of an RDFLib specific issue dealing with URIRef objects, but maybe there's a solution inside ontospy that I haven't found yet

import ontospy
test_ontology_url = "http://www.w3.org/TR/2003/PR-owl-guide-20031209/wine"
ont = ontospy.Ontospy(test_ontology_url)
for clz in o.classes:
    print(clz)
    for instance in clz.instances():
        print(instance)
        print(dir(instance))

Output:

<Class *http://www.w3.org/TR/2003/PR-owl-guide-20031209/wine#AlsatianWine*>
<Class *http://www.w3.org/TR/2003/PR-owl-guide-20031209/wine#AmericanWine*>
<Class *http://www.w3.org/TR/2003/PR-owl-guide-20031209/wine#Anjou*>
http://www.w3.org/TR/2003/PR-owl-guide-20031209/wine#RoseDAnjou
['__add__', '__class__', '__contains__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getnewargs__', '__gt__', '__hash__', '__init__', '__invert__', '__iter__', '__le__', '__len__', '__lt__', '__mod__', '__module__', '__mul__', '__ne__', '__neg__', '__new__', '__or__', '__radd__', '__reduce__', '__reduce_ex__', '__repr__', '__rmod__', '__rmul__', '__setattr__', '__sizeof__', '__slots__', '__str__', '__subclasshook__', '__truediv__', 'capitalize', 'casefold', 'center', 'count', 'de_skolemize', 'defrag', 'encode', 'endswith', 'eq', 'expandtabs', 'find', 'format', 'format_map', 'index', 'isalnum', 'isalpha', 'isdecimal', 'isdigit', 'isidentifier', 'islower', 'isnumeric', 'isprintable', 'isspace', 'istitle', 'isupper', 'join', 'ljust', 'lower', 'lstrip', 'maketrans', 'md5_term_hash', 'n3', 'neq', 'partition', 'replace', 'rfind', 'rindex', 'rjust', 'rpartition', 'rsplit', 'rstrip', 'split', 'splitlines', 'startswith', 'strip', 'swapcase', 'title', 'toPython', 'translate', 'upper', 'zfill']

...

None of the functions listed with dir return what I want (I iterated through all them and ran them) What I'd like is simply a way to retrieve:

RoseDAnjou

And make it a bit more general than splitting on the # character, since not all ontologies have to use a # to differentiate the base IRI and the members, correct? Thanks so much for the help!

can you support schema:domain/rangeIncludes ?

https://rawgit.com/euBusinessGraph/eubg-data/master/ontology/prop-ebgadminunitl6.html shows no meaningful domain and range. We define it as follows:

ebg:adminUnitL6 a owl:ObjectProperty ;
  schema:domainIncludes locn:Address ;
  schema:rangeIncludes ebg:LAURegion ;
  rdfs:label "Municipality/Commune/Settlement" ;
  rdfs:isDefinedBy ebg: ;
  skos:definition "LAU2 region of the address." .

We use schema:domain/rangeIncludes because they allow polymorphic properties, whereas rdfs:domain/range bind a property to a single class, so they restrict flexibility and don't promote reuse.

I selected Ontodocs because I saw your schema.org example http://www.michelepasin.org/support/ontospy-examples/schema_org_topbraidttl/prop-schemaaction.html so I assumed you support schema:domain/rangeIncludes. But I notice now this is "Schema.org (converted to OWL by TopQuadrant)", and it uses rdfs:domain/range:

schema:action a owl:DatatypeProperty ;
    rdfs:label "action"^^xsd:string ;
    schema:supersededBy schema:muscleAction ;
    rdfs:comment "The movement the muscle generates." ;
    rdfs:domain schema:Muscle ;
    rdfs:range xsd:string .

Unfortunately no doc generator supports schema:domain/rangeIncludes, except schema's own generator :-(. Is there a chance ontodoc will support it?

Installation issue with package files

When running the ontospy installation command : pip install ontospy, I get the following error:

Running setup.py install for ontospy
error: can't copy 'ontospy/viz/static/libs/Chart.js-2.4.0': doesn't exist or not a regular file

Could anyone help me to resolve this issue please ?

How can I modify Ontodocs to create the URIs as in the Ontology?

I'm using Ontodocs to document the EthOn ontology (ethon.consensys.net)
The EthOn concepts have URIs like this: http://ethon.consensys.net/Block

I'd like to be able to dereference these URIs, so that when you go there you will see the Ontodocs page for that concept. However the ontodocs site looks like this: https://ethon.consensys.net/class-block.html

Currently I'm using a github pages 404 redirect hack to achieve URL-rewriting-like behavior. This is SEO unfriendly. Much better though, would be to just use the names from the ontology as page names.

Any ideas how to achieve that?

License

hello

I have recently come across your Ontospy library on Github and started
using it experimentally, I have made some useful progress and I would
like to thank you for your work and for publishing it for others to use.

I am reaching a point where I have some useful extension functionality
and I am considering code maintenance and management.

One key question I have is the license which ontospy is governed by?
The source on github does not appear to provide details on license.
Would you be willing to discuss this topic with me, with a view to
providing a license with the code?

all the best
mark

Latest Ontospy version breaks Ontodocs

Since the update of Ontospy with version 1.9.5.1 it breaks Ontodocs with message:

Traceback (most recent call last):
  File "/usr/bin/ontodocs", line 11, in <module>
    sys.exit(main_cli())
  File "/usr/lib/python3.6/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3.6/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3.6/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/ontodocs/main.py", line 52, in main_cli
    if StrictVersion(ontospy_VERSION.replace("v", "")) < StrictVersion('1.8'):
  File "/usr/lib/python3.6/distutils/version.py", line 40, in __init__
    self.parse(vstring)
  File "/usr/lib/python3.6/distutils/version.py", line 137, in parse
    raise ValueError("invalid version number '%s'" % vstring)
ValueError: invalid version number '1.9.5.1'

Should probably use SemVer -> 1.9.6 ?

get_rdf(path) retrieve an empty model

This script:
path = "~\go.owl.rdf" o = ontospy.Ontospy() model = o.load_rdf(path)
Takes time to load the file, but once it is loaded retrieve an empty model.
But when I download it from the website:
url = "http://purl.obolibrary.org/obo/go.owl" model = ontospy.Ontospy(url)
It takes longer but at least it retrieve a non empty model.
I will check again along the day. But I cannot figurate out the error.

owl:DatatypeProperty not appearing as super

A property declaring the following supers does not display them on its homepage:

:name a owl:DatatypeProperty,
        owl:FunctionalProperty ;
    rdfs:domain :Person ;
    rdfs:range xsd:string .

(see the family ontology for more examples)

typo in visualization template structure

I think there is a typo in the viz/builder.py script, line 41.
It refers to ONTOSPY_VIZ_TEMPLATES + "html-simple", whereas the folder is called html-single...

Delete only contents, but not the output folder itself

It'd be easier to integrate ontodocs with Docker if it'd not try to delete the output directory attached as a volume. Ontodocs should delete only the contents of the output folder, but not the folder itself.

ontodocs_1  | Traceback (most recent call last):
ontodocs_1  |   File "/usr/bin/ontodocs", line 11, in <module>
ontodocs_1  |     sys.exit(main_cli())
ontodocs_1  |   File "/usr/lib/python2.7/site-packages/click/core.py", line 722, in __call__
ontodocs_1  |     return self.main(*args, **kwargs)
ontodocs_1  |   File "/usr/lib/python2.7/site-packages/click/core.py", line 697, in main
ontodocs_1  |     rv = self.invoke(ctx)
ontodocs_1  |   File "/usr/lib/python2.7/site-packages/click/core.py", line 895, in invoke
ontodocs_1  |     return ctx.invoke(self.callback, **ctx.params)
ontodocs_1  |   File "/usr/lib/python2.7/site-packages/click/core.py", line 535, in invoke
ontodocs_1  |     return callback(*args, **kwargs)
ontodocs_1  |   File "/usr/lib/python2.7/site-packages/ontodocs/main.py", line 94, in main_cli
ontodocs_1  |     url = action_visualize(source, fromshell=False, path=outputpath, title=title, theme=theme, verbose=verbose)
ontodocs_1  |   File "/usr/lib/python2.7/site-packages/ontodocs/core/builder.py", line 184, in action_visualize
ontodocs_1  |     url  = build_visualization(ontouri, g, viztype, path, title, theme)
ontodocs_1  |   File "/usr/lib/python2.7/site-packages/ontodocs/core/builder.py", line 226, in build_visualization
ontodocs_1  |     url = v.build(path)
ontodocs_1  |   File "/usr/lib/python2.7/site-packages/ontodocs/core/viz_factory.py", line 92, in build
ontodocs_1  |     self.output_path = self.checkOutputPath(output_path)
ontodocs_1  |   File "/usr/lib/python2.7/site-packages/ontodocs/core/viz_factory.py", line 221, in checkOutputPath
ontodocs_1  |     shutil.rmtree(output_path)
ontodocs_1  |   File "/usr/lib64/python2.7/shutil.py", line 256, in rmtree
ontodocs_1  |     onerror(os.rmdir, path, sys.exc_info())
ontodocs_1  |   File "/usr/lib64/python2.7/shutil.py", line 254, in rmtree
ontodocs_1  |     os.rmdir(path)
ontodocs_1  | OSError: [Errno 16] Device or resource busy: './docs'

Class hierarchy presentation in ontospy-shell

Was wondering if this was best order:

Has Super Class (all): sg:Serial | sg:Work | sg:Publication | sg:Concept | sg:Thing

Maybe would help if an operator rather than a separator were used, e.g. "<" in this case, or ">" if reverse order (class hierarchy descending) was given.

getValuesForProperty: add lazy evaluation of rdflib.URIRef

In [33]: a1.getValuesForProperty("http://scigraph.springernature.com/ontologies/core/doi")
Out[33]: []

In [34]: import rdflib

In [35]: a1.getValuesForProperty(rdflib.URIRef("http://scigraph.springernature.com/ontologies/core/doi"))
Out[35]: [rdflib.term.Literal(u'10.1023/B:HIJO.0000045969.52516.59')]

Error with verbose option

ontospy scan https://scigraph.springernature.com/things/articles/628f2bf55fe35e5b7eb0ef066f4b2c8a
Parsing https://scigraph.springernature.com/things/articles/628f2bf55fe35e5b7eb0ef066f4b2c8a...
Traceback (most recent call last):
  File "/usr/local/bin/ontospy", line 11, in <module>
    sys.exit(main_cli())
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/ontospy/cli.py", line 124, in scan
    action_analyze(sources, endpoint)
  File "/usr/local/lib/python2.7/site-packages/ontospy/core/actions.py", line 81, in action_analyze
    g = Ontospy(uri_or_path=sources, verbose=verbose)
NameError: global name 'verbose' is not defined

Example is not working -

Hello,
I have installed onto spy on a Mac running 10.10.5. When I try calling "ontospy http://purl.org/spar/frbr" I get the following error:
OntoSpy v1.6.8.3

Local library: '/Users/squiresrb/.ontospy/models/'

You passed the argument: http://purl.org/spar/frbr
Traceback (most recent call last):
File "/Users/squiresrb/anaconda/bin/ontospy", line 11, in
sys.exit(main())
File "/Users/squiresrb/anaconda/lib/python3.5/site-packages/ontospy/ontospy.py", line 235, in main
g = Graph(args[0])
File "/Users/squiresrb/anaconda/lib/python3.5/site-packages/ontospy/core/graph.py", line 82, in init
self.OWLTHING = OntoClass(rdflib.OWL.Thing, rdflib.OWL.Class, self.namespaces)
File "/Users/squiresrb/anaconda/lib/python3.5/site-packages/ontospy/core/entities.py", line 259, in init
self.slug = "class-" + str(self.id) + "-" + slugify(self.qname)
File "/Users/squiresrb/anaconda/lib/python3.5/site-packages/ontospy/core/util.py", line 856, in slugify
value = unicode(re.sub('[^\w\s-]', '', value).strip().lower())
File "/Users/squiresrb/anaconda/lib/python3.5/re.py", line 182, in sub
return _compile(pattern, flags).sub(repl, string, count)
TypeError: cannot use a string pattern on a bytes-like object

Is there any way to show properties or special characters in the generated HTML?

Hi!

First off, incredible application, this is really, really nice!

I just had a couple quick questions:
(1) Can I show additional, ontology-defined annotation properties on the concept pages (like if my ontology has the annotation property "hasDefinition" or something)? If so, how?
(2) Is there any way to get Unicode symbols to appear? My ontology has records in German, Russian, Chinese, and Japanese, so would that be a possibility?

Thanks so much!

AttributeError when parsing all_classes, all_properties, all_skos_concepts

This is related to ontodocs issue https://github.com/lambdamusic/Ontodocs/issues/21.
In ontospy/core/ontospy.py line 297 using onto = self.get_ontology(str(uri)) the get_ontology() function returns a list, which leads to the AttributeError: '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 for onto.all_skos_concepts.

Mac sierra installation issue

cannot install it in pycharm, following is the terminal output

Collecting ontospy
Using cached ontospy-1.7.3-py2.py3-none-any.whl
Requirement already satisfied: rdflib-jsonld in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from ontospy)
Collecting pygments (from ontospy)
Using cached Pygments-2.2.0-py2.py3-none-any.whl
Requirement already satisfied: colorama in /Users/gaozhiming/Library/Python/3.6/lib/python/site-packages (from ontospy)
Collecting requests (from ontospy)
Using cached requests-2.13.0-py2.py3-none-any.whl
Requirement already satisfied: rdflib in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from ontospy)
Collecting readline (from ontospy)
Using cached readline-6.2.4.1.tar.gz
Collecting click (from ontospy)
Using cached click-6.7-py2.py3-none-any.whl
Requirement already satisfied: pyfiglet in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from ontospy)
Collecting django (from ontospy)
Using cached Django-1.10.5-py2.py3-none-any.whl
Collecting SPARQLWrapper (from ontospy)
Using cached SPARQLWrapper-1.8.0.zip
Requirement already satisfied: isodate in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from rdflib->ontospy)
Requirement already satisfied: pyparsing in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from rdflib->ontospy)
Installing collected packages: pygments, requests, readline, click, django, SPARQLWrapper, ontospy
Running setup.py install for readline: started
Running setup.py install for readline: finished with status 'error'
Complete output from command /Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6 -u -c "import setuptools, tokenize;file='/private/var/folders/fg/frswgnts1m953d1kfcwm_2t40000gn/T/pycharm-packaging/readline/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /var/folders/fg/frswgnts1m953d1kfcwm_2t40000gn/T/pip-5ntou_qk-record/install-record.txt --single-version-externally-managed --compile:

============ Building the readline library ============

x readline-6.2/
x readline-6.2/doc/
x readline-6.2/doc/Makefile.in
x readline-6.2/doc/texinfo.tex
x readline-6.2/doc/version.texi
x readline-6.2/doc/fdl.texi
x readline-6.2/doc/rlman.texi
x readline-6.2/doc/rltech.texi
x readline-6.2/doc/rluser.texi
x readline-6.2/doc/rluserman.texi
x readline-6.2/doc/history.texi
x readline-6.2/doc/hstech.texi
x readline-6.2/doc/hsuser.texi
x readline-6.2/doc/readline.3
x readline-6.2/doc/history.3
x readline-6.2/doc/texi2dvi
x readline-6.2/doc/texi2html
x readline-6.2/doc/readline.ps
x readline-6.2/doc/history.ps
x readline-6.2/doc/rluserman.ps
x readline-6.2/doc/readline.dvi
x readline-6.2/doc/history.dvi
x readline-6.2/doc/rluserman.dvi
x readline-6.2/doc/readline.info
x readline-6.2/doc/history.info
x readline-6.2/doc/rluserman.info
x readline-6.2/doc/readline.html
x readline-6.2/doc/history.html
x readline-6.2/doc/rluserman.html
x readline-6.2/doc/readline.0
x readline-6.2/doc/history.0
x readline-6.2/doc/readline_3.ps
x readline-6.2/doc/history_3.ps
x readline-6.2/doc/history.pdf
x readline-6.2/doc/readline.pdf
x readline-6.2/doc/rluserman.pdf
x readline-6.2/examples/
x readline-6.2/examples/autoconf/
x readline-6.2/examples/autoconf/BASH_CHECK_LIB_TERMCAP
x readline-6.2/examples/autoconf/RL_LIB_READLINE_VERSION
x readline-6.2/examples/autoconf/wi_LIB_READLINE
x readline-6.2/examples/rlfe/
x readline-6.2/examples/rlfe/ChangeLog
x readline-6.2/examples/rlfe/Makefile.in
x readline-6.2/examples/rlfe/README
x readline-6.2/examples/rlfe/config.h.in
x readline-6.2/examples/rlfe/configure
x readline-6.2/examples/rlfe/configure.in
x readline-6.2/examples/rlfe/extern.h
x readline-6.2/examples/rlfe/os.h
x readline-6.2/examples/rlfe/pty.c
x readline-6.2/examples/rlfe/rlfe.c
x readline-6.2/examples/rlfe/screen.h
x readline-6.2/examples/Makefile.in
x readline-6.2/examples/excallback.c
x readline-6.2/examples/fileman.c
x readline-6.2/examples/manexamp.c
x readline-6.2/examples/readlinebuf.h
x readline-6.2/examples/rl-fgets.c
x readline-6.2/examples/rlcat.c
x readline-6.2/examples/rlevent.c
x readline-6.2/examples/rltest.c
x readline-6.2/examples/rl.c
x readline-6.2/examples/rlptytest.c
x readline-6.2/examples/rlversion.c
x readline-6.2/examples/histexamp.c
x readline-6.2/examples/Inputrc
x readline-6.2/examples/rlwrap-0.30.tar.gz
x readline-6.2/support/
x readline-6.2/support/config.guess
x readline-6.2/support/config.rpath
x readline-6.2/support/config.sub
x readline-6.2/support/install.sh
x readline-6.2/support/mkdirs
x readline-6.2/support/mkdist
x readline-6.2/support/mkinstalldirs
x readline-6.2/support/shobj-conf
x readline-6.2/support/shlib-install
x readline-6.2/support/wcwidth.c
x readline-6.2/shlib/
x readline-6.2/shlib/Makefile.in
x readline-6.2/COPYING
x readline-6.2/README
x readline-6.2/MANIFEST
x readline-6.2/INSTALL
x readline-6.2/CHANGELOG
x readline-6.2/CHANGES
x readline-6.2/NEWS
x readline-6.2/USAGE
x readline-6.2/aclocal.m4
x readline-6.2/config.h.in
x readline-6.2/configure
x readline-6.2/configure.in
x readline-6.2/Makefile.in
x readline-6.2/ansi_stdlib.h
x readline-6.2/chardefs.h
x readline-6.2/history.h
x readline-6.2/histlib.h
x readline-6.2/keymaps.h
x readline-6.2/posixdir.h
x readline-6.2/posixjmp.h
x readline-6.2/readline.h
x readline-6.2/posixselect.h
x readline-6.2/posixstat.h
x readline-6.2/rlconf.h
x readline-6.2/rldefs.h
x readline-6.2/rlmbutil.h
x readline-6.2/rlprivate.h
x readline-6.2/rlshell.h
x readline-6.2/rlstdc.h
x readline-6.2/rltty.h
x readline-6.2/rltypedefs.h
x readline-6.2/rlwinsize.h
x readline-6.2/tcap.h
x readline-6.2/tilde.h
x readline-6.2/xmalloc.h
x readline-6.2/bind.c
x readline-6.2/callback.c
x readline-6.2/compat.c
x readline-6.2/complete.c
x readline-6.2/display.c
x readline-6.2/emacs_keymap.c
x readline-6.2/funmap.c
x readline-6.2/input.c
x readline-6.2/isearch.c
x readline-6.2/keymaps.c
x readline-6.2/kill.c
x readline-6.2/macro.c
x readline-6.2/mbutil.c
x readline-6.2/misc.c
x readline-6.2/nls.c
x readline-6.2/parens.c
x readline-6.2/readline.c
x readline-6.2/rltty.c
x readline-6.2/savestring.c
x readline-6.2/search.c
x readline-6.2/shell.c
x readline-6.2/signals.c
x readline-6.2/terminal.c
x readline-6.2/text.c
x readline-6.2/tilde.c
x readline-6.2/undo.c
x readline-6.2/util.c
x readline-6.2/vi_keymap.c
x readline-6.2/vi_mode.c
x readline-6.2/xfree.c
x readline-6.2/xmalloc.c
x readline-6.2/history.c
x readline-6.2/histexpand.c
x readline-6.2/histfile.c
x readline-6.2/histsearch.c
x readline-6.2/patchlevel
patching file vi_mode.c
patching file callback.c
patching file support/shobj-conf
patching file patchlevel
patching file input.c
patching file patchlevel
patching file vi_mode.c
patching file patchlevel
checking build system type... i386-apple-darwin16.4.0
checking host system type... i386-apple-darwin16.4.0

Beginning configuration for readline-6.2 for i386-apple-darwin16.4.0

checking whether make sets $(MAKE)... yes
checking for gcc... gcc
checking for C compiler default output file name...
configure: error: in `/private/var/folders/fg/frswgnts1m953d1kfcwm_2t40000gn/T/pycharm-packaging/readline/rl/readline-lib':
configure: error: C compiler cannot create executables
See `config.log' for more details.

============ Building the readline extension module ============

running install
running build
running build_ext
building 'readline' extension
creating build
creating build/temp.macosx-10.6-intel-3.6
creating build/temp.macosx-10.6-intel-3.6/Modules
creating build/temp.macosx-10.6-intel-3.6/Modules/3.x
/usr/bin/clang -fno-strict-aliasing -Wsign-compare -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -g -DHAVE_RL_CALLBACK -DHAVE_RL_CATCH_SIGNAL -DHAVE_RL_COMPLETION_APPEND_CHARACTER -DHAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK -DHAVE_RL_COMPLETION_MATCHES -DHAVE_RL_COMPLETION_SUPPRESS_APPEND -DHAVE_RL_PRE_INPUT_HOOK -I. -I/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c Modules/3.x/readline.c -o build/temp.macosx-10.6-intel-3.6/Modules/3.x/readline.o -Wno-strict-prototypes -arch i386 -arch x86_64
Modules/3.x/readline.c:1179:34: warning: incompatible pointer types assigning to 'char *(*)(FILE *, FILE *, const char *)' (aka 'char *(*)(struct __sFILE *, struct __sFILE *, const char *)') from 'char *(FILE *, FILE *, char *)' (aka 'char *(struct __sFILE *, struct __sFILE *, char *)') [-Wincompatible-pointer-types]
    PyOS_ReadlineFunctionPointer = call_readline;
                                 ^ ~~~~~~~~~~~~~
1 warning generated.
Modules/3.x/readline.c:1179:34: warning: incompatible pointer types assigning to 'char *(*)(FILE *, FILE *, const char *)' (aka 'char *(*)(struct __sFILE *, struct __sFILE *, const char *)') from 'char *(FILE *, FILE *, char *)' (aka 'char *(struct __sFILE *, struct __sFILE *, char *)') [-Wincompatible-pointer-types]
    PyOS_ReadlineFunctionPointer = call_readline;
                                 ^ ~~~~~~~~~~~~~
1 warning generated.
creating build/lib.macosx-10.6-intel-3.6
/usr/bin/clang -bundle -undefined dynamic_lookup -g build/temp.macosx-10.6-intel-3.6/Modules/3.x/readline.o readline/libreadline.a readline/libhistory.a -lncurses -o build/lib.macosx-10.6-intel-3.6/readline.cpython-36m-darwin.so -arch i386 -arch x86_64
clang: error: no such file or directory: 'readline/libreadline.a'
clang: error: no such file or directory: 'readline/libhistory.a'
error: command '/usr/bin/clang' failed with exit status 1

----------------------------------------

Command "/Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6 -u -c "import setuptools, tokenize;file='/private/var/folders/fg/frswgnts1m953d1kfcwm_2t40000gn/T/pycharm-packaging/readline/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /var/folders/fg/frswgnts1m953d1kfcwm_2t40000gn/T/pip-5ntou_qk-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/fg/frswgnts1m953d1kfcwm_2t40000gn/T/pycharm-packaging/readline/

Executable not created by installer

Installing with

pip installl ontospy -U 

runs as expected, but the executables ontospy, ontospy-shell and ontospy-viz do not seem to be created...

Environment:
OSX El Capitain / Python 2.7

Bloated installation requirements

While it's packed full of great features, unfortunately, the installation footprint of OntoSpy is rather large.

Would you consider splitting this package into multiple components/plugins, such as the way that Flask, SQLAlchemy and other modules do?

My use case is just for parsing and programatic traversal of RDF/SKOS/OWL documents and have less interest in visualization/command line components. I can imagine other people might just have a use for one of these components, but not all.

AttributeError when running ontodocs

This used to work, but apparently there has been some changes in Ontospy, which breaks things. I've been using Ontodocs for generating HTML pages for our JSON-LD ontology and hosting them on Github Pages. Now today I tried to release an update, and the following happened:

Traceback (most recent call last):
  File "/usr/bin/ontodocs", line 11, in <module>
    sys.exit(main_cli())
  File "/usr/lib/python3.6/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3.6/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3.6/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/ontodocs/main.py", line 89, in main_cli
    url = action_visualize(source, fromshell=False, path=outputpath, title=title, theme=theme, verbose=verbose)
  File "/usr/lib/python3.6/site-packages/ontodocs/core/builder.py", line 170, in action_visualize
    g = Ontospy(ontouri, verbose=verbose)
  File "/usr/lib/python3.6/site-packages/ontospy/core/ontospy.py", line 89, in __init__
    self.build_all(verbose=verbose, hide_base_schemas=hide_base_schemas)
  File "/usr/lib/python3.6/site-packages/ontospy/core/ontospy.py", line 162, in build_all
    self.build_classes(hide_base_schemas)
  File "/usr/lib/python3.6/site-packages/ontospy/core/ontospy.py", line 299, in build_classes
    onto.all_classes += [aClass]
AttributeError: 'list' object has no attribute 'all_classes'

Using version 1.2.1 of ontodocs.
Seems like there's an issue with ontospy at the moment. The following command was used:
echo 2 | ontodocs /src/ontologies/ont.jsonld -o /tmp/html" -t "Title" --theme=darkly

Turtle code implementation when generating html multi page does not work

When generating html multi page, the generation of the turtle code implementation fails with the
error "Error: Pygmentize Failed".

I have had a look at the code and in the file core/viz_factory.py in line 235, the method "serialize"
is called for an object of type OntoProperty. Its superclass RDF_entity has a method "rdf_source" that
by default returns the turtle representation of the object. I have patched the code so this method
is called instead and this fixes the problem.

Can't parse ontology in Turtle format

Tried to generate documentation for an ontology in Turtle format. The file is thesoz.zip. But I faced the following error:

ontodocs_1  | Fatal error parsing graph <./docs/thesoz.ttl>
ontodocs_1  | (using RDF serializations: ['xml', 'turtle', 'n3', 'nt', 'trix', 'rdfa'])
ontodocs_1  | ----------
ontodocs_1  | TIP: You can try one of the following RDF validation services
ontodocs_1  | <http://mowl-power.cs.man.ac.uk:8080/validator/validate>
ontodocs_1  | <http://www.ivan-herman.net/Misc/2008/owlrl/>
ontodocs_1  | /usr/lib/python2.7/site-packages/rdflib/plugins/parsers/structureddata.py:30: UserWarning: html5lib not found! RDFa and Microdata parsers will not be available.
ontodocs_1  |   'parsers will not be available.')
ontodocs_1  | Building visualization...
ontodocs_1  | Done.
ontodocs_1  | => file://./docs/output/index.html

Validate the file with http://ttl.summerofcode.be, and it says Congrats! Your syntax is correct.. The strange thing is that I managed to generate documentation for another ontology in Turtle format, but not for this one.

model.classes does not retrieve the full list of annotated classes in the redf file.

Once I download the model in Ontospy:
url = "http://purl.obolibrary.org/obo/go.owl"
model = ontospy.Ontospy(url)
I extract only the GO_xxxxxxx anotated numbers from the classes, and write them down in a file. But it does not retrieve all the classes. I found this issue comparing the query with ontospy with another one using regular expressions.
I cannot figure out what's the problem.
Many thanks,

Corina

Can't get ontospy to work from python/ipython

Hi there!

I installed via pip install ontospy, and I can't use anything from the module.

In [1]: import ontospy

In [2]: g = ontospy.Graph("efo.owl")
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-2-c74a73d08095> in <module>()
----> 1 g = ontospy.Graph("efo.owl")

AttributeError: 'module' object has no attribute 'Graph'

The only thing that seems exported from the module is a subpackage called logging.

Should I be doing something different?

Edit:
I am using python 2.7.11

custom datatype is mis-identified as a class instead of a property

If an ontology contains a custom datatype by extending a standard one, such as xsd:string, Ontospy identifies it as a class. For example:

 <rdfs:Datatype rdf:about="http://www.example.com/cti_common#structuredText">
    <rdfs:comment xml:lang="en-US">Specifies that the text description is formatted utilizing an encoding scheme.</rdfs:comment>
    <rdfs:label xml:lang="en-US">Structured Text</rdfs:label>
    <rdfs:subClassOf rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
  </rdfs:Datatype>

The example code above defines a custom datatype http://www.example.com/cti_common#structuredText by extending through subclassing http://wwww.w3.org/2001/XMLSchema#string. When this ontology is loaded into OntoSpy, it is identified as a class as shown below:

>>> model.printClassTree()
cti:ChangeStatement
cti:Note
cti:Reference
cti:structuredText

Yet when you retrieve the class using model.getClass("structuredText") and theserialize you get the following:

>>> model.getClass("structuredText")
[<Class *http://www.example.com/cti_common#structuredText*>]
>>> a_class = _[0]
>>> print(a_class.serialize())
@prefix cti: <http://www.example.com/cti_common#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix vs: <http://www.w3.org/2003/06/sw-vocab-status/ns#> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

cti:structuredText a rdfs:Datatype ;
    rdfs:label "Structured Text"@en-US ;
    rdfs:comment "Specifies that the text description is formatted utilizing an encoding scheme."@en-US ;
    rdfs:subClassOf xsd:string .

This appears to be because in QueryHelper.py, the method getAllClasses treats anything RDF entity that has an refs:subClassOf as a class.

fonts.googleapis.com cannot be reached from local file and causes slowness

Opening https://rawgit.com/euBusinessGraph/eubg-data/master/ontology/index.html is fast.
But if you download https://github.com/euBusinessGraph/eubg-data/tree/master/ontology and open index.html locally, it's very slow. I've tracked it down to this url:

I think you should open fonts.googleapis.com using explicit protocol (http or https).

Generated with

$ ontodocs -o ontology --theme readable model/ebg-ontology.ttl
OntoDocs v1.2 (OntoSpy v1.9)
------------
Please choose an output format for the ontology visualization: (q=quit)
2) Html: multi-page

Error on printing skos taxononomy

Shell fails on 'tree' command:

Loaded graph: </Users/tonyhammond/.ontospy/modelssubjects.ttl>
----------------
Ontologies......: 1
Classes.........: 0
Properties......: 0
..annotation....: 0
..datatype......: 0
..object........: 0
Concepts(SKOS)..: 2791
----------------
==> Ontology URI: <http://ns.nature.com/subjects/>
----------------
<subjects.ttl>: tree concepts
Traceback (most recent call last):
  File "/usr/local/bin/ontospy", line 11, in <module>
    sys.exit(main())
  File "/Library/Python/2.7/site-packages/ontospy/ontospy.py", line 498, in main
    Shell().cmdloop()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/cmd.py", line 142, in cmdloop
    stop = self.onecmd(line)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/cmd.py", line 221, in onecmd
    return func(arg)
  File "/Library/Python/2.7/site-packages/ontospy/shell.py", line 581, in do_tree
    g.printSkosTree(showids=False, labels=False, showtype=True)
TypeError: printSkosTree() got an unexpected keyword argument 'showtype'
% 

Use visualize through a script

Hello,

I would like to use the "visualize" functionality through scripting, instead of using it through the ontospy shell. How can I do that?

Thank you in advance!

Regards,
Prodromos

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.