Coder Social home page Coder Social logo

specgen / specgen Goto Github PK

View Code? Open in Web Editor NEW
27.0 27.0 18.0 722 KB

My modified, extended and more generalized version of Danbri‘s SpecGen version 5. My SpecGen version 6 is able to generate a XHTML+RDFa ontology specification with common concepts and properties based on OWL, RDFS and RDF, and parse these statements into a template of the ontology documentation.

Home Page: http://smiy.org/2010/07/13/my-specgen-version-6/

Python 24.58% CSS 1.50% Web Ontology Language 2.24% HTML 71.68%

specgen's Introduction

SpecGen v6

About

This is an experimental new codebase for specgen tools based on danbri's specgen5 version, which was heavily updated by Bo Ferri in summer 2010.

Features (incl. modifications + extensions):

  • multiple property and class types
  • muttiple restrictions modelling
  • rdfs:label, rdfs:comment
  • classes and properties from other namespaces
  • inverse properties (explicit and anonymous)
  • sub properties
  • union ranges and domains (appear only in the property descriptions, not on the class descriptions)
  • equivalent properties
  • simple individuals as optional feature

Dependencies

It depends utterly upon

(at least I had to install these packages additionally ;) )

If you're lucky, typing this is enough:

easy_install rdflib python-igraph

and if you have problems there, update easy_install etc with:

easy_install -U setuptools

Ubuntu, you can install the dependencies with pip after installing the relevant libraries

sudo apt-get install python-dev build-essential libxml2-dev libxslt python-igraph
sudo pip install -r requirements.txt

Purpose

Inputs: RDF, HTML and OWL description(s) of an RDF vocabulary
Output: an XHTML+RDFa specification designed for human users

Example

specgen6.py --indir=onto/olo/ --ns=http://purl.org/ontology/olo/core#  --prefix=olo --ontofile=orderedlistontology.owl --outdir=spec/olo/ --templatedir=onto/olo/ --outfile=orderedlistontology.html
  • the template of this example can also be found in the folder: onto/olo
  • the output of this example can also be found in the folder: spec/olo

See libvocab.py and specgen6.py for details.

Status

  • we load up and interpret the core RDFS/OWL
  • we populate Vocab, Term (Class, Property or Individual) instances
  • able to generate a XHTML/RDFa ontology specification with common concepts and properties from OWL, RDFS, RDF

Known Forks

  • WebID fork (note this link is only a reference to a specific revision of that fork; to ensure that you'll utilise the most recent one, go to summary and walk that path to the specgen directory again from the most recent revision ;) )

TODO

  • enable more OWL features, especially an automated construction of owl:Ontology (currently this must be done manually in the template)
  • enable more support for other namespaces (super classes and super properties from other namespaces already possible)
  • restructure the code !!!
  • write a cool parser for the "\n"'s and "\t"'s etc. in the parsed comments (e.g. "\n" to <br/> ...)

Known Issues

  1. librdf doesn't seem to like abbreviations in FILTER clauses.
    • this worked:
      q= 'SELECT ?x ?l ?c ?type WHERE { ?x rdfs:label ?l . ?x rdfs:comment ?c . ?x a ?type .  FILTER (?type = <http://www.w3.org/2002/07/owl#ObjectProperty\>)  } '
    • while this failed:
      q= 'PREFIX owl:  SELECT ?x ?l ?c ?type WHERE { ?x rdfs:label ?l . ?x rdfs:comment ?c . ?x a ?type .  FILTER (?type = owl:ObjectProperty)  } '
      (even when passing in bindings)
    • This forces us to be verbose, ie.
      q= 'SELECT distinct ?x ?l ?c WHERE { ?x rdfs:label ?l . ?x rdfs:comment ?c . ?x a ?type . FILTER (?type = <http://www.w3.org/2002/07/owl#ObjectProperty> || ?type = <http://www.w3.org/2002/07/owl#DatatypeProperty> || ?type = <http://www.w3.org/1999/02/22-rdf-syntax-ns#Property> || ?type = <http://www.w3.org/2002/07/owl#FunctionalProperty> || ?type = <http://www.w3.org/2002/07/owl#InverseFunctionalProperty>) } '
  2. TODO: work out how to do ".encode('UTF-8')" everywhere
  3. Be more explicit and careful re defaulting to English, and more robust when multilingual labels are found.

PS

The old project repository location at SourceForge is now deprecated. All new developments will be pushed to this repository location here at GitHub.

specgen's People

Contributors

alexanderwillner avatar kitha avatar monkeypants avatar zazi 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

specgen's Issues

where to get igraph from?

Traceback (most recent call last):
File "./specgen6.py", line 51, in
from libgroups import Grouping
File "/cygdrive/c/prog/specgen/libgroups.py", line 25, in
from igraph import *
ImportError: No module named igraph

That is not mentioned as a dependency in the README

External namespaces handling

enable more support for other namespaces (super classes and super properties from other namespaces already possible)

CURIEs in FILTER clauses

librdf doesn't seem to like CURIEs in FILTER clauses.
this worked:

q= 'SELECT ?x ?l ?c ?type WHERE { ?x rdfs:label ?l . ?x rdfs:comment ?c . ?x a ?type . FILTER (?type = http://www.w3.org/2002/07/owl#ObjectProperty) } '

while this failed:

q= 'PREFIX owl: http://www.w3.org/2002/07/owl# SELECT ?x ?l ?c ?type WHERE { ?x rdfs:label ?l . ?x rdfs:comment ?c . ?x a ?type . FILTER (?type = owl:ObjectProperty) } '

(even when passing in bindings)

This forces us to be verbose, ie.
q= 'SELECT distinct ?x ?l ?c WHERE { ?x rdfs:label ?l . ?x rdfs:comment ?c . ?x a ?type . FILTER (?type = http://www.w3.org/2002/07/owl#ObjectProperty || ?type = http://www.w3.org/2002/07/owl#DatatypeProperty || ?type = http://www.w3.org/1999/02/22-rdf-syntax-ns#Property || ?type = http://www.w3.org/2002/07/owl#FunctionalProperty || ?type = http://www.w3.org/2002/07/owl#InverseFunctionalProperty) } '

OWL feature extraction

enable more OWL features, especially an automated construction of owl:Ontology (currently this must be done manually in the template)

Indentation error in specgen6.py

File "./specgen6.py", line 174
usage()
^
TabError: inconsistent use of tabs and spaces in indentation

There's a tab at line 173, and incorrect indentation on lines 174 and 175

Expected string or buffer at "./specgen6.py", line 240

Printing to /tmp/_tmp_spec.html
Traceback (most recent call last):
File "./specgen6.py", line 240, in
main()
File "./specgen6.py", line 236, in main
makeSpec(indir,uri,shortName,outdir,outfile,"template.html",templatedir,indexrdfdir, ontofile)
File "./specgen6.py", line 68, in makeSpec
result = out.generate()
File "/opt/specgen6/libvocab.py", line 535, in generate
termlist = self.termlist()
File "/opt/specgen6/libvocab.py", line 706, in termlist
subclassnice = self.vocab.niceName(subclass)
File "/opt/specgen6/libvocab.py", line 470, in niceName
rez = regexp.search(uri)
TypeError: expected string or buffer

Upgrade code to latest pdflib

Description: Running specgen results in "AttributeError: 'IOMemory' object has no attribute 'batch_unification'"
Version: ae0a298

Steps that will reproduce the problem?

  1. Run ./specgen6.py --indir=onto/olo/ --ns=http://purl.org/ontology/olo/core# --prefix=olo --ontofile=orderedlistontology.owl --outdir=spec/olo/ --templatedir=onto/olo/ --outfile=orderedlistontology.html

What is the expected result?
HTML of the ontology.

What happens instead?
AttributeError: 'IOMemory' object has no attribute 'batch_unification'

Possible workaround:
pip install rdflib==3.4.0

Any additional information:
Current rdflib is not backward compatible

Label languages

Be more explicit and careful re defaulting to English, and more robust when
multilingual labels are found.

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.