Package: pylode
pyLODEAn OWL ontology documentation tool using Python, based on LODE.In addition to making web page, human-readable forms of ontologies, pyLODE encourages ontology annotationbest
practiceby only producing good results for well documented inputs! pyLODE defines what it considers ‘well documented’
in sections below, e.g.What pyLODE understands.A note on the v 3.x changeThis is pyLODE version 3.0.1 and it’s vastly different from pyLODE 2.x. It doesn’t yet handle all the various “profiles” that pyLODE 2.13.2 does, such as SKOS ‘vocabularies’ & Profiles Vocabulary ‘profiles’, it only handles OWL ‘ontologies’, nor all the special data types, such as JSON literals, BUT, it generates HTML in a much more straightforward manner and the code is both more efficient and much more maintainable, which is why it’s been made.v 3.x will eventually catch up to all of v 2.13.2’s features.To access v 2.13.2 of pyLODE, eitherdownload it from PyPI,check it out from GitHubor access it via theonline service.In v3.1.0, pyLODE now has a new mode calledsupermodel, in addition to the existingontpubmode. Seesupermodel.mdfor more information.ContentsQuick IntroUseWhat pyLODE understandsExamplesInstallationTestingDifferences from LODEReleasesLicenseCitationCollaborationContactsQuick IntroThe Live OWL Documentation Environment tool
(LODE) is a well-known (in
Semantic Web circles) Java & XSLT-based tool used to generate
human-readable HTML documents for OWL and RDF ontologies. That tool is
now a bit dated (old-style HTML, use of older technologies like XSLT)
and its (online version) is not always
online.This tool is a complete re-implementation of LODE’s functionality using
Python and Python’s RDF manipulation module,rdflib. An ontology to be
documented is parsed and inspected using rdflib and HTML is generated
directly, using Python’sdominatepackage.UseThe tool can be used in multiple ways:BASH command line scriptpyLODE.sh in bin/Windows EXEpyLODE.exe in bin/Mac executablepyLODE in bin/Python Scriptcli.py or moduleas-a-service locallyvia the popularFalcon framework.see server.py in the main folderas-a-service onlinehosted athttps://pylode.surroundaustralia.comCommand line argumentsThe BASH, Windows EXE and Python Script methods all use the same command line
arguments:usage: cli.py [-h] [-v] [-o OUTPUTFILE] [-c {true,false}] input

positional arguments:
    input                 Input file location or URL

optional arguments:
    -h, --help          show this help message and exit
    -v, --version       show program's version number and exit
    -o OUTPUTFILE,
    --outputfile OUTPUTFILE
                        A name you wish to assign to the output file. Will be
                        postfixed with .html if not already added. If no
                        output file is given, output will be printed to screen
    -c {true,false},
    --css {true,false}
                        Whether (true) or not (false) to include CSS within an
                        output HTML file.Basic Useas a Python scriptexecuted in this directorypython pylode examples/ontpub/minimal.ttl -o minimal.htmlThis will produce the fileminimal.htmlin this directory which should
match exactly the fileexamples/minimal.html.as a docker containerbuild the docker imagedocker build -t pylode:latest .copy the example directory, mount it to the container and run cli.py in the containerdocker  run  --mount 'type=bind,src=<ttl_directory>,target=/app/pylode/data' pylode:latest  python3.10 pylode/cli.py data/<ttl_file> -o data/<html_file>

Note: <ttl_directory> must be absoluteModule Usefrom pylode import OntDoc

# initialise
od = OntDoc(ontology="some-ontology-file.ttl")

# produce HTML
html = od.make_html()

# or save HTML to a file
od.make_html(destination="some-resulting-html-file.html")This will read fromsome-ontology-file.ttlto produce the filesome-resulting-html-file.htmlin this directory.ExamplesTheexamples/ directorycontains multiple pairs of RDF & HTML files generated from them using this
version of pyLODE.You can also see rendered versions of these example files online too:minimal.htmlagift.htmlalternates.htmlasgs.htmlWhat pyLODE understandspyLODE knows about definitional ontologies (owl:Ontology) and the major
elements usually found in them, such as classes (owl:Classorrdf:Class) and properties(``rdf:Property&owl:ObjectPropertyetc.).To see what properties for ontology, class and RDF property documentation
pyLODE currently supports, just look in therdf_elements.pyfile. All
elements’ properties supported are given in property lists there.pyLODES won’t just translate everything that you can describe in RDF into
HTML! This is a conscious design choice to ensure that a certain conventional
style of documented ontology is produced. However, support for new
properties and ontology patterns can be made - just create an Issue onthis project’s Issue tracker.While itdoesknow about instance data, such as Named Individuals, it’s
not really designed to document large ontologies containing class instances.Notes on AgentspyLODE can understand both simple and complex Agent objects. You can use
simple string properties likedc:contributor "Nicholas J. Car"too if
you really must but better would be to take advantage of real Linked Data
representation, e.g. complex Agent objects with web addresses, emails,
affiliations, ORCIDs and so on, e.g.:<ontology_x>
    dct:creator [
        sdo:name "Nicholas J. Car" ;
        sdo:identifier <http://orcid.org/0000-0002-8742-7730> ;
        sdo:affiliation [
            sdo:name "SURROUND Australia Pty Ldt." ;
            sdo:url "https://surroundaustralia.com"^^xsd:anyURI ;
        ] ;
    ] ;See all the properties inrdf_elements.py:AGENT_PROPSfor a list of
all the Agent properties pyLODE can handle.InstallationpyLODE ison PyPI, so you can install
it usingpipas normal:pip install pylodeTestingIt’s best to disable warnings to hide pointless warnings from the RDFLib library.::~$ python -m pytest tests –disable-warningsDifferences from LODEcommand line accessyou can use this on your own desktop so you don’t need me to
maintain a live service for useuse of modern simple HTMLno JavaScript: pyLODE generates static HTML pagescatering for a wider range of ontology options such as:schema.orgdomainIncludes&rangeIncludesfor propertiesbetter Agent representationsee theNotes on Agentssection abovesmarter CURIESpyLODE caches and looks up well-known prefixes to make more/better
CURIESit tries to be smart with CURIE presentation by CURIE-ising all
URIs it finds, rather than printing themreference ontologies property labelspyLODE caches ~ 10 well-known ontologies (RDFS, SKOS etc), properties from which people often use for their ontology documentation. Where these properties are used, the background ontology’s labels are useactive developmentpyLODE has been under active development since mid-2019 and is
still very much actively developed - it’s not just staying stillit will be improved in foreseeable to cater for more and more thingsrecent ontology documentation initiatives such as theMOD
Ontologywill be
handled, if requestedReleasespyLODE is under continual and constant development. The current developers have a roadmap for enhancements in mind,
which is given here, however, since this is an open source project, new developers may join the pyLODE dev community
and change/add development priorities.Current ReleaseThe current release, as of April, 2023, is3.0.5.Release SchedulepyLODE Release ScheduleVersionDateDescription3.1.119 February 2024Fix release3.1.019 February 2024Add supermodel mode - supports documenting profiles and modules3.0.527 April 2023Minor patching3.0.424 May 2022Use of Poetry3.0.224 May 2022Support for preformatted skos:example literals3.0.16 Jan 2022Direct HTML generation using dominate; easier to maintain and extend2.13.221 December 2021Updated RDFlib to 6.1.1, improved test to properly use pytest2.10.024 May 2021Update Windows EXE build process, simplified versioning2.9.128 Apr 2021Support for ASCIIDOC format (OntDoc profile only)2.8.1128 Apr 2021Further changes for PyPI only2.8.1027 Apr 2021Further changes for PyPI only2.8.927 Apr 2021PyPI enhancements only2.8.827 Apr 2021Several small bugs fixed, auto-generation of version no. from Git tag2.8.623 Feb 2021Fixing char encoding issues, updated examples, new test files style - per issue2.8.55 Jan 2021Small enhancements to the Falcon server deployment option2.8.33 July 2020Packaging bugfixes only2.71 July 2020Much refactoring for new profile creation ease2.6June 2020Supports PROF profiles as well as taxonomies & ontologies2.427 May 2020Small improvements over 2.02.018 Apr 2020Includes multiple profiles - OWP & vocpub1.015 Dec 2019Initial working releaseLicenseThis code is licensed using the BSD 3-Clause licence. See theLICENSE
filefor the deed. NoteCitationbelow though for
attribution.CitationIf you use pyLODE, please leave the pyLODE logo with a hyperlink back
here in the top left of published HTML pages.CollaborationThe maintainers welcome any collaboration.If you have suggestions, please email the contacts below or leave Issues
in this repository’sIssue tracker.But the very best thing you could do is create a Pull Request for us to
action!ContactsAuthor:Nicholas CarData ArchitectKurrawong AInick@kurrawong.net