Arachne 1.0
Arachne - the perpetual stitcher of Wikidata entities.
Loading...
Searching...
No Matches
corespace Namespace Reference

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...

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...

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).

Typedef Documentation

◆ parameter

using corespace::parameter = std::pair<std::string, std::string>

Single query parameter: key=value (pre-encoding is handled by libcurl).

Definition at line 60 of file utils.hpp.

◆ parameter_list

using corespace::parameter_list = std::vector<parameter>

Ordered list of query parameters appended to the URL.

Definition at line 62 of file utils.hpp.

Enumeration Type Documentation

◆ entity_kind

enum class corespace::entity_kind
strong

Wikidata entity kind.

Names include the canonical identifier prefixes for clarity:

  • item (IDs such as "Q123"), property ("P45"), lexeme ("L7"), mediainfo ("M9"), entity_schema ("E2"), form ("L7-F1"), sense ("L7-S2"). any acts as an API selector; unknown denotes an invalid or unrecognized identifier.
Enumerator
item 

IDs prefixed with 'Q'.

property 

IDs prefixed with 'P'.

lexeme 

IDs prefixed with 'L'.

mediainfo 

IDs prefixed with 'M'.

entity_schema 

IDs prefixed with 'E'.

form 

Lexeme form IDs such as "L<lexeme>-F<form>".

sense 

Lexeme sense IDs such as "L<lexeme>-S<sense>".

any 

API selector (e.g., flush(any)); not directly batchable.

unknown 

Unrecognized/invalid identifier.

Definition at line 46 of file utils.hpp.

46 {
47 item,
48 property,
49 lexeme,
50 mediainfo,
52 form,
53 sense,
54 any,
55 unknown
56};
@ any
API selector (e.g., flush(any)); not directly batchable.
Definition utils.hpp:54
@ property
IDs prefixed with 'P'.
Definition utils.hpp:48
@ lexeme
IDs prefixed with 'L'.
Definition utils.hpp:49
@ form
Lexeme form IDs such as "L<lexeme>-F<form>".
Definition utils.hpp:52
@ item
IDs prefixed with 'Q'.
Definition utils.hpp:47
@ mediainfo
IDs prefixed with 'M'.
Definition utils.hpp:50
@ entity_schema
IDs prefixed with 'E'.
Definition utils.hpp:51
@ unknown
Unrecognized/invalid identifier.
Definition utils.hpp:55
@ sense
Lexeme sense IDs such as "L<lexeme>-S<sense>".
Definition utils.hpp:53

◆ interface

enum class corespace::interface
strong
Enumerator
command_line 
interactive 

Definition at line 36 of file utils.hpp.

Function Documentation

◆ random_hex()

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.

33 {
34 static constexpr char digits[] = "0123456789abcdef";
35 static thread_local std::uniform_int_distribution<int> nibble(0, 15);
36
37 std::string out;
38 out.resize(n);
39 auto& g = rng();
40 for (std::size_t i = 0; i < n; ++i) {
41 out[i] = digits[nibble(g)];
42 }
43 return out;
44}
std::mt19937_64 & rng()
Shared PRNG seeded on first use.
Definition rng.cpp:28

References rng().

Referenced by arachnespace::arachne::new_group().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rng()

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.

28 {
29 static std::mt19937_64 gen { std::random_device {}() };
30 return gen;
31}

Referenced by random_hex().

Here is the caller graph for this function: