Scholix
Models
Pydantic models for representing Scholix (Scholarly Link Exchange) data.
This module defines Pydantic models for parsing and validating data from the OpenAIRE Scholexplorer API, which follows the Scholix schema. It includes models for entities, relationships, identifiers, and the overall response structure. Reference: https://graph.openaire.eu/docs/apis/scholexplorer/v3/response_schema and DDI-CDI Codi Model: https://ddi-alliance.github.io/DDI-CDI/current/Model/
ScholixEntityTypeName = Literal['publication', 'dataset', 'software', 'other']
module-attribute
Defines the allowed types for a Scholix entity (e.g., publication, dataset).
ScholixCreator
Bases: BaseModel
Represents a creator (e.g., author, contributor) in the Scholix schema.
Attributes:
Name | Type | Description |
---|---|---|
name |
str | None
|
The name of the creator (aliased from "Name"). |
identifier |
list[ScholixIdentifier] | None
|
An optional list of |
Source code in src/aireloom/models/scholix.py
44 45 46 47 48 49 50 51 52 53 54 55 |
|
ScholixEntity
Bases: BaseModel
Represents a scholarly entity (source or target) in a Scholix relationship.
Attributes:
Name | Type | Description |
---|---|---|
identifier |
list[ScholixIdentifier]
|
A list of |
type |
ScholixEntityTypeName
|
The |
sub_type |
str | None
|
An optional subtype providing more specific classification. |
title |
str | None
|
The title of the scholarly entity. |
creator |
list[ScholixCreator] | None
|
A list of |
publication_date |
str | None
|
The publication date of the entity (string format). |
publisher |
list[ScholixPublisher] | None
|
A list of |
Source code in src/aireloom/models/scholix.py
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
|
ScholixIdentifier
Bases: BaseModel
Represents a persistent identifier within the Scholix schema.
Attributes:
Name | Type | Description |
---|---|---|
id_val |
str
|
The value of the identifier (aliased from "ID"). |
id_scheme |
str
|
The scheme of the identifier (aliased from "IDScheme", e.g., "doi", "url"). |
id_url |
HttpUrl | None
|
An optional resolvable URL for the identifier (aliased from "IDURL"). |
Source code in src/aireloom/models/scholix.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
|
ScholixLinkProvider
Bases: BaseModel
Represents the provider of the Scholix link.
Attributes:
Name | Type | Description |
---|---|---|
name |
str
|
The name of the link provider (aliased from "Name"). |
identifier |
list[ScholixIdentifier] | None
|
An optional list of |
Source code in src/aireloom/models/scholix.py
113 114 115 116 117 118 119 120 121 122 123 124 |
|
ScholixPublisher
Bases: BaseModel
Represents a publisher in the Scholix schema.
Attributes:
Name | Type | Description |
---|---|---|
name |
str
|
The name of the publisher (aliased from "Name"). |
identifier |
list[ScholixIdentifier] | None
|
An optional list of |
Source code in src/aireloom/models/scholix.py
58 59 60 61 62 63 64 65 66 67 68 69 |
|
ScholixRelationship
Bases: BaseModel
Represents a single Scholix relationship link between two scholarly entities.
This is a core model in the Scholix schema, detailing the link provider, the type of relationship, the source entity, and the target entity.
Attributes:
Name | Type | Description |
---|---|---|
link_provider |
list[ScholixLinkProvider] | None
|
A list of |
relationship_type |
ScholixRelationshipType
|
A |
source |
ScholixEntity
|
A |
target |
ScholixEntity
|
A |
link_publication_date |
datetime | None
|
The date when this link was published or made available. |
license_url |
HttpUrl | None
|
An optional URL pointing to the license governing the use of this link information. |
harvest_date |
str | None
|
The date when this link information was last harvested or updated. |
Source code in src/aireloom/models/scholix.py
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 |
|
ScholixRelationshipType
Bases: BaseModel
Describes the type of relationship between two Scholix entities.
Attributes:
Name | Type | Description |
---|---|---|
name |
ScholixRelationshipNameValue
|
The primary name of the relationship type (e.g., "References", "IsSupplementTo").
Uses |
sub_type |
str | None
|
An optional subtype for more specific relationship classification. |
sub_type_schema |
HttpUrl | None
|
An optional URL pointing to the schema defining the subtype. |
Source code in src/aireloom/models/scholix.py
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
|
ScholixResponse
Bases: BaseModel
Response structure for the Scholexplorer Links endpoint.
Source code in src/aireloom/models/scholix.py
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 |
|
Filters
Bases: BaseModel
Filter model for Scholix API endpoint.
Attributes:
Name | Type | Description |
---|---|---|
sourcePid |
str | None
|
Persistent identifier of the source entity. |
targetPid |
str | None
|
Persistent identifier of the target entity. |
sourcePublisher |
str | None
|
Publisher of the source entity. |
targetPublisher |
str | None
|
Publisher of the target entity. |
sourceType |
Literal['Publication', 'Dataset', 'Software', 'Other'] | None
|
Type of the source entity. |
targetType |
Literal['Publication', 'Dataset', 'Software', 'Other'] | None
|
Type of the target entity. |
relation |
str | None
|
Type of relation between the source and target entities. |
from_date |
date | None
|
Start date of the relation (API calls use "from"). |
to_date |
date | None
|
End date of the relation (API calls use "to"). |
Source code in src/aireloom/endpoints.py
222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 |
|
Client
Client for interacting with the OpenAIRE Scholix (Scholexplorer) API.
This module provides the ScholixClient
, which is specialized for querying
the OpenAIRE Scholexplorer API to find links (relationships) between
scholarly entities (e.g., publications, datasets). It uses a different
base URL and has custom methods for searching and iterating through Scholix links,
as the Scholix API has a distinct structure and pagination mechanism compared
to the main OpenAIRE Graph API.
ScholixClient
Bases: BaseResourceClient
Client for the OpenAIRE Scholexplorer API (Scholix links).
This client handles requests to the Scholix API, which provides data on
relationships between research artifacts (e.g., citations, supplements).
It uses a specific base URL (_scholix_base_url
) and custom methods
(search_links
, iterate_links
) tailored to the Scholix API's structure,
including its 0-indexed pagination and specific request parameters.
Attributes:
Name | Type | Description |
---|---|---|
_entity_path |
str
|
The API path for Scholix links (typically "Links"). |
_scholix_base_url |
str
|
The base URL for the Scholexplorer API. |
_endpoint_def |
dict
|
Configuration for this endpoint from |
Source code in src/aireloom/resources/scholix_client.py
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 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 |
|
__init__(api_client, scholix_base_url=None)
Initializes the ScholixClient.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
api_client
|
AireloomClient
|
An instance of |
required |
scholix_base_url
|
str | None
|
Optional base URL for the Scholexplorer API. If None,
the default from |
None
|
Source code in src/aireloom/resources/scholix_client.py
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
|
iterate_links(page_size=DEFAULT_PAGE_SIZE, filters=None)
async
Iterates through all Scholexplorer relationship links matching the filters.
Handles pagination automatically based on 'total_pages'.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
page_size
|
int
|
The number of results per page during iteration. |
DEFAULT_PAGE_SIZE
|
filters
|
ScholixFilters | None
|
An instance of ScholixFilters with filter criteria.
|
None
|
Yields:
Type | Description |
---|---|
AsyncIterator[ScholixRelationship]
|
ScholixRelationship objects matching the query. |
Raises:
Type | Description |
---|---|
ValueError
|
If neither sourcePid nor targetPid is provided in the filters. |
BibliofabricError
|
For API communication errors or unexpected issues. |
Source code in src/aireloom/resources/scholix_client.py
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 |
|
search_links(page=0, page_size=DEFAULT_PAGE_SIZE, filters=None)
async
Searches for Scholexplorer relationship links.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
page
|
int
|
The page number to retrieve (0-indexed). |
0
|
page_size
|
int
|
The number of results per page. |
DEFAULT_PAGE_SIZE
|
filters
|
ScholixFilters | None
|
An instance of ScholixFilters with filter criteria.
|
None
|
Returns:
Type | Description |
---|---|
ScholixResponse
|
A ScholixResponse object containing the results for the requested page. |
Raises:
Type | Description |
---|---|
ValueError
|
If neither sourcePid nor targetPid is provided in the filters model. |
BibliofabricError
|
For API communication errors or unexpected issues. |
Source code in src/aireloom/resources/scholix_client.py
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 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 |
|