Closed dinani65 closed 3 years ago
It seems that results["results"]
does not contain what is expected. Could you print it out?
from pyrdf2vec.graphs import KG import pandas as pd import rdflib as rdflib from pyrdf2vec import RDF2VecTransformer from pyrdf2vec.walkers import RandomWalker
wiki_data = pd.read_csv('ds.csv') entities = yago_data['actor'] label_predicates = ['http://schema.org/actor',]
kg = KG("https://yago-knowledge.org/sparql", is_remote=True, label_predicates=[rdflib.URIRef(x) for x in label_predicates])
transformer = RDF2VecTransformer(walkers=[RandomWalker(2, 5)]) walk_embeddings = transformer.fit(kg, entities, verbose=True).transform(entities)
TypeError Traceback (most recent call last)
From "https://yago-knowledge.org/sparql":
YAGO can be queried by a SPARQL API. The SPARQL endpoint URI is https://yago-knowledge.org/sparql/query. There is a 1 minute timeout to ensure a responsive SPARQL endpoint for everyone. You can also fire a SPARQL query directly in the field below. If you plan to launch several queries, please download YAGO instead.
When I use the downloaded file, the kernel wants to be restarted ("The kernel appears to have died. It will restart automatically "). I think it stems from the size of file.
Could you explain how to use it when we want to access some sparql endpoints such as Yago ("https://yago-knowledge.org/sparql")? It faces this error: ~/.local/lib/python3.8/site-packages/pyrdf2vec/graphs/kg.py in _get_shops(self, vertex) 113 results = self.endpoint.query().convert() 114 neighbors = [] --> 115 for result in results["results"]["bindings"]: 116 predicate, obj = result["p"]["value"], result["o"]["value"] 117 if predicate not in self.label_predicates:
TypeError: byte indices must be integers or slices, not str
Furthermore, access to endpoints is so slow and when using the files of datasets also needs high memory, so how to handle this problem? Is there any way to access a graph database? if so, how?