Can NetworkX library read RDF data in Ntriple format and build a Graph object along with attributes or node features. I tried the below code to convert the RDF data(.nt file) in to Graph using the rdflib,
from rdflib.extras.external_graph_libs import *
from rdflib import Graph, URIRef, Literal
import networkx as nx
graph = Graph()
graph.parse(“Airports-with-lables.nt”, format=“nt”)
nx_graph = rdflib_to_networkx_multidigraph(graph)
nx.write_graphml(nx_graph,“example_airport.graphml”)
However the generated grahml file doesn’t have attributes, because of which I am not able to proceed with StellarGraph Hinsage algorithm(https://github.com/stellargraph/stellargraph/tree/develop/demos/node-classification/hinsage) which expects the node features as one of the parameter.
Can anyone help on this please.
MultiDiGraph
, predicates are used as edge keys (to identify multi-edges). – Kizzykjersti