algebraixlib.import_export.rdf module¶
Import and export facilities for RDF data.
-
algebraixlib.import_export.rdf.import_graph()[source]¶ Return an absolute clan that represents the RDF graph
graph_file_or_filepath.- The graph is represented by a regular, absolute clan.
- The left components are ‘s’ (subject), ‘p’ (predicate) and ‘o’ (object) (see triple).
- Blank nodes are converted to IRIs (skolemization).
- URI references are represented as
rdflib.URIRefinstances (embedded in anAtom). - Literals are converted to intuitive native Python types (embedded in an
Atom).
Parameters: - graph_file_or_filepath – A string that is a path (relative or absolute) to the file to
be imported, or a file object (like
StringIO). - rdf_format – The format of the RDF graph that is being imported. See Pluginparsers for a list of supported formats and their corresponding strings. If none is given, the file name’s extension is used to guess a format. If that fails, Turtle is used as default.
Returns: An absolute clan that represents the RDF graph that has been imported.
-
algebraixlib.import_export.rdf.export_table()[source]¶ Return a serialized table as string in a supported RDF format for table serialization.
Limitations: - Leading ‘?’ and ‘$’ are not stripped from lefts (variable names). - Non-printable characters are backslash-escaped. -
tablemust be an absolute graph.Parameters: - file_or_path – Either a file path (in this case the data is written to a file at this
location) or a file object (in this case the data is written to its
.write()function). - lefts – The set of the left components in
tablethat is exported. - table – An absolute clan that contains the data to be exported.
- out_format – A supported RDF table format. Supported are
'csv'(SPARQL 1.1 Query Results CSV and TSV Formats) and'json'(SPARQL 1.1 Query Results JSON Format).
- file_or_path – Either a file path (in this case the data is written to a file at this
location) or a file object (in this case the data is written to its