Giter Club home page Giter Club logo

magiopensource's Introduction

MAGIOpenSource

Dependancies:

apt install perl  # If not already installed. 
pip3 install networkx
pip3 install antlr4-python3-runtime==4.7.2

To run test perl script on test text files and create a graphml:

cd nars2networkx
perl test.pl t1 test1.txt

Look for "myTestGraph.graphml" in the folder.

For easy visualization tool, we recommend using Cytoscape. For installation and documentation see here. https://cytoscape.org/

Known issues on Mac

  1. Folder permission denied.
chmod -R 777 MAGIOpenSource/
  1. Anltr4 not being recognized.
virtualenv -p python3 <path>
source activate <path>/bin/activate
pip3 install install antlr4-python3-runtime==4.7.2
vi /MAGIOpenSource/nars2networks/nars2networks.py

In Vim edit the first line from /usr/bin/python3 to <path>/bin/python3

Neo4j to Nars

  1. Neo4j instance should be running on localhost:7687
  2. Install the py2neo package
pip install py2neo
  1. Run the main.py file
python3 main.py
  1. NARS string will be printed

magiopensource's People

Contributors

adamlawr-cisco avatar hmlatapie avatar ozkankilic avatar patham9 avatar sametdumankaya avatar

Watchers

James Cloos avatar Mina avatar  avatar  avatar  avatar

Forkers

gwliu213 patham9

magiopensource's Issues

network2nars unable to translate back to original Narsese

network2nars.py on myTestGraph.ml with content

<?xml version='1.0' encoding='utf-8'?>
<graphml xmlns="http://graphml.graphdrawing.org/xmlns" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd">
  <key attr.name="relation" attr.type="string" for="edge" id="d2" />
  <key attr.name="src" attr.type="string" for="edge" id="d1" />
  <key attr.name="src" attr.type="string" for="node" id="d0" />
  <graph edgedefault="undirected">
    <node id="cat">
      <data key="d0">nars</data>
    </node>
    <node id="animal">
      <data key="d0">nars</data>
    </node>
    <edge source="cat" target="animal">
      <data key="d1">nars</data>
      <data key="d2">--&gt;</data>
    </edge>
  </graph>
</graphml>

leads to output:

<cat-->nars>.
<animal-->nars>.
<cat-->product>?
<cat-->shelf>?
<animal-->product>?
<animal-->shelf>?

Some are for some product-related question generation which won't matter for now.

But the crucial output <cat --> animal>. is not included although this single line is what the graphML file was generated from!

Instead the following output which was not mentioned in the Narsese file is generated:

<cat-->nars>.
<animal-->nars>.

Narsese inheritance converted to undirected graph

test.txt content:

<cat --> animal>.

The execution of command

perl test.pl t1 test.txt leads to myTestGraph.graphml with the content:

<?xml version='1.0' encoding='utf-8'?>
<graphml xmlns="http://graphml.graphdrawing.org/xmlns" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd">
  <key attr.name="relation" attr.type="string" for="edge" id="d2" />
  <key attr.name="src" attr.type="string" for="edge" id="d1" />
  <key attr.name="src" attr.type="string" for="node" id="d0" />
  <graph edgedefault="undirected">
    <node id="cat">
      <data key="d0">nars</data>
    </node>
    <node id="animal">
      <data key="d0">nars</data>
    </node>
    <edge source="cat" target="animal">
      <data key="d1">nars</data>
      <data key="d2">--&gt;</data>
    </edge>
  </graph>
</graphml>

While source and target of the edge is set correctly, <graph edgedefault="undirected"> leads Gephi and potential other viewers to display the graph edges as undirected. Either every edge needs the attribute directed="true" which would override the default, or edgedefault should be set to "directed". I have a related PR for this I didn't yet have time to finish, but will do so soon.

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.