Electepedia Database Queries

Example queries for the political accountability database

1. Find all false statements by a specific politician

select Statement {
    content,
    date_made,
    verification_status,
    confidence_score,
    person: {
        name
    },
    fact_checks: {
        ruling,
        fact_checker,
        explanation
    }
}
filter .person.name ilike '%politician_name%' 
and .verification_status = 'false'
order by .date_made desc;

2. Get voting record for a person on specific topics

select Vote {
    bill_title,
    vote_value,
    vote_date,
    bill_description,
    person: {
        name,
        political_party
    }
}
filter .person.name ilike '%politician_name%'
and (.bill_title ilike '%healthcare%' or .bill_description ilike '%healthcare%')
order by .vote_date desc;

3. Find contradictions between statements and votes

select Person {
    name,
    statements: {
        content,
        date_made,
        topic
    } filter .topic = 'healthcare' and .content ilike '%support%',
    votes: {
        bill_title,
        vote_value,
        vote_date
    } filter .bill_title ilike '%healthcare%' and .vote_value = 'no'
}
filter exists(.statements) and exists(.votes);

4. Analyze debate performance - find fallacies by speaker

select Person {
    name,
    debates: {
        title,
        date,
        segments: {
            content,
            fallacies: {
                fallacy_type,
                confidence_score
            }
        } filter exists(.fallacies)
    }
}
filter .name ilike '%speaker_name%';

5. Funding source analysis

select Person {
    name,
    political_party,
    funding_sources: {
        source_name,
        amount,
        funding_type,
        date_received
    } filter .amount > 10000
} 
filter .current_office != ''
order by (sum(.funding_sources.amount)) desc;

6. Semantic search for similar statements (using AI embeddings)

with target_statement := (
    select Statement 
    filter .content ilike '%climate change%' 
    limit 1
)
select Statement {
    content,
    person: { name },
    date_made
}
filter .embedding <-> target_statement.embedding < 0.3
order by .embedding <-> target_statement.embedding;

7. Get fact-check summary for a politician

select Person {
    name,
    total_statements,
    verified_statements,
    false_statements,
    accuracy_rate := .verified_statements / .total_statements,
    recent_false_statements := (
        select .statements {
            content,
            date_made,
            fact_checks: {
                ruling,
                fact_checker
            }
        }
        filter .verification_status = 'false'
        and .date_made > datetime_current() - <duration>'1 year'
        order by .date_made desc
        limit 5
    )
}
filter .name ilike '%politician_name%';

8. Topic trend analysis

select Topic {
    name,
    statement_count := count(.statements),
    recent_activity := count(
        .statements filter .date_made > datetime_current() - <duration>'30 days'
    ),
    top_speakers := (
        select .statements.person {
            name,
            statement_count := count(.statements filter .topic = Topic.name)
        }
        order by .statement_count desc
        limit 3
    )
}
order by .statement_count desc;

9. Find controversial topics (high dispute rate)

select Topic {
    name,
    total_statements := count(.statements),
    disputed_statements := count(.statements filter .verification_status = 'disputed'),
    controversy_rate := .disputed_statements / .total_statements
}
filter .total_statements > 10
order by .controversy_rate desc;

10. Real-time debate analysis query

select DebateSegment {
    content,
    speaker: { name },
    start_time_seconds,
    sentiment_score,
    fallacies: {
        fallacy_type,
        confidence_score
    },
    claims: {
        claim_text,
        is_factual,
        verification_status,
        fact_checks: {
            verdict,
            explanation
        }
    }
}
filter .debate.title = 'Current Debate Title'
order by .start_time_seconds;