SLIPO Toolkit Operations

Client for executing SLIPO Toolkit component operations

class slipo.operation.EnumDataFormat[source]

Supported data formats for transform operations

class slipo.operation.EnumInputType[source]

Supported input types for SLIPO Toolkit components operations

class slipo.operation.OperationClient(base_url, api_key)[source]

OperationClient provides methods for executing SLIPO Toolkit components operations.

Details about the API responses are available at the SLIPO site.

Parameters
  • base_url (str) – Base URL for SLIPO API endpoints. The default value is https://app.dev.slipo.eu/.

  • api_key (str) – SLIPO API key. An application key can be generated using the SLIPO Workbench application.

Returns

A OperationClient object.

profiles() → dict[source]

Browse all SLIPO Toolkit components profiles.

Returns

A dict representing the parsed JSON response.

Raises

SlipoException – If a network or server error has occurred.

transform_csv(path: str, **kwargs) → dict[source]

Transforms a CSV file to a RDF dataset.

Parameters
  • path (str) – The relative path to a file on the remote user file system.

  • **kwargs

    Keyword arguments to control the transform operation. Options are:

    • attrCategory (str, optional): Field name containing literals regarding classification into categories (e.g., type of points, road classes etc.) for each feature.

    • attrGeometry (str, optional): Parameter that specifies the name of the geometry column in the input dataset.

    • attrKey (str, optional): Field name containing unique identifier for each entity (e.g., each record in the shapefile).

    • attrName (str, optional): Field name containing name literals (i.e., strings).

    • attrX (str, optional): Specify attribute holding X-coordinates of point locations. If inputFormat is not CSV, the parameter is ignored.

    • attrY (str, optional): Specify attribute holding Y-coordinates of point locations. If inputFormat is not CSV, the parameter is ignored.

    • classificationSpec (str, optional): The relative path to a YML/CSV file describing a classification scheme.

    • defaultLang (str, optional): Default lang for the labels created in the output RDF (default: en).

    • delimiter (str, optional): Specify the character delimiting attribute values.

    • encoding (str, optional): The encoding (character set) for strings in the input data (default: UTF-8)

    • featureSource (str, optional): Specifies the data source provider of the input features.

    • mappingSpec (str, optional): The relative path to a YML file containing mappings from input schema to RDF according to a custom ontology.

    • profile (str, optional): The name of the profile to use. Profile names can be retrieved using profiles() method. If profile is not set, the mappingSpec parameter must be set.

    • quote (str, optional): Specify quote character for string values.

    • sourceCRS (str, optional): Specify the EPSG code for the source CRS (default: EPSG:4326).

    • targetCRS (str, optional): Specify the EPSG code for the target CRS (default: EPSG:4326).

Returns

A dict representing the parsed JSON response.

Raises

SlipoException – If a network or server error has occurred.

transform_shapefile(path: str, **kwargs) → dict[source]

Transforms a SHAPEFILE file to a RDF dataset.

Parameters
  • path (str) – The relative path for a file on the remote user file system.

  • **kwargs

    Keyword arguments to control the transform operation. Options are:

    • attrCategory (str, optional): Field name containing literals regarding classification into categories (e.g., type of points, road classes etc.) for each feature.

    • attrGeometry (str, optional): Parameter that specifies the name of the geometry column in the input dataset.

    • attrKey (str, optional): Field name containing unique identifier for each entity (e.g., each record in the shapefile).

    • attrName (str, optional): Field name containing name literals (i.e., strings).

    • classificationSpec (str, optional): The relative path to a YML/CSV file describing a classification scheme.

    • defaultLang (str, optional): Default lang for the labels created in the output RDF (default: en).

    • encoding (str, optional): The encoding (character set) for strings in the input data (default: UTF-8)

    • featureSource (str, optional): Specifies the data source provider of the input features.

    • mappingSpec (str, optional): The relative path to a YML file containing mappings from input schema to RDF according to a custom ontology.

    • profile (str, optional): The name of the profile to use. Profile names can be retrieved using profiles() method. If profile is not set, the mappingSpec parameter must be set.

    • sourceCRS (str, optional): Specify the EPSG code for the source CRS (default: EPSG:4326).

    • targetCRS (str, optional): Specify the EPSG code for the target CRS (default: EPSG:4326).

Returns

A dict representing the parsed JSON response.

Raises

SlipoException – If a network or server error has occurred.

Generates links for two RDF datasets.

Arguments left, right and links may be either:

  • A str that represents a relative path to the remote user file system

  • A tuple of two integer values that represents the id and revision of a catalog resource.

  • A tuple of three integer values that represents the process id, process revision and output file id for a specific workflow or SLIPO API operation execution.

Parameters
  • profile (str) – The name of the profile to use. Profile names can be retrieved using profiles() method.

  • left (Union[str, Tuple[int, int], Tuple[int, int, int]]) – The left RDF dataset.

  • right (Union[str, Tuple[int, int], Tuple[int, int, int]]) – The right RDF dataset.

Returns

A dict representing the parsed JSON response.

Raises

SlipoException – If a network or server error has occurred.

fuse(profile: str, left: Union[str, Tuple[int, int], Tuple[int, int, int]], right: Union[str, Tuple[int, int], Tuple[int, int, int]], links: Union[str, Tuple[int, int], Tuple[int, int, int]]) → dict[source]

Fuses two RDF datasets using Linked Data and returns a new RDF dataset.

Parameters
  • profile (str) – The name of the profile to use. Profile names can be retrieved using profiles() method.

  • left (Union[str, Tuple[int, int], Tuple[int, int, int]]) – The left RDF dataset.

  • right (Union[str, Tuple[int, int], Tuple[int, int, int]]) – The right RDF dataset.

  • links (Union[str, Tuple[int, int], Tuple[int, int, int]]) – The links for the left and right datasets.

Returns

A dict representing the parsed JSON response.

Raises

SlipoException – If a network or server error has occurred.

enrich(profile: str, source: Union[str, Tuple[int, int], Tuple[int, int, int]]) → dict[source]

Enriches a RDF dataset.

Parameters
  • profile (str) – The name of the profile to use. Profile names can be retrieved using profiles() method.

  • source (Union[str, Tuple[int, int], Tuple[int, int, int]]) – The RDF dataset to enrich.

Returns

A dict representing the parsed JSON response.

Raises

SlipoException – If a network or server error has occurred.

export_csv(profile: str, source: Union[str, Tuple[int, int], Tuple[int, int, int]], **kwargs) → dict[source]

Exports a RDF dataset to a CSV file.

Parameters
  • profile (str) – The name of the profile to use. Profile names can be retrieved using profiles() method.

  • source (Union[str, Tuple[int, int], Tuple[int, int, int]]) – The RDF dataset to export.

  • **kwargs

    Keyword arguments to control the transform operation. Options are:

    • defaultLang (str, optional): The default language for labels created in output RDF. The default is “en”.

    • delimiter (str, optional):A field delimiter for records (default: ;).

    • encoding (str, optional): The encoding (character set) for strings in the input data (default: UTF-8)

    • quote (str, optional): Specify quote character for string values (default ).

    • sourceCRS (str, optional): Specify the EPSG code for the source CRS (default: EPSG:4326).

    • sparqlFile (str, optional): The relative path to a file containing a user-specified SELECT query (in SPARQL) that will retrieve results from the input RDF triples. This query should conform with the underlying ontology of the input RDF triples.

    • targetCRS (str, optional): Specify the EPSG code for the target CRS (default: EPSG:4326).

Returns

A dict representing the parsed JSON response.

Raises

SlipoException – If a network or server error has occurred.

export_shapefile(profile: str, source: Union[str, Tuple[int, int], Tuple[int, int, int]], **kwargs) → dict[source]

Exports a RDF dataset to a SHAPEFILE file.

Parameters
  • profile (str) – The name of the profile to use. Profile names can be retrieved using profiles() method.

  • source (Union[str, Tuple[int, int], Tuple[int, int, int]]) – The RDF dataset to export.

  • **kwargs

    Keyword arguments to control the transform operation. Options are:

    • defaultLang (str, optional): The default language for labels created in output RDF. The default is “en”.

    • delimiter (str, optional):A field delimiter for records (default: ;).

    • encoding (str, optional): The encoding (character set) for strings in the input data (default: UTF-8)

    • quote (str, optional): Specify quote character for string values (default ).

    • sourceCRS (str, optional): Specify the EPSG code for the source CRS (default: EPSG:4326).

    • sparqlFile (str, optional): The relative path to a file containing a user-specified SELECT query (in SPARQL) that will retrieve results from the input RDF triples. This query should conform with the underlying ontology of the input RDF triples.

    • targetCRS (str, optional): Specify the EPSG code for the target CRS (default: EPSG:4326).

Returns

A dict representing the parsed JSON response.

Raises

SlipoException – If a network or server error has occurred.