Mo7art's picture
Upload StackOverflow KG language dataset: python
c2a324e verified
|
Raw
History Blame Contribute Delete
3.69 kB
---
tags:
- knowledge-graph
- rdf
- n-triples
- sparql
- semantic-web
- stackoverflow
- question-answering
pretty_name: StackOverflow Knowledge Graph - Python
license: cc-by-sa-4.0
size_categories:
- 100M<n<1B
---
# Python StackOverflow Knowledge Graph Datasheet
## 1. What This Dataset Is
This dataset is the Python-specific RDF shard of the Stack2Graph StackOverflow Knowledge Graph.
Each Hugging Face dataset repository contains exactly one language dataset.
It is optimized for graph-based retrieval and SPARQL analytics (not row-wise tabular training input).
It is used in the Stack2Graph paper for evaluating retrieval-based question answering and knowledge graph research on programming topics.
See the Stack2Graph repository for more details:
[https://github.com/tha-atlas/Stack2Graph](https://github.com/tha-atlas/Stack2Graph)
## 2. Repository Layout
```text
schema.nt
python/
part0.nt
part1.nt
...
```
- `schema.nt`: shared ontology and schema triples.
- `python/part*.nt`: language-scoped instance triples serialized as N-Triples.
## 3. Data Model And Coverage
The graph links Stack Overflow entities and relations, including:
- questions
- answers
- comments
- tags
- vote aggregates
- question-to-question links
Coverage scope:
- records are retained when they match the Stack2Graph supported language-tag set
- this repository contains only the Python shard
## 4. Recommended Preprocessing
1. Load `schema.nt` and all triples from `python/` into an RDF-capable store.
2. Map language triples to named graph `http://stackoverflow.com/python`.
3. Keep schema triples available for graph-aware query planning.
4. Preserve attribution and license metadata during downstream export.
Example language-scoped query:
```sparql
SELECT ?s ?p ?o
WHERE {
GRAPH <http://stackoverflow.com/python> {
?s ?p ?o
}
}
LIMIT 100
```
## 5. Automatic Download And KG Setup
You do not need to rebuild triples from XML to use this dataset.
In the Stack2Graph repository, you can use the automation script
`experiment/load_hf_datasets_into_services.py` to download dataset artifacts
and prepare the knowledge graph service state automatically.
Typical workflow:
1. Clone and configure Stack2Graph (`.env` with HF token and service paths).
1. Start required local services:
```bash
docker compose up -d
```
1. Run the loader script:
```bash
python -m experiment.load_hf_datasets_into_services
```
For manual usage without automation, you can directly load `schema.nt` and all
triples from `python/` into your RDF store.
## 6. Quality Notes And Caveats
- A Stack Overflow question may belong to multiple language shards when tagged with multiple languages.
- Vote information is represented as aggregates, not raw individual vote events.
- As with community-generated data, content may include noise, bias, and temporal drift.
## 7. Intended Use
- retrieval and question-answering systems
- RAG and hybrid retriever experiments
- knowledge graph benchmarking and diagnostics
- language-scoped developer tooling research
## 8. Limitations
- Not a complete mirror of all Stack Overflow content.
- Not all moderation context or full revision history is represented.
- Best used with graph infrastructure that supports named graphs and SPARQL.
## 9. Licensing And Attribution
This dataset inherits Stack Overflow source licensing and attribution requirements.
Ensure compliant attribution and redistribution practices in all derived artifacts.
## 10. Suggested Citation
If you use this dataset, cite the Stack2Graph work:
- Stack2Graph: A Structured Knowledge Representation of Stack Overflow Data for Retrieval-based Question Answering