Technical Deep-Dive | Forensic AI Lab

Wikidata API-Integratie

Forensisch AI Versterkt met Gestructureerde Kennis uit de Vrije Kennisbank

Wikidata - de vrije kennisbank van Wikimedia met >100 miljoen items - versterkt ons AI-lab met betrouwbare, machine-readable data voor forensische analyses.

1. Waarom Wikidata API Integreren?

Juridisch & Forensisch Perspectief

Wikidata is geen gewone database; het is een kennisgraaf met triples (entiteit - property - waarde), ideaal voor AI-verrijking. Link EncroChat-exports aan juridische entiteiten, of verrijk log-analyses met cybersecurity-concepten zoals CVEs of threat actors.

βš–οΈ

Strafzaken

Query voor juridische termen (bijv. art. 359a Sv), link digitaal bewijs aan entiteiten zoals EncroChat of black-box software om inconsistenties te detecteren.

🏒

Corporate Investigations

Verrijk NIS2-rapporten met gestructureerde data over datalekken, CVEs, threat actors of privacy-wetten (EVRM art. 8).

πŸ€–

AI-Verrijking

Gebruik Wikidata in pre-processing om timelines te verrijken, IPs te linken aan locaties, of anomalies te valideren tegen bekende vulnerabilities.

βœ…

Compliance

Gratis, open-source, real-time updates, en compliant met GDPR/NIS2 dankzij transparante bronnen met referenties.

"Wikidata is de Starlink van kennis - verbind je AI ermee, en je lab schiet naar hyperspace."

2. Setup: Authenticatie & Security

Bot Accounts, OAuth en Best Practices

Wikidata API is toegankelijk via https://www.wikidata.org/w/api.php (MediaWiki Action API) en SPARQL endpoint (https://query.wikidata.org/sparql). Voor lezen: anoniem OK. Voor schrijven: authenticatie verplicht.

πŸ€– Bot Account

Registreer via Special:BotPasswords voor elevated rate limits (tot 5000 edits/uur). Documenteer als "CyberSecurityAD Bot" met contact voor compliance.

πŸ”‘ OAuth1 (Aanbevolen)

Veilig, token-based. Gebruik consumer tokens van de Wikimedia OAuthConsumerRegistration voor productie-apps.

⚑ Rate Limits

50-500 requests/minuut (afhankelijk van auth); bots hoger. Monitor met X-Rate-Remaining headers.

πŸ“¦ Libraries

Gebruik requests voor basis; WikidataIntegrator (pip install) voor high-level abstraction met duplicate handling en batching.

Security Best Practices

πŸ”
TLS 1.3 Only

Alle API-communicatie via versleutelde verbindingen.

#️⃣
SHA-512 Hashing

Client-side hashing van queries/responses voor integriteit en chain-of-custody.

πŸ”‘
OAuth Authentication

Token-based authenticatie om data-lekken te voorkomen en rate limits te maximaliseren.

πŸ“
Audit Logging

Log elke API-call met timestamp en hash voor forensische rapporten.

3. Querying: SPARQL & API

Data Ophalen voor Forensische Analyse

Gebruik SPARQL voor complexe graph-based queries; MediaWiki API (wbgetentities) voor entity-specifieke lookups.

SPARQL Query: Juridische/Cybersecurity Entiteiten

import requests

url = 'https://query.wikidata.org/sparql'
query = '''
SELECT ?entity ?entityLabel ?description WHERE {
  ?entity wdt:P31/wdt:P279* wd:Q43229 .  # Instance of/subclass of legal entity
  ?entity wdt:P361 wd:Q8465 .            # Part of computer security
  SERVICE wikibase:label { bd:serviceParam wikibase:language "nl,en" . }
  OPTIONAL { ?entity schema:description ?description. FILTER(LANG(?description) = "nl") }
}
LIMIT 20
'''
params = {'format': 'json', 'query': query}
headers = {'User-Agent': 'CyberSecurityAD-ForensicBot/1.0 (+https://www.cybersecurityad.com/)'}
response = requests.get(url, params=params, headers=headers)
data = response.json()

# Parse results voor AI-pipeline
for item in data['results']['bindings']:
    print(f"Entity: {item['entity']['value']}, Label: {item['entityLabel']['value']}")

πŸ’‘ Integratie-Idee

In je pre-processing: Query voor "vormverzuim" (Q-form) om haakjes met art. 359a Sv te linken; output als JSON naar AI-model voor inconsistency-detectie.

MediaWiki API: Entity Ophalen (EncroChat)

import requests

url = 'https://www.wikidata.org/w/api.php'
params = {
    'action': 'wbgetentities',
    'ids': 'Q96372699',  # EncroChat item
    'props': 'labels|descriptions|claims',
    'languages': 'nl|en',
    'format': 'json'
}
response = requests.get(url, params=params)
data = response.json()

# Extract claims over privacy-inbreuk
claims = data['entities']['Q96372699']['claims']

4. Editing: Items Creeren & Updaten

WikidataIntegrator voor Batch Operations

Creeer/update Wikidata-items voor je organisatie of forensische datasets. Voeg statements toe zoals "instance of: cybersecurity company" met referenties voor provenance.

Login & Item Creeren

from wikidataintegrator import wdi_login, wdi_core

# Login (gebruik environment variables!)
login = wdi_login.WDLogin(user='CyberSecurityADBot', pwd=os.environ['BOT_PASSWORD'])

# Statements voor nieuw item
instance_of = wdi_core.WDItemID(value='Q783794', prop_nr='P31')  # Company
website = wdi_core.WDUrl(value='https://www.cybersecurityad.com/', prop_nr='P856')
hq = wdi_core.WDItemID(value='Q727', prop_nr='P159')  # Amsterdam

data = [instance_of, website, hq]

item = wdi_core.WDItemEngine(data=data, append_value=['P31'])
item.set_label('Cybersecurity AD', lang='nl')
item.set_description('Dutch forensic AI lab for criminal and corporate investigations', lang='en')
item.write(login, bot_account=True)

new_qid = item.wd_item_id  # Output: Q-identifier

Batch Operations: CVE Threat Intel

# Batch-update CVEs met Wikidata-links
fast_filter = {'P351': ''}  # Unieke ID filter voor duplicates

raw_data = [
    {'cve': 'CVE-2025-1234', 'desc': 'Critical vulnerability'},
    {'cve': 'CVE-2025-5678', 'desc': 'Remote code execution'},
    # ...
]

for entry in raw_data:
    cve_stmt = wdi_core.WDString(value=entry['cve'], prop_nr='P3342')
    data = [cve_stmt]
    item = wdi_core.WDItemEngine(data=data, fast_run=True, fast_run_base_filter=fast_filter)
    item.write(login)

5. Integratie in de AI-Pipeline

Schaalbaar Forensisch Systeem
1

Intake

Query Wikidata voor scope-verrijking (bijv. juridische haakjes zoals EVRM art. 6).

2

Analyse

Gebruik SPARQL-results als features in AI-modellen voor timeline-extractie en entity linking.

3

Rapport

Embed Wikidata-references in outputs voor traceability (art. 359a Sv-proof).

4

Automatisering

Microservice-architectuur met Kubernetes-containers voor isolatie en schaalbaarheid.

πŸ—οΈ Architectuur

  • Microservice: Flask-app die API-calls wrapped
  • Containerization: Kubernetes voor isolatie en schaalbaarheid
  • Caching: Redis voor frequent-accessed entities
  • Monitoring: Prometheus metrics voor API-health

πŸ“š Legal Tech Case Study

Uit recente AI-ontwikkelingen: een Berlijnse legal AI-startup gebruikt Wikidata voor query-verrijking in legal assistants. Pas toe op ons lab door forensische datasets te linken aan Wikidata voor "truth sourcing" in black-box analyses.

6. Best Practices & Compliance

Nerdy Tips voor Productie
⚠️

Error Handling

Check response['success']; implementeer exponential backoff voor rate-limits.

πŸ”§

Custom Properties

Creeer nieuwe properties (bijv. "forensic AI method") via community-proposal op Wikidata.

πŸ“œ

Licensing

Wikidata is CC0 (public domain), maar voeg attributions toe in forensische rapporten voor transparantie.

πŸ›‘οΈ

GDPR/NIS2

Zorg voor opt-in in opdrachtbevestigingen; documenteer data-flows voor compliance audits.

Juridische Compliance

  • Documenteer alle Wikidata-queries in audit logs met timestamps
  • Voeg SHA-512 hashes toe aan responses voor chain-of-custody
  • Gebruik environment variables voor alle credentials
  • Implementeer data retention policies voor cached entities

Klaar om Wikidata te Integreren?

Dit is je uitgebreide blueprint - klaar om te lanceren. Laten we een pilot draaien: integreer Wikidata in een demo-zaak.

πŸ•ΈοΈ Volgende Stap: Lokale Wikibase

Wil je volledige controle over je forensische data? Bouw een private Wikibase instance - on-premises, GDPR-compliant, met eigen ontology voor strafzaken en NIS2-onderzoeken.

Bekijk Wikibase Lokaal β†’

πŸš€ Roadmap: Lanceringsplan 2026-2027

Bekijk onze gedetailleerde 18-maanden roadmap met fases, milestones, funding-targets en metrics. Van BV-oprichting tot EU-expansie.

Bekijk de Roadmap β†’