sage.cli package

Submodules

sage.cli.commons module

sage.cli.debug module

async sage.cli.debug.execute(engine, iterator, limit)

sage.cli.grpc_server module

sage.cli.grpc_server.stop_server(server, grace=None)

Stop server on a CTRL-C event

sage.cli.hbase module

sage.cli.http_server module

sage.cli.parsers module

class sage.cli.parsers.CustomNTriplesParser(bucket_size=100)

Bases: sage.cli.parsers.Parser, rdflib.plugins.parsers.ntriples.NTriplesParser

literal()
parse()

Parse f as an N-Triples file.

parseline()
class sage.cli.parsers.HDTParser(bucket_size)

Bases: sage.cli.parsers.CustomNTriplesParser

parsefile(file_path)

Parse an HDT file as an N-Triples file.

readline()

Convert triples read from an HDT file into N-Triples.

class sage.cli.parsers.NTParser(bucket_size=100)

Bases: sage.cli.parsers.CustomNTriplesParser

parsefile(file_path)

Parse an N-Triples file.

exception sage.cli.parsers.ParseError

Bases: Exception

Raised Raised when an error occurs while parsing an RDF file.

class sage.cli.parsers.Parser(bucket_size=100)

Bases: abc.ABC

on_bucket(bucket)

Called when a new bucket of triples is ready to be inserted into the database.

on_complete()

Called when the file has been fully parsed.

on_error(error)

Called when an error is raised by the parser.

abstract parsefile(file_path)

Parse a RDF file into bucket of triples.

class sage.cli.parsers.ParserFactory

Bases: object

create_parser(bucket_size: int = 100) → sage.cli.parsers.Parser

sage.cli.postgres module

sage.cli.postgres.connect_postgres(graph)

Try to connect to a PostgreSQL server

sage.cli.postgres.insert_bucket(cursor, bucket, graph_name, backend, block_size, cache)

sage.cli.postgres_utils module

sage.cli.postgres_utils.get_analyze_query(graph_name)

Format an ANALYZE query with the name of the inserted RDF graph.

sage.cli.postgres_utils.get_create_indexes_queries(graph_name, backend)

Format all PostgreSQL CREATE INDEX queries with the name of the RDF graph to insert.

sage.cli.postgres_utils.get_create_tables_queries(graph_name, backend)

Format a PostgreSQL CREATE TABLE query with the name of the RDF graph to insert.

sage.cli.postgres_utils.get_insert_into_catalog_query()

Get an INSERT INTO query compatible with “psycopg2.extras.execute_values” to support the bulk loading.

sage.cli.postgres_utils.get_insert_into_query(graph_name)

Get an INSERT INTO query compatible with “psycopg2.extras.execute_values” to support the bulk loading.

sage.cli.sqlite module

sage.cli.sqlite.connect_sqlite(graph)
sage.cli.sqlite.insert_bucket(cursor, bucket, graph_name, backend, block_size, cache)

sage.cli.sqlite_utils module

sage.cli.sqlite_utils.get_analyze_query(graph_name)

Format an ANALYZE query with the name of the inserted RDF graph.

sage.cli.sqlite_utils.get_create_indexes_queries(graph_name, backend)

Format all SQlite CREATE INDEXES statements with the name of the RDF graph to insert.

sage.cli.sqlite_utils.get_create_tables_queries(graph_name, backend)

Format a SQlite CREATE TABLE statement with the name of the RDF graph to insert.

sage.cli.sqlite_utils.get_insert_into_catalog_query()

Get an INSERT INTO statement compatible with the “executemany” function of SQlite to support the bulk loading.

sage.cli.sqlite_utils.get_insert_into_query(graph_name)

Get an INSERT INTO statement compatible with the “executemany” function of SQlite to support the bulk loading.

sage.cli.sqlite_utils.get_select_identifier_query()

Get a SELECT statement to retrieve the identifier of a RDF term.

sage.cli.utils module

sage.cli.utils.get_nb_triples(file_path: str, format: str) → int
sage.cli.utils.load_graph(config_path, graph_name, logger, backends=[])

Load a RDF graph from a Sage config file

sage.cli.utils.wccount(filename)

Module contents