Git Product home page Git Product logo

lene's Introduction

META-Aqua-Lene Build Status

A frame extraction tool for META-Aqua

META-Aqua is a reasoner about the reasoning tool Aqua and performs Meta reasoning to explain errors or anomalies in artificial cognition. META-Aqua performs its task in a Top-Down fashion and includes a large knowledge base stored as frames with slots.

This Python tool is designed to extract those frames from the Lisp KB and present them as a Python object that can then be used to convert the frame representation into another, suitable for other applications. For example this tool can convert the frames into an RDF-format.

Installation

You can install lene by using the setup.py script included with this package:

python setup.py install

This will also include all the requirements as found in the requirements.txt file in this package. I have also included a Makefile for ease of use also, and you can install the package with:

make install
make clean

For development you may want to create a virtual environment and install the requirements without installing the lene package. If you already have virtualenv installed, then simply create an environment and then install the required packages:

virtualenv venv
pip install -r requirements.txt

It is highly recommended that you also use virtualenvwrapper, which provides extremely flexible environment management. Please do not commit any environment files or packages.

Usage

To interpret a Lisp file with lene, you can use the load or loads functions to parse a .lisp file into a Python object- a list based Tree.

import lene
data = lene.load(open('rep_fire.lisp'))

Alternatively, if you are reading from a socket you can parse the tree with the loads function, which parses a string in memory.

data = lene.loads("(define-frame BLOCK (isa (value (toy))))")

Note also that a socket is a File-like object, so you can pass it into the load method if you know how much to read off the socket.

This structure can then be read for linkages to convert to an RDF document.

ontology = lene.make_graph(data, title="Mcl Ontology", description="My first ontology")
print ontology.serialize()

You can also write out the ontology to disk if you wish, using write:

ontology.write('path/to/ontology.owl')

Lene uses rdflib under the hood to construct the ontology, you can get direct access to the rdflib.Graph object with a call, somewhat redundantly named: OWLGraph(tree).graph - helper methods do make this a bit easier on you. This is important, because you can then perform SPARQL queries on the underlying RDF using the rdflib plugin library.

Testing

This package is unit tested with nosetests. In the root of the package you can simply run nosetests -v and the test discovery runner will automatically locate the tests and execute them. Please also ensure that the directory you're in can import the lene package.

Alternatively, you can run all the tests with coverage using:

make test

Which will also report how much of the package is being tested.

This package is also tested with Travis-CI, meaning that on every commit, the test suite is run in a virtual environment in Travis. If the tests fail, then they are reported back to us via email. Please ensure that you have run make test and successfully passed those tests before commiting to the Master branch.

TODO

  • Base libraries
  • Test framework
  • RDF extractor
  • Query explanation

About

The Norwegian dance-pop group Aqua is best known for their 1997 breakout single, Barbie Girl. Although META-Aqua is not named for this group, they do share a homonym. Their lead singer is Lene Nystrøm and it is after her that this package is named. (e.g. META-Aqua → Aqua → Lene)

lene's People

Contributors

bbengfort avatar

Watchers

 avatar  avatar

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.