CogniPy for Pandas¶
In-memory Graph Database and Knowledge Graph with Natural Language Interface
Whats in the box
Reasoning, exploration of RDF/OWL, [FluentEditor](https://www.cognitum.eu/Semantics/FluentEditor/) CNL files, with OWL/RL Reasoner (Jena) as well as SPARQL Graph queries (Jena) and visualization
Write your graph/ontology in Controlled Natural Language or import it from RDF/OWL
Add reasoning rules/T-Box in Controlled Natural Language
Import data using Pandas/scrap them from the internet
Draw the resulting, materialized graph
Use SPARQL to execute graph query
Use output Dataframe for further processing with Pandas
Installation¶
Prerequisites:
If you are on Mac or Linux You MUST have mono installed on your system.
Tested with Anaconda
Tested on MacOS, Winows and Linux (UBuntu)
Install cognipy on your system using
$ pip install cognipy
Open Source repository¶
Hello world program¶
In Jupyter you write
from cognipy.ontology import Ontology #the ontology processing class
%%writefile hello.encnl
World says Hello.
Hello is a word.
onto = Ontology("cnl/file","hello.encnl")
print(onto.select_instances_of("a thing that says a word")[["says","Instance"]])
Output (Pandas DataFrame):
says |
Instance |
|
---|---|---|
0 |
Hello |
World |
How to cite CogniPy¶
We would be grateful if scientific publications resulting from projects that make use of CogniPy would include the following sentence in the acknowledgments section: “This work was conducted using the CogniPy package, which is an open-source project maintained by [Cognitum Services S.A.](https://www.cognitum.eu)”
- Examples
- Grammar
- Dictonary
- A / an
- And
- And-or
- Anything
- As-well-as
- Be (is/are)
- Be not (is not /are not)
- By
- Less-than/more-than/at-least/at-most/differet-than/zero/one/two…
- Greater-than/lower-than/greater-or-equal-to/lower-or-equal-to/different-from
- Do-not/does-not
- Either … or …
- Equal-to
- Be (is/are)
- Every-single-thing
- … for … execute <? … ?>
- Exists
- If-and-only-if
- If-and-only-if-it
- If-and-only-if-it-either
- If … then …
- Is-(not-)the-same-as
- Is-unique-if
- It
- Itself
- Can/can-not/must/must-not/should/should-not
- No
- None
- Nothing
- Nothing-but
- Or-something-else
- Something
- (some boolean/datetime/integer/string value)
- That
- that-has-length
- That-matches-pattern
- The
- The-one-and-the-only
- Thing/things
- API Refrence