Skip to content

Commit

Permalink
Type fix for generate enrichment graph (#44)
Browse files Browse the repository at this point in the history
* Updated pandasaurus version to 0.3.7

* Refactored generate_enrichment_graph method
  • Loading branch information
Ismail Ugur Bayindir authored Nov 3, 2023
1 parent e7865f2 commit 02591f4
Show file tree
Hide file tree
Showing 4 changed files with 250 additions and 196 deletions.
4 changes: 3 additions & 1 deletion pandasaurus/graph/graph_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import networkx as nx
import pandas as pd
from rdflib import RDF, RDFS, Graph, Literal, Namespace, URIRef
from rdflib import OWL, RDF, RDFS, Graph, Literal, Namespace, URIRef
from rdflib.plugins.sparql import prepareQuery

from pandasaurus.graph.graph_generator_utils import (
Expand Down Expand Up @@ -37,7 +37,9 @@ def generate_enrichment_graph(enriched_df: pd.DataFrame) -> Graph:
s = cl_namespace[row["s"].split(":")[-1]]
o = cl_namespace[row["o"].split(":")[-1]]
graph.add((s, RDFS.label, Literal(row["s_label"])))
graph.add((s, RDF.type, OWL.Class))
graph.add((o, RDFS.label, Literal(row["o_label"])))
graph.add((o, RDF.type, OWL.Class))
graph.add((s, RDFS.subClassOf, o))
return graph

Expand Down
Loading

0 comments on commit 02591f4

Please sign in to comment.