|
Arachne 1.0
Arachne - the perpetual stitcher of Wikidata entities.
|
Namespaces | |
| namespace | anonymous_namespace{http_client.cpp} |
Classes | |
| class | http_client |
| Minimal, synchronous HTTP GET client built on libcurl. More... | |
| struct | options |
| Configuration for fetching entities via MediaWiki/Wikibase API. More... | |
| struct | network_metrics |
| Thread-safe counters describing client-side networking activity. More... | |
| struct | http_response |
| Result object for an HTTP transfer. More... | |
| struct | network_options |
| Fixed runtime options for the HTTP client. More... | |
| struct | sparql_request |
| struct | service_profile |
| Static configuration values describing a remote service. More... | |
| struct | wdqs_options |
| Options specific to WDQS usage and heuristics. More... | |
| struct | call_preview |
Typedefs | |
| using | parameter = std::pair<std::string, std::string> |
| Single query parameter: key=value (pre-encoding is handled by libcurl). | |
| using | parameter_list = std::vector<parameter> |
| Ordered list of query parameters appended to the URL. | |
Enumerations | |
| enum class | interface { command_line , interactive } |
| enum class | entity_kind { item , property , lexeme , mediainfo , entity_schema , form , sense , any , unknown } |
| Wikidata entity kind. More... | |
| enum | service_kind { wdqs } |
| Identifies supported SPARQL services. More... | |
| enum class | http_method { get , post } |
| HTTP method to use for a request. More... | |
| enum class | http_method_hint { automatic , force_get , force_post } |
| Hint for selecting the HTTP method for a request. More... | |
Functions | |
| std::mt19937_64 & | rng () |
| Shared PRNG seeded on first use. | |
| std::string | random_hex (std::size_t n) |
Return exactly n random hexadecimal characters (lowercase). | |
| const service_profile & | wdqs_profile () |
| http_method | choose_http_method (const sparql_request &request, std::size_t threshold) |
| Chooses the appropriate HTTP method for a SPARQL request. | |
| std::string | resolve_accept (const sparql_request &request, const service_profile &profile, std::string_view override_accept) |
| Resolves the Accept header value for a SPARQL request. | |
| std::pair< std::string, bool > | resolve_body_strategy (const sparql_request &request) |
| Determines the body content and strategy for a SPARQL request. | |
| const service_profile & | get_service_profile (service_kind kind) |
| Retrieve the service profile for a given service kind. | |
| void | sort_parameters (parameter_list ¶ms) |
| Sorts the parameter list in-place by key. | |
| void | append_common_params (service_kind kind, http_method method, parameter_list ¶ms) |
| Appends common parameters required for a service and HTTP method. | |
| using corespace::parameter = std::pair<std::string, std::string> |
| using corespace::parameter_list = std::vector<parameter> |
|
strong |
Wikidata entity kind.
Names include the canonical identifier prefixes for clarity:
Definition at line 47 of file utils.hpp.
|
strong |
|
strong |
Hint for selecting the HTTP method for a request.
Used to determine which HTTP method to use based on query length or explicit override.
This differs from http_method in that it provides a policy for method selection, rather than specifying the method directly.
| Enumerator | |
|---|---|
| automatic | |
| force_get | |
| force_post | |
Definition at line 215 of file utils.hpp.
|
strong |
Identifies supported SPARQL services.
Used to select which SPARQL endpoint to query. Currently only wdqs (Wikidata Query Service) is supported.
Values:
| Enumerator | |
|---|---|
| wdqs | |
Definition at line 74 of file utils.hpp.
| void corespace::append_common_params | ( | const service_kind | kind, |
| const http_method | method, | ||
| parameter_list & | params ) |
Appends common parameters required for a service and HTTP method.
| kind | The service kind. |
| method | The HTTP method. |
| params | The parameter list to append to. Modified in-place. |
Definition at line 105 of file utils.cpp.
| http_method corespace::choose_http_method | ( | const sparql_request & | request, |
| const std::size_t | threshold ) |
Chooses the appropriate HTTP method for a SPARQL request.
| request | The SPARQL request. |
| threshold | The length threshold above which POST is preferred. |
Definition at line 42 of file utils.cpp.
References automatic, force_get, force_post, get, corespace::sparql_request::method, post, and corespace::sparql_request::query.
Referenced by arachnespace::pheidippides::build_call_preview().

| const service_profile & corespace::get_service_profile | ( | const service_kind | kind | ) |
Retrieve the service profile for a given service kind.
| kind | The service kind to look up. |
Definition at line 87 of file utils.cpp.
References wdqs, and wdqs_profile().
Referenced by arachnespace::pheidippides::build_call_preview().


| std::string corespace::random_hex | ( | const std::size_t | n | ) |
Return exactly n random hexadecimal characters (lowercase).
The function draws 4-bit nibbles from the shared PRNG. Characters are not zero-padded beyond the requested length; each position is an independent, uniformly distributed hex digit.
Definition at line 33 of file rng.cpp.
References rng().
Referenced by arachnespace::arachne::new_group().


| std::string corespace::resolve_accept | ( | const sparql_request & | request, |
| const service_profile & | profile, | ||
| const std::string_view | override_accept ) |
Resolves the Accept header value for a SPARQL request.
| request | The SPARQL request. |
| profile | The service profile. |
| override_accept | Optional override for the Accept header. |
Definition at line 55 of file utils.cpp.
References corespace::sparql_request::accept, and corespace::service_profile::default_accept.
| std::pair< std::string, bool > corespace::resolve_body_strategy | ( | const sparql_request & | request | ) |
Determines the body content and strategy for a SPARQL request.
| request | The SPARQL request. |
Definition at line 69 of file utils.cpp.
References corespace::sparql_request::content_type, force_post, and corespace::sparql_request::method.
| std::mt19937_64 & corespace::rng | ( | ) |
Shared PRNG seeded on first use.
The generator is a process-wide std::mt19937_64 seeded from std::random_device. Calls from multiple threads share the same engine and therefore require external synchronization if deterministic ordering is important.
Definition at line 28 of file rng.cpp.
Referenced by random_hex().

| void corespace::sort_parameters | ( | parameter_list & | params | ) |
Sorts the parameter list in-place by key.
| params | The parameter list to sort. Modified in-place. |
Definition at line 96 of file utils.cpp.
| const service_profile & corespace::wdqs_profile | ( | ) |
Definition at line 32 of file utils.cpp.
Referenced by get_service_profile().
