Skip to content

Commit 30ca55c

Browse files
committed
Create all property pages for released types
- Create a notebook to navigate the Bioschemas release types in canonical form - Create individual property pages with the notebook - Modify properties page template to use URL for expected types as it comes from the canonical file
1 parent dd2e726 commit 30ca55c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+157
-97
lines changed

_includes/properties.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ <h3></h3>
1010
<h4>Expected values</h4>
1111
<ul>
1212
{% for v in page.expected_values_as_type %}
13-
{%- assign typeName = '/types/' | append: v %}
14-
<li><a href="{{ typeName | relative_url }}">{{ v }}</a></li>
13+
<li><a href="{{ v[1] }}">{{ v[0] }}</a></li>
1514
{% endfor %}
1615
{% for v in page.expected_values_as_data %}
1716
<li>

notebooks/BioschemasProperties.ipynb

Lines changed: 72 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,46 @@
11
{
22
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"id": "ed01a0cd-1fdc-4c34-a88f-0f190e0299ed",
6+
"metadata": {},
7+
"source": [
8+
"# Creation of Bioschemas property pages\n",
9+
"\n",
10+
"Based on the JSON-LD from DDE, corresponding to Bioschemas released types, we create a page for each Bioschemas property declared in that file. This script needs to be re-run and pages committed and merged whenever there is a change in the releases types. It uses the modified Bioschemas types file that already uses the canonical Bioschemas URL https://bioschemas.org/terms/"
11+
]
12+
},
13+
{
14+
"cell_type": "markdown",
15+
"id": "08b59295-7fad-4278-8c94-0d42819f60ba",
16+
"metadata": {},
17+
"source": [
18+
"## Installation of packages"
19+
]
20+
},
321
{
422
"cell_type": "code",
5-
"execution_count": null,
23+
"execution_count": 1,
624
"id": "239dffc4-6f7c-4b93-be8f-f2be4243b205",
725
"metadata": {},
8-
"outputs": [],
26+
"outputs": [
27+
{
28+
"name": "stdout",
29+
"output_type": "stream",
30+
"text": [
31+
"Requirement already satisfied: rdflib in c:\\software\\iniforge3\\lib\\site-packages (7.1.3)\n",
32+
"Requirement already satisfied: pyparsing<4,>=2.1.0 in c:\\software\\iniforge3\\lib\\site-packages (from rdflib) (3.2.1)\n"
33+
]
34+
}
35+
],
936
"source": [
1037
"import sys\n",
1138
"!{sys.executable} -m pip install rdflib"
1239
]
1340
},
1441
{
1542
"cell_type": "code",
16-
"execution_count": 7,
43+
"execution_count": 2,
1744
"id": "6bae07c0-76c4-4941-97c3-5cd99f67fb1b",
1845
"metadata": {},
1946
"outputs": [
@@ -32,7 +59,7 @@
3259
},
3360
{
3461
"cell_type": "code",
35-
"execution_count": 9,
62+
"execution_count": 3,
3663
"id": "5641415a-538d-4d19-9739-c8f47712cceb",
3764
"metadata": {},
3865
"outputs": [],
@@ -43,9 +70,17 @@
4370
"from rdflib.namespace import RDFS"
4471
]
4572
},
73+
{
74+
"cell_type": "markdown",
75+
"id": "22bf06fe-ba13-4546-a6ae-a3f2e25aace9",
76+
"metadata": {},
77+
"source": [
78+
"## Load the Bioschemas released types JSON-LD as RDF"
79+
]
80+
},
4681
{
4782
"cell_type": "code",
48-
"execution_count": 21,
83+
"execution_count": 6,
4984
"id": "c3b5ac2d-0086-48bb-8a74-a4c0c7f43a7b",
5085
"metadata": {},
5186
"outputs": [],
@@ -56,8 +91,24 @@
5691
"\n",
5792
"schema_domain = URIRef(\"https://schema.org/domainIncludes\")\n",
5893
"schema_range = URIRef(\"https://schema.org/rangeIncludes\")\n",
59-
"bs_ns = \"https://bioschemas.org/terms/\"\n",
60-
"\n",
94+
"bs_ns = \"https://bioschemas.org/terms/\""
95+
]
96+
},
97+
{
98+
"cell_type": "markdown",
99+
"id": "a3ca2232-1e5f-4148-8089-19cb4cfa5c56",
100+
"metadata": {},
101+
"source": [
102+
"## For each property, get the domain and name, and create the corresponding page"
103+
]
104+
},
105+
{
106+
"cell_type": "code",
107+
"execution_count": 11,
108+
"id": "b420daf4-8580-4ebf-98f3-dcfee0485d18",
109+
"metadata": {},
110+
"outputs": [],
111+
"source": [
61112
"for s in g.subjects(predicate=schema_domain, unique=True) :\n",
62113
" prop_name = str(s).split('/')[-1]\n",
63114
" \n",
@@ -74,21 +125,31 @@
74125
" all_range = 'expected_values_as_type: \\n' \n",
75126
" for prop_range in g.objects(subject=s, predicate=schema_range) :\n",
76127
" range_name = str(prop_range).split('/')[-1]\n",
77-
" all_range += '- ' + range_name + '\\n'\n",
128+
" all_range += '- [\"' + range_name + '\", \"' + str(prop_range) + '\"]\\n'\n",
78129
"\n",
79130
" prop_yaml_str += all_domain\n",
80131
" prop_yaml_str += all_range\n",
81-
" with open(prop_name + '.html', 'w') as file:\n",
132+
" with open('../pages/_properties/' + prop_name + '.html', 'w') as file:\n",
82133
" file.write(\"---\\n\")\n",
83134
" file.write(prop_yaml_str)\n",
84135
" file.write(\"\\n---\\n\\n\")\n",
85-
" file.write(\"{% include properties.html %}\\n\")\n"
136+
" file.write(\"{% include properties.html %}\\n\")"
137+
]
138+
},
139+
{
140+
"cell_type": "markdown",
141+
"id": "b4619d41-26ef-4c7d-a610-bd5b0c2eb503",
142+
"metadata": {},
143+
"source": [
144+
"### ToDo - Improvements \n",
145+
"- Move the code to a script that can be integrated into GitHub actions\n",
146+
"- Do something similar for draft properties (requires a modification of the landing page for properties as right now is only a list, supporting released and draft types would require tabs similar to types page)\n"
86147
]
87148
},
88149
{
89150
"cell_type": "code",
90151
"execution_count": null,
91-
"id": "b420daf4-8580-4ebf-98f3-dcfee0485d18",
152+
"id": "027029bf-d750-4ff5-9dd2-c3fe68cd9d16",
92153
"metadata": {},
93154
"outputs": [],
94155
"source": []

pages/_properties/additionalProperty.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
used_in_types:
66
- BioSample
77
expected_values_as_type:
8-
- PropertyValue
8+
- ["PropertyValue", "https://schema.org/PropertyValue"]
99

1010
---
1111

pages/_properties/alternateScientificName.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
used_in_types:
66
- Taxon
77
expected_values_as_type:
8-
- TaxonName
9-
- Text
10-
- URL
8+
- ["TaxonName", "https://bioschemas.org/terms/TaxonName"]
9+
- ["Text", "https://schema.org/Text"]
10+
- ["URL", "https://schema.org/URL"]
1111

1212
---
1313

pages/_properties/alternativeOf.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
used_in_types:
66
- Gene
77
expected_values_as_type:
8-
- Gene
8+
- ["Gene", "https://schema.org/Gene"]
99

1010
---
1111

pages/_properties/associatedDisease.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
used_in_types:
66
- BioChemEntity
77
expected_values_as_type:
8-
- MedicalCondition
9-
- URL
10-
- PropertyValue
8+
- ["MedicalCondition", "https://schema.org/MedicalCondition"]
9+
- ["URL", "https://schema.org/URL"]
10+
- ["PropertyValue", "https://schema.org/PropertyValue"]
1111

1212
---
1313

pages/_properties/bioChemInteraction.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
used_in_types:
66
- BioChemEntity
77
expected_values_as_type:
8-
- BioChemEntity
8+
- ["BioChemEntity", "https://bioschemas.org/terms/BioChemEntity"]
99

1010
---
1111

pages/_properties/bioChemSimilarity.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
used_in_types:
66
- BioChemEntity
77
expected_values_as_type:
8-
- BioChemEntity
8+
- ["BioChemEntity", "https://bioschemas.org/terms/BioChemEntity"]
99

1010
---
1111

pages/_properties/biologicalRole.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
used_in_types:
66
- BioChemEntity
77
expected_values_as_type:
8-
- DefinedTerm
8+
- ["DefinedTerm", "https://schema.org/DefinedTerm"]
99

1010
---
1111

pages/_properties/chemicalComposition.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
used_in_types:
66
- ChemicalSubstance
77
expected_values_as_type:
8-
- Text
8+
- ["Text", "https://schema.org/Text"]
99

1010
---
1111

0 commit comments

Comments
 (0)