File size: 4,980 Bytes
bd362e9
 
 
 
 
 
 
 
e7c237e
263a30a
bd362e9
112677d
c11190b
bd362e9
 
 
112677d
bd362e9
 
263a30a
bd362e9
263a30a
bd362e9
 
 
 
 
 
 
 
 
 
 
 
 
112677d
bd362e9
 
 
 
112677d
bd362e9
263a30a
 
112677d
263a30a
112677d
 
 
263a30a
112677d
 
 
 
 
 
 
 
 
 
 
 
 
e7c237e
112677d
 
e7c237e
112677d
 
e7c237e
112677d
e7c237e
263a30a
 
 
e7c237e
263a30a
e7c237e
 
263a30a
e7c237e
 
 
 
 
263a30a
 
e7c237e
 
263a30a
 
e7c237e
 
 
263a30a
e7c237e
 
 
 
 
 
 
 
 
263a30a
 
e7c237e
112677d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125

---
license: mit
language:
- en
tags:
- OntoLearner
- ontology-learning
- social-sciences
pretty_name: Social Sciences
---

<div align="center">
  <img  src="https://raw.githubusercontent.com/sciknoworg/OntoLearner/main/images/logo.png"  alt="OntoLearner"
    style="display: block; margin: 0 auto; width: 500px; height: auto;">
  <h1 style="text-align: center; margin-top: 1em;">Social Sciences Domain Ontologies</h1>
  <a href="https://github.com/sciknoworg/OntoLearner"><img src="https://img.shields.io/badge/GitHub-OntoLearner-blue?logo=github" /></a>
</div>


## Overview
The social sciences domain encompasses ontologies that systematically represent and model the complex structures, behaviors, identities, and interactions inherent in human societies. This domain is pivotal for advancing knowledge representation by providing a structured framework to analyze and interpret social phenomena, facilitating interdisciplinary research and enabling the integration of diverse data sources. Through precise semantic modeling, it enhances our understanding of social dynamics and supports the development of applications that address societal challenges.

## Ontologies
| Ontology ID | Full Name | Classes | Properties | Last Updated |
|-------------|-----------|---------|------------|--------------|
| AS2 | Activity Streams 2.0 Ontology (AS2) | 107 | 69 | 23 May 2017|
| BIO | BIO: A vocabulary for biographical information (BIO) | 44 | 30 | 2010-05-10|
| Contact | Contact Ontology (Contact) | 44 | 64 | 2018-07-06|
| FOAF | Friend of a Friend (FOAF) | 15 | 60 | 14 January 2014|
| SIOC | Semantically-Interlinked Online Communities (SIOC) | 14 | 91 | 2018/02/28|

## Dataset Files
Each ontology directory contains the following files:
1. `<ontology_id>.<format>` - The original ontology file
2. `term_typings.json` - A Dataset of term-to-type mappings
3. `taxonomies.json` - Dataset of taxonomic relations
4. `non_taxonomic_relations.json` - Dataset of non-taxonomic relations
5. `<ontology_id>.rst` - Documentation describing the ontology


## Usage
These datasets are intended for ontology learning research and applications. Here's how to use them with OntoLearner:

First of all, install the `OntoLearner` library via PiP:

```bash
pip install ontolearner
```

**How to load an ontology or LLM4OL Paradigm tasks datasets?**
``` python
from ontolearner import AS2

ontology = AS2()

# Load an ontology.
ontology.load()  

# Load (or extract) LLMs4OL Paradigm tasks datasets
data = ontology.extract()
```


**How use the loaded dataset for LLM4OL Paradigm task settings?**
``` python
# Import core modules from the OntoLearner library
from ontolearner import AS2, LearnerPipeline, train_test_split

# Load the AS2 ontology, which contains concepts related to wines, their properties, and categories
ontology = AS2()
ontology.load()  # Load entities, types, and structured term annotations from the ontology
data = ontology.extract()

# Split into train and test sets
train_data, test_data = train_test_split(data, test_size=0.2, random_state=42)

# Initialize a multi-component learning pipeline (retriever + LLM)
# This configuration enables a Retrieval-Augmented Generation (RAG) setup
pipeline = LearnerPipeline(
    retriever_id='sentence-transformers/all-MiniLM-L6-v2',      # Dense retriever model for nearest neighbor search
    llm_id='Qwen/Qwen2.5-0.5B-Instruct',                        # Lightweight instruction-tuned LLM for reasoning
    hf_token='...',                                             # Hugging Face token for accessing gated models
    batch_size=32,                                              # Batch size for training/prediction if supported
    top_k=5                                                     # Number of top retrievals to include in RAG prompting
)

# Run the pipeline: training, prediction, and evaluation in one call
outputs = pipeline(
    train_data=train_data,
    test_data=test_data,
    evaluate=True,              # Compute metrics like precision, recall, and F1
    task='term-typing'          # Specifies the task
                                # Other options: "taxonomy-discovery" or "non-taxonomy-discovery"
)

# Print final evaluation metrics
print("Metrics:", outputs['metrics'])

# Print the total time taken for the full pipeline execution
print("Elapsed time:", outputs['elapsed_time'])

# Print all outputs (including predictions)
print(outputs)
```


For more detailed documentation, see the [![Documentation](https://img.shields.io/badge/Documentation-ontolearner.readthedocs.io-blue)](https://ontolearner.readthedocs.io)


## Citation

If you find our work helpful, feel free to give us a cite.


```bibtex
@inproceedings{babaei2023llms4ol,
  title={LLMs4OL: Large language models for ontology learning},
  author={Babaei Giglou, Hamed and D’Souza, Jennifer and Auer, S{\"o}ren},
  booktitle={International Semantic Web Conference},
  pages={408--427},
  year={2023},
  organization={Springer}
}
```