-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
225 lines (202 loc) · 8.73 KB
/
index.html
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
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
<!DOCTYPE html>
<html>
<head>
<title>Sinopia Linked Data - Graph Explorer</title>
<link rel="stylesheet" href="https://pyscript.net/latest/pyscript.css" />
<link href="static/css/main.css" rel="stylesheet" />
<link href="static/css/header.css" rel="stylesheet" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.css">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
<script defer src="https://pyscript.net/latest/pyscript.js"></script>
<script src="static/js/components.js"></script>
<style>
strong {
font-weight: 800;
}
</style>
<py-config type="toml">
packages = ["pandas", "markdown", "Jinja2", "./static/wheels/rdflib-7.0.0-py3-none-any.whl"]
[[fetch]]
from = "src"
files = ["helpers.py", "load_rdf.py", "query_rdf.py", "sinopia_api.py", "state.py"]
</py-config>
<py-script>
__version__ = "1.0.3"
import asyncio
import sys
import js
# Hack to load rdflib
# setattr(sys.stderr, 'isatty', lambda : True)
from pyodide.ffi import create_proxy
import helpers
import rdflib
BIBFRAME = rdflib.Namespace("http://id.loc.gov/ontologies/bibframe/")
SINOPIA = rdflib.Namespace("http://sinopia.io/vocabulary/")
from sinopia_api import show_groups
from load_rdf import bibframe_sparql as bf_sparql_widget, build_graph, download_graph
from query_rdf import download_query_results, run_query
async def load_content():
for element_id in ['intro',
'retrieve-rdf',
'bf-work-instance-item-rdf',
'sparql-summary'
]:
await helpers.render_markdown(element_id)
asyncio.ensure_future(load_content())
bf_sparql_widget("bf-sparql-query")
helpers.set_versions(__version__)
</py-script>
</head>
<body>
<div class="editor-navbar">
<h3>Linked-Data for Production</h3>
<h1>Graph Explorer with Sinopia Linked Data</h1>
<h4>Version <span id="version" ></span></h4>
</div>
<div class="float-end sticky-top">
<button class="btn btn-outline-success" data-bs-toggle="modal" data-bs-target="#graph-repl-modal">
<img width="64" alt="Python-logo-notext" src="./static/img/python-repl.svg">
</button>
</div>
<ul class="nav nav-tabs" id="myTab" role="tablist">
<li class="nav-item" role="presentation">
<button class="nav-link active"
id="home-tab"
data-bs-toggle="tab"
data-bs-target="#load"
type="button"
role="tab"
aria-controls="home"
aria-selected="true">Load RDF</button>
</li>
<li class="nav-item" role="presentation">
<button class="nav-link"
id="bibframe-tab"
data-bs-toggle="tab"
data-bs-target="#graph-summary"
type="button"
role="tab"
aria-controls="profile"
aria-selected="false">Graph Summary</button>
</li>
<li class="nav-item" role="presentation">
<button class="nav-link"
id="contact-tab"
data-bs-toggle="tab"
data-bs-target="#sparql"
type="button"
role="tab"
aria-controls="contact"
aria-selected="false">SPARQL</button>
</li>
</ul>
<div class="tab-content" id="myTabContent">
<div class="tab-pane fade show active" id="load" role="tabpanel" aria-labelledby="home-tab">
<div class="container">
<div id="intro">
## Load RDF
Environments and Groups
</div>
<div class="row">
<div class="col">
<div class="form-check">
<input type="radio" py-click="asyncio.ensure_future(show_groups('Development'))" name="sinopia_env" value="Development" class="form-check-input">
<label for="https://api.development.sinopia.io/" class="form-check-label">Development</label>
</input>
</div>
<div class="form-check">
<input type="radio" py-click="asyncio.ensure_future(show_groups('Stage'))" value="Stage" name="sinopia_env" class="form-check-input">
<label for="https://api.stage.sinopia.io/" class="form-check-label">Stage</label>
</input>
</div>
<div class="form-check">
<input type="radio" py-click="asyncio.ensure_future(show_groups('Production'))" value="Production" name="sinopia_env" class="form-check-input">
<label for="https://api.sinopia.io/" class="form-check-label">Production</label>
</input>
</div>
<button class="btn btn-primary btn-lg" py-click="asyncio.ensure_future(build_graph())">
<i class="spinner-border d-none" id="graph-loading-status"></i>
Build Graph
</button>
</div>
<div class="col">
<h4>Groups</h4>
<div>
<select type="form-control" multiple="true" size=5 id="env-groups">
</select>
</div>
<h4>Individual Resources</h4>
<p>Add URLs to Individual Resources to add to Graph (separate by commas)</p>
<div>
<textarea class="form-control" cols=25 rows=10 id="resource-urls"></textarea>
</div>
</div>
</div>
</div>
</div>
<div class="tab-pane fade" id="graph-summary" role="tabpanel" aria-labelledby="profile-tab">
<div class="container">
<div id="bf-work-instance-item-rdf">
## Graph Summary
The [Sinopia API](https://github.com/ld4p/sinopia_api) is used to construct a small
RDF graph and then create a knowledge graph for analysis and visualization of the entities
along with their properties.
</div>
<div class="row">
<div class="col">
<div id="summarize-work-instance-item"></div>
</div>
</div>
</div>
</div>
<div class="tab-pane fade" id="sparql" role="tabpanel" aria-labelledby="contact-tab">
<div class="container">
<div id="sparql-summary">
## SPARQL
</div>
<div class="row">
<div class="col">
<div id="bf-sparql-query"></div>
</div>
<div class="col">
<div id="bf-sparql-results"></div>
</div>
</div>
</div>
</div>
</div>
<footer>
<p xmlns:cc="http://creativecommons.org/ns#" >
Version <span id="footer-version"></span>. Documentation is licensed under
<a href="http://creativecommons.org/licenses/by/4.0/?ref=chooser-v1"
target="_blank"
rel="license noopener noreferrer" style="display:inline-block;">Creative Commons Attribution 4.0 International</a>.
Source code licensed under <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache 2</a> and available
at <a href="https://github.com/LD4P/graph-explorer">https://github.com/LD4P/graph-explorer</a>
</p>
</footer>
<div class="modal fade" id="graph-repl-modal" tabindex="-1" aria-labelledby="graph-repl-modal-title" style="display: none;" aria-hidden="true">
<div class="modal-dialog modal-xl modal-dialog-scrollable">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="graph-repl-modal-title">Graph Explorer - Python REPL</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<div class="sticky-top py-3 bg-light">
<div id="err-div" class="bg-red text-blue text-center border-t-4"></div>
<py-repl id="graph-repl" auto-generate="true" std-out="output" std-err="err-div">print("Hello")</py-repl>
<div id="output" class="p-4"></div>
<div id="err-div"></div>
</div>
<py-terminal></py-terminal>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
</body>
</html>