AnacletoLAB / grape

🍇 GRAPE is a Rust/Python Graph Representation Learning library for Predictions and Evaluations

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Need documentation on how to use a knowledge graph in grape

gsanou opened this issue · comments

Hello, I have another question on how to import my data in grape. I think it is more a clarification on my method to import my KG.

kg = Graph.from_csv(directed=True,
                       edge_path="sample_mabkg.tsv",
                       sources_column_number= 0,
                       edge_list_edge_types_column_number=1,edge_list_separator="|",
                       destinations_column_number=2, name="mAbKG", verbose=True, edge_list_header=True)

but i saw that it exists node_path and other properties like in edge_path, so i don't know if i did in the good way my read from_csv. Can you please give me some explanation knowning i have a KG (with edge and node typed). Below is an example of my data.

Thank you for your answer

Gaoussou

 node source|edge|node destination
_:B4dff5e7d17225b25b13ad12737e49779|imgt:isDecidedBy|imgt:EC
pubmed:2843774|dc:title|Selective killing of HIV-infected cells by recombinant human CD4-Pseudomonas exotoxin hybrid protein.
imgt:Product_8e9250cf-276a-3282-954f-3791316ac5a6|rdf:type|obo:NCIT_C51980
imgt:Segment_212_1|obo:BFO_0000050|imgt:Construct_212
imgt:IgG4-kappa_1001|rdfs:label|IgG4-kappa_1001
imgt:V-D-GENE|owl:sameAs|obo:SO_0000510
imgt:Segment_536_1|rdf:type|imgt:Segment
imgt:LRR13|rdf:type|imgt:RepeatLabel
imgt:StudyProduct_c2bc9b3a-a15e-376f-bda5-f87089b3f54b|imgt:application_type|Therapeutic
imgt:StudyProduct_54a14ca8-f916-338b-af18-d079beb598a4|imgt:development_technology|  Dyax human antibody phage display library 

sample_mabkg.txt

Hi! Here you have a decently complete tutorial on file loading. Anyhow, your parametrization seems okay. Is there any error?

Currently, You are loading a graph with the edge_types, I seem to understand that you also have node types, in order to load them you need to create a node's file like so:

node_name|node_type
pubmed:2843774|paper

and load it by specifying the parameter node_path and its settings.

Otherwise, you can create a node_types file which is just a list of the types of each node and can be loaded using the node_type_list_path parameter.

paper
paper
gene
book

Do you have a single type or multiple types for each node?

Thank you for your different answers,
@zommiommy i have multiple type of each node (all the rdf:type) so i think i need to create a file with the node_name and its type based on the rdf:type as you mention it.

Thank you in advance
Gaoussou

Hi @gsanou, generally, we have two files for the KG use case: a node list and an edge list. Additionally, in some cases, you may want to specify a node type list and an edge type list which contains the unique types. On kgobo, you can find tens of examples of KGs presented in this format.

Contact us on Telegram or Discord if you need a quick call to resolve this issue (links in the read me).

@LucaCappelletti94 thank you, the telegram link is missed in the readme can you please provide for future issues ;) .
Gaoussou

There is the button, right on the top.