Skip to content

Instantly share code, notes, and snippets.

View johardi's full-sized avatar

Josef Hardi johardi

View GitHub Profile

Loading OWL Axioms Into Neo4j

Date: January 15, 2021

Make sure you have the OWL2LPG-Translator library installed in your local system.

$ pwd
owl2lpg-translator
$ ls
LICENSE				neo4j-plugin-text-analyzer/	owl2lpg-translation-cli/	owl2lpg-translation-exporter/
README.md			owl2lpg-client-api/		owl2lpg-translation-core/	pom.xml
@johardi
johardi / plain-named-individual-frame.cpy
Last active May 20, 2020 14:41
A Cypher query to get the named individual frame from an OWL-LPG
CALL {
MATCH (project)-[:BRANCH]->(branch)-[:ONTOLOGY_DOCUMENT]->(document)-[:AXIOM]->(axiom:AssertionAxiom)
MATCH (entity:NamedIndividual { iri: $subjectIri })-[:IS_SUBJECT_OF]->(axiom)
WHERE project.projectId = $projectId
AND branch.branchId = $branchId
AND document.ontologyDocumentId = $ontoDocId
RETURN entity
UNION
MATCH (project)-[:BRANCH]->(branch)-[:ONTOLOGY_DOCUMENT]->(document)-[:AXIOM]->(annotation)
MATCH (entity)-[:ENTITY_IRI]->(:IRI { iri: $subjectIri })-[:IS_SUBJECT_OF]->(annotation)
@johardi
johardi / plain-annotation-property-frame.cpy
Last active May 20, 2020 14:41
A Cypher query to get the annotation property frame from an OWL-LPG
CALL {
MATCH (project)-[:BRANCH]->(branch)-[:ONTOLOGY_DOCUMENT]->(document)-[:AXIOM]->(axiom:AnnotationAxiom)
MATCH (entity:AnnotationProperty { iri: $subjectIri })-[:IS_SUBJECT_OF]->(axiom)
WHERE project.projectId = $projectId
AND branch.branchId = $branchId
AND document.ontologyDocumentId = $ontoDocId
RETURN entity
UNION
MATCH (project)-[:BRANCH]->(branch)-[:ONTOLOGY_DOCUMENT]->(document)-[:AXIOM]->(annotation:AnnotationAssertion)
MATCH (entity)-[:ENTITY_IRI]->(:IRI { iri: $subjectIri })-[:IS_SUBJECT_OF]->(annotation)
@johardi
johardi / plain-data-property-frame.cpy
Last active May 20, 2020 14:40
A Cypher query to get the data property frame from an OWL-LPG
CALL {
MATCH (project)-[:BRANCH]->(branch)-[:ONTOLOGY_DOCUMENT]->(document)-[:AXIOM]->(axiom:DataPropertyAxiom)
MATCH (entity:DataProperty { iri: $subjectIri })-[:IS_SUBJECT_OF]->(axiom)
WHERE project.projectId = $projectId
AND branch.branchId = $branchId
AND document.ontologyDocumentId = $ontoDocId
RETURN entity
UNION
MATCH (project)-[:BRANCH]->(branch)-[:ONTOLOGY_DOCUMENT]->(document)-[:AXIOM]->(annotation:AnnotationAssertion)
MATCH (entity)-[:ENTITY_IRI]->(:IRI { iri: $subjectIri })-[:IS_SUBJECT_OF]->(annotation)
@johardi
johardi / plain-object-property-frame.cpy
Last active May 20, 2020 14:40
A Cypher query to get the object property frame from an OWL-LPG
CALL {
MATCH (project)-[:BRANCH]->(branch)-[:ONTOLOGY_DOCUMENT]->(document)-[:AXIOM]->(axiom:ObjectPropertyAxiom)
MATCH (entity:ObjectProperty { iri: $subjectIri })-[:IS_SUBJECT_OF]->(axiom)
WHERE project.projectId = $projectId
AND branch.branchId = $branchId
AND document.ontologyDocumentId = $ontoDocId
RETURN entity
UNION
MATCH (project)-[:BRANCH]->(branch)-[:ONTOLOGY_DOCUMENT]->(document)-[:AXIOM]->(annotation:AnnotationAssertion)
MATCH (entity)-[:ENTITY_IRI]->(:IRI { iri: $subjectIri })-[:IS_SUBJECT_OF]->(annotation)
@johardi
johardi / plain-class-frame.cyp
Last active May 20, 2020 14:38
A Cypher query to get the class frame from an OWL-LPG
// Get Class Frame
CALL {
MATCH (project)-[:BRANCH]->(branch)-[:ONTOLOGY_DOCUMENT]->(document)-[:AXIOM]->(axiom:ClassAxiom)
MATCH (entity:Class { iri: $subjectIri })-[:IS_SUBJECT_OF]->(axiom)
WHERE project.projectId = $projectId
AND branch.branchId = $branchId
AND document.ontologyDocumentId = $ontoDocId
RETURN entity
UNION
MATCH (project)-[:BRANCH]->(branch)-[:ONTOLOGY_DOCUMENT]->(document)-[:AXIOM]->(annotation:AnnotationAssertion)
@johardi
johardi / README.md
Last active May 19, 2020 17:12
Running the ClassFrame Query

Running the Frame Query

STEP 1

In a Terminal:

Run the SSH Tunneling command:

ssh -L 7474:localhost:7474 -L 7687:localhost:7687 <username>@13.79.232.10
@johardi
johardi / README.md
Last active May 8, 2020 16:23
Import CIDO ontology to Neo4j Workflow

Import CIDO ontology to Neo4j Workflow

STEP 0

Download the CIDO ontology from the BioPortal: https://bioportal.bioontology.org/ontologies/CIDO

STEP 1

In a terminal, after unpacking the owl2lpg-translation-cli package:

./run.sh translate -f csv /path/to/ontology/cido.owl > cido.csv
@johardi
johardi / load.py
Created December 19, 2016 06:55
Create dictionary from CSV
import os
import csv
import numpy as np
data = {}
with open(os.path.expanduser('~/Downloads/people_wiki.csv')) as csvfile:
reader = csv.DictReader(csvfile)
for row in reader:
for column, value in row.items():
data.setdefault(column, []).append(value)
@johardi
johardi / gist:f0ad139da1a323ebaf45b59e83effb17
Created October 10, 2016 19:18
Cellfie 2.1.0 Release Note
# Cellfie 2.1.0 Release Note
## Summary
This release contains new features, UI improvements and fixes various bugs and this is the official release package.
## New Features
* Implemented user mouse movement tracking for an interactive cell range selection
* Implemented check box selection for selecting transformation rules to use when generating the axioms (#55)
* Implemented the new MappingMaster feature `mm:EntityIRI` to extract the IRI from an existing entity (#70)