load_from_rdf¶
-
ampligraph.datasets.
load_from_rdf
(folder_name, file_name, format='nt', data_home=None)¶ Load an RDF file
Loads an RDF knowledge graph using rdflib APIs. Multiple RDF serialization formats are supported (nt, ttl, rdf/xml, etc). The entire graph will be loaded in memory, and converted into an rdflib Graph object.Warning
Large RDF graphs should be serialized to ntriples beforehand and loaded with
load_from_ntriples()
instead.Note
It is recommended to use
ampligraph.evaluation.train_test_split_no_unseen()
to split custom knowledge graphs into train, validation, and test sets. Using this function will lead to validation, test sets that do not include triples with entities that do not occur in the training set.Parameters: - folder_name (str) – base folder where the file is stored.
- file_name (str) – file name
- format (str) – The RDF serialization format (nt, ttl, rdf/xml - see rdflib documentation)
Returns: triples – the actual triples of the file.
Return type: ndarray , shape [n, 3]