odML to graphML converter.
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
No repository file or test is named. Start with the embedded Python example and inspect how odML conversion is exposed in this repository, including its ET.parse, Graph, and GraphMLParser entry points. Done means a supported odML-to-GraphML converter is integrated and usable for graph-database import.
Written by the indexing model from the issue text.
Description
graphML link is used in graphics community a lot. Here is a simple conversion code that can be used in odML. This would be helpful for importing odML to graph databases natively. Here is an example conversion that can be used as a basic starting point.
"""
odml2graphml
Basic odML to graphML converter
(c) 2017 German Neuroinformatics Node (G-Node)
"""
import xml.etree.ElementTree as ET
from pygraphml import Graph
from pygraphml import GraphMLParser
import uuid
# Files
base_name = 'rg_dummy'
odml_fname = base_name + '.odml'
graphml_fname = base_name + '.graphml'
# Read odml
tree = ET.parse(odml_fname)
root = tree.getroot()
odml_graph = Graph()
child_id = 0
is_terminal_node_prev = False
prev_uuid_value = 0
prev_node = 0
is_odml_rel_node = 0
prev_tag = 'odML
for elem in tree.iter(): # iter over elements
is_terminal_node = elem.getchildren() == []
is_odml_tag = elem.tag in ['section', 'odML', 'property']
if(is_odml_tag):
uuid_value = str(uuid.uuid4()) # generate UUID for an element
node = odml_graph.add_node(uuid_value)
node["odml_entity"] = elem.tag
node["uuid"] = uuid_value
child_id = 1
is_odml_rel_node = 0
if(elem.tag == "odML"):
odml_node = node
else:
node[elem.tag] = elem.text
node["labels"] = ":reach2Grasp"
is_terminal_node_prev = is_terminal_node
if(is_odml_rel_node < 1 and child_id > 0 and is_odml_tag == True and prev_tag in ['section', 'property']):
edge = odml_graph.add_edge(prev_node, node, directed=True)
edge = odml_graph.add_edge(odml_node, node, directed=True)
edge['relation'] = 'child'
if(elem.tag in ['section', 'odML']):
is_odml_rel_node = 1
prev_node = node
prev_uuid_value = uuid_value
prev_tag = elem.tag
parser = GraphMLParser()
parser.write(odml_graph, graphml_fname)
- Dominant language
- Python
- Stars
- 25
- Forks
- 30
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from G-Node/python-odml
-
RDF
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
G-Node/python-odml#172 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 58/100
G-Node/python-odml#420 ·
-
Sparse file output Open
Difficulty 4/5 3-5 days Newbie friendliness 35/100
G-Node/python-odml#418 ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
G-Node/python-odml#417 · 8 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
G-Node/python-odml#406 ·
All issues in G-Node/python-odml
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
syfoud/Simulated_Scepter#172 ·
-
A cancelled tests run makes the coverage comment workflow fail and reports it as a red check on main Openarea: ci bug perceived difficulty: 3
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Nitjsefnie-Harness-Commons/daedalus#921 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
EleutherAI/lm-evaluation-harness#4207 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 92/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
ClickHouse/clickhouse-connect#1057 ·