s4api package¶
Subpackages¶
- s4api.models package
- Submodules
- s4api.models.attachment module
- s4api.models.command_info module
- s4api.models.config module
- s4api.models.content_disposition module
- s4api.models.create module
- s4api.models.data_flavor module
- s4api.models.data_handler module
- s4api.models.data_source module
- s4api.models.media_type module
- s4api.models.service_request module
- Module contents
Submodules¶
s4api.fact_forge_api module¶
-
class
s4api.fact_forge_api.
FactForgeApi
(apiClient)¶ Bases:
object
Self-Service Semantic Suite (S4) FactForge API
-
sparql_get
(**kwargs)¶ Execute a SPARQL query Execute a SPARQL 1.1 Select query on the FactForge dataset.
- Kwargs:
accept, str: Accept header (required) Available Accept headers
“application/sparql-results+json”, “application/sparql-results+xml”, “application/x-binary-rdf-results-table” (required)query, str: Syntactically valid SPARQL 1.1 Select Query (required)
accept_encoding, str: Accept-Encoding header (optional) Available Accept-Encoding headers - “gzip”
- Returns:
- String - Query results, structured as the specified Accept-header type
-
sparql_post
(**kwargs)¶ Execute a SPARQL query Execute a valid SPARQL 1.1 Select query on the FactForge dataset. This method should be used in cases where the length of the query exceeds practicable limits of proxies, servers, etc.
- Kwargs:
accept, str: Accept header (required) Available Accept headers -
“application/sparql-results+json”, “application/sparql-results+xml”, “application/x-binary-rdf-results-table”query, str: Syntactically valid SPARQL 1.1 Select Query (required)
content_type, str: (required)
query, str: (required)
accept_encoding, str: Accept-Encoding header (optional) Available Accept-Encoding headers - “gzip”
- Returns:
- String - Query results, structured as the specified Accept-header type
-
s4api.graphdb_api module¶
-
class
s4api.graphdb_api.
GraphDBApi
(apiClient)¶ Bases:
object
Self-Service Semantic Suite (S4) GraphDB Api
-
create_repository
(**kwargs)¶ Create new repository in database
- Kwargs:
body: Payload data to be sent with the request. (required)
Example template:
- {
- “repositoryID”: “Name of your repository”, “label”: “Description of your database”, “ruleset”: “owl-horst-optimized”
}
-
delete_repository
(**kwargs)¶ Delete repository and all of its data from database
- Kwargs:
- repo_name: String. Name of repository to be deleted
-
get_repo_config
(**kwargs)¶ Get information about repository cache percentage distribution
- Returns:
- Cache configuration percentage for all repositories in the database
-
sparql_select
(**kwargs)¶ Execute SPARQL Select query
- Kwargs:
- body: Dict. Payload data to be sent with the request (required) repo_name: String. Name of repository to upload data to
- Returns:
- XML structure with results of SPARQL Select query
-
sparql_update
(**kwargs)¶ Execute SPARQL Update query
- Kwargs:
- body: Dict. Payload data to be sent with the request (required) repo_name: String. Name of repository to upload data to
-
update_repo_config
(**kwargs)¶ Update repositories configuration percentage. Distribution sum must be equal to 100 (%)
- Kwargs:
body: Dict. Payload data to be sent with the request (required)
Example template:
- {
- “proportions”: [
- {“repositoryID”: “test-repo1”,
- “percentage”: 45},
- {“repositoryID”: test-repo2,
- “percentage”: 55}
]
}
-
upload_data_file
(file_path, **kwargs)¶ Upload data from an external rdf file
- Args:
- file_path: String. Full path to the triples-containing file
- Kwargs:
- repo_name: String. Name of repository to upload data to
-
s4api.swagger module¶
-
class
s4api.swagger.
ApiClient
(api_key=None, key_secret=None, endpoint=None)¶ Bases:
object
Generic API client for Swagger client library builds
-
callAPI
(resourcePath, method, queryParams, postData, headerParams=None)¶ Makes the appropriate request with specific parameters
-
deserialize
(obj, objClass)¶ Derialize a JSON string into an object.
- Args:
obj – string or object to be deserialized objClass – class literal for deserialzied object, or string
of class name- Returns:
- object – deserialized object
-
sanitizeForSerialization
(obj)¶ Dump an object into JSON for POSTing.
-
toPathValue
(obj)¶ Convert a string or object to a path-friendly value Args:
obj – object or string value- Returns:
- string – quoted value
-
s4api.textanalytics_api module¶
-
class
s4api.textanalytics_api.
TextanalyticsApi
(apiClient)¶ Bases:
object
Self-Service Semantic Suite (S4) Text-Annotation Api
-
process
(output_type, **kwargs)¶ Processes JSON notation
- Args:
output_type - String. The output format of the results
Example template: “json”
- Kwargs:
body - Dictionary. Data, passed with request body
Example template: {
“document”: “your text here”, “documentType”: “text/plain”}
- Returns:
- JSON structure with annotated text
-
process_multipart_request
(data, **kwargs)¶ Processes multipart data.
- Args:
data - Dictionary. Contains binary file data and metadata
Example template:
- {
- “meta”: (‘’, {“documentType”: “application/msword”}, “application/json”), “data”: (“name of MSWORD file”, binary-content, “application/octet-stream”)
}
Returns: XML structure with annotated text from file
-