-
Notifications
You must be signed in to change notification settings - Fork 0
/
orsd.html
334 lines (310 loc) · 14.6 KB
/
orsd.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
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ORSD</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css">
<style>
.user-story-group {
border: 2px solid #ccc;
padding: 10px;
margin-bottom: 20px;
background-color: white;
transition: transform 0.3s;
font-size: 12px;
}
.user-story {
border: 1px solid #ccc;
padding: 5px;
margin-bottom: 10px;
background-color: #f8f9fa;
font-size: 10px;
}
.orsd-button {
margin-right: 10px;
}
.orsd-button.active {
color: #fff;
}
.orsd-option {
cursor: pointer;
padding: 5px;
margin-bottom: 5px;
border-radius: 5px;
}
.orsd-option:hover {
opacity: 0.8;
}
.section {
margin-top: 20px;
}
.navbar {
padding: 0.5rem 1rem;
}
</style>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="container-fluid">
<a class="navbar-brand" href="#">Miro Plugin</a>
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" href="index.html">Ideation</a>
</li>
<li class="nav-item">
<a class="nav-link" href="recombination.html">Recombination</a>
</li>
<li class="nav-item">
<a class="nav-link" href="rephrase.html">Rephrase</a>
</li>
<li class="nav-item">
<a class="nav-link" href="group.html">Group & Priority</a>
</li>
<li class="nav-item">
<a class="nav-link" href="orsd.html">ORSD</a>
</li>
<li class="nav-item">
<a class="nav-link" href="cqs.html">CQs</a>
</li>
</ul>
</div>
</nav>
<div class="container mt-4">
<div class="row">
<div class="col-md-6">
<h2>User Stories</h2>
<div class="row" id="userStoryGroups"></div>
</div>
<div class="col-md-6">
<h1>ORSD</h1>
<div class="row">
<div class="col-md-12">
<button class="btn btn-outline-primary orsd-button" data-orsd="intendedUsers" data-color="#007bff">Intended Users</button>
<button class="btn btn-outline-success orsd-button" data-orsd="intendedUses" data-color="#28a745">Intended Uses</button>
<button class="btn btn-outline-warning orsd-button" data-orsd="competencyQuestions" data-color="#ffc107">Competency Questions</button>
<button class="btn btn-outline-danger orsd-button" data-orsd="terms" data-color="#dc3545">Terms</button>
</div>
</div>
<div id="orsdContent" class="mt-4"></div>
<div class="section">
<h4>Formality</h4>
<select class="form-select" id="formality">
<option value="highly informal">Highly Informal</option>
<option value="semi-informal">Semi-Informal</option>
<option value="semi-formal">Semi-Formal</option>
<option value="rigorously formal">Rigorously Formal</option>
</select>
</div>
<div class="section">
<h4>Languages</h4>
<select class="form-select" id="languages">
<option value="OWL">OWL</option>
<option value="RDF">RDF</option>
</select>
</div>
<div class="text-center mt-4">
<button id="downloadButton" class="btn btn-primary">Download</button>
</div>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
<script>
const userStories = generateUserStories();
const userStoryGroups = document.getElementById("userStoryGroups");
const orsdButtons = document.querySelectorAll(".orsd-button");
const orsdContent = document.getElementById("orsdContent");
const downloadButton = document.getElementById("downloadButton");
// Render user stories
renderUserStories();
// ORSD button click event
orsdButtons.forEach(button => {
button.addEventListener("click", () => {
button.classList.toggle("active");
button.style.backgroundColor = button.classList.contains("active") ? button.getAttribute("data-color") : "";
renderORSDContent();
});
});
// Render ORSD content
function renderORSDContent() {
orsdContent.innerHTML = "";
orsdButtons.forEach(button => {
if (button.classList.contains("active")) {
const orsdType = button.getAttribute("data-orsd");
const relatedParts = getRelatedParts(orsdType);
relatedParts.forEach(part => {
const partElement = document.createElement("div");
partElement.classList.add("orsd-option");
partElement.style.backgroundColor = button.getAttribute("data-color");
partElement.style.color = "#fff";
partElement.textContent = part;
partElement.addEventListener("click", () => {
highlightRelatedPart(part, orsdType, button.getAttribute("data-color"));
});
partElement.addEventListener("dblclick", (event) => {
const newContent = prompt("Enter new content:", part);
if (newContent !== null) {
partElement.textContent = newContent;
}
event.stopPropagation();
});
orsdContent.appendChild(partElement);
});
}
});
}
// Get related parts from user stories based on ORSD type
function getRelatedParts(orsdType) {
const relatedParts = [];
userStories.forEach(group => {
group.stories.forEach(story => {
if (orsdType === "intendedUsers") {
relatedParts.push(story.persona);
} else if (orsdType === "intendedUses") {
relatedParts.push(story.goals);
} else if (orsdType === "competencyQuestions") {
relatedParts.push(story.title);
} else if (orsdType === "terms") {
relatedParts.push(story.title);
}
});
});
return relatedParts;
}
// Highlight related part in user stories
function highlightRelatedPart(part, orsdType, color) {
const userStoryElements = document.querySelectorAll(".user-story");
userStoryElements.forEach(storyElement => {
if (orsdType === "competencyQuestions") {
const titleElement = storyElement.querySelector(".story-title");
if (titleElement.textContent.includes(part)) {
storyElement.style.backgroundColor = color;
} else {
storyElement.style.backgroundColor = "";
}
} else {
const titleElement = storyElement.querySelector(".story-title");
const personaElement = storyElement.querySelector(".story-persona");
const goalsElement = storyElement.querySelector(".story-goals");
titleElement.style.backgroundColor = titleElement.textContent.includes(part) ? color : "";
personaElement.style.backgroundColor = personaElement.textContent.includes(part) ? color : "";
goalsElement.style.backgroundColor = goalsElement.textContent.includes(part) ? color : "";
}
});
}
// Download button click event
downloadButton.addEventListener("click", () => {
const orsdData = {
intendedUsers: [],
intendedUses: [],
competencyQuestions: [],
terms: [],
formality: document.getElementById("formality").value,
languages: document.getElementById("languages").value
};
orsdButtons.forEach(button => {
if (button.classList.contains("active")) {
const orsdType = button.getAttribute("data-orsd");
const relatedParts = Array.from(orsdContent.children).map(child => child.textContent);
orsdData[orsdType] = relatedParts;
}
});
const dataStr = JSON.stringify(orsdData, null, 2);
const dataUri = 'data:application/json;charset=utf-8,' + encodeURIComponent(dataStr);
const downloadLink = document.createElement('a');
downloadLink.setAttribute('href', dataUri);
downloadLink.setAttribute('download', 'orsd_data.json');
document.body.appendChild(downloadLink);
downloadLink.click();
document.body.removeChild(downloadLink);
});
// Generate random user stories
function generateUserStories() {
const groups = [
{ name: "Group 1", color: "#E8F5E9", priority: Math.floor(Math.random() * 5) + 1 },
{ name: "Group 2", color: "#FFF3E0", priority: Math.floor(Math.random() * 5) + 1 }
];
const stories = [
{
title: "Ontology Development",
persona: "As an ontology engineer",
goals: "I want to create a domain-specific ontology",
description: "The ontology should capture the key concepts, relationships, and constraints of the domain.",
priority: Math.floor(Math.random() * 5) + 1
},
{
title: "Ontology Integration",
persona: "As a knowledge engineer",
goals: "I want to integrate multiple ontologies",
description: "The integration should resolve conflicts and ensure semantic consistency across the ontologies.",
priority: Math.floor(Math.random() * 5) + 1
},
{
title: "Ontology Visualization",
persona: "As a data scientist",
goals: "I want to visualize the ontology structure",
description: "The visualization should provide an intuitive representation of the ontology's classes, properties, and hierarchies.",
priority: Math.floor(Math.random() * 5) + 1
},
{
title: "Ontology Alignment",
persona: "As an ontology expert",
goals: "I want to align ontologies from different domains",
description: "The alignment should establish mappings between similar concepts across the ontologies.",
priority: Math.floor(Math.random() * 5) + 1
},
{
title: "Ontology Reasoning",
persona: "As a researcher",
goals: "I want to perform reasoning over the ontology",
description: "The reasoning should derive new knowledge and check the consistency of the ontology.",
priority: Math.floor(Math.random() * 5) + 1
},
{
title: "Ontology Validation",
persona: "As a domain expert",
goals: "I want to validate the ontology against domain knowledge",
description: "The validation should ensure that the ontology accurately represents the domain concepts and relationships.",
priority: Math.floor(Math.random() * 5) + 1
}
];
const userStories = [];
groups.forEach(group => {
const groupStories = [];
for (let i = 0; i < 2; i++) {
const randomStory = stories[Math.floor(Math.random() * stories.length)];
groupStories.push(randomStory);
}
userStories.push({ group: group.name, color: group.color, priority: group.priority, stories: groupStories });
});
return userStories;
}
// Render user stories
function renderUserStories() {
userStories.forEach(group => {
const groupElement = document.createElement("div");
groupElement.classList.add("col-md-6", "user-story-group");
groupElement.style.backgroundColor = group.color;
groupElement.innerHTML = `
<h3>${group.group}</h3>
<p><strong>Priority:</strong> ${group.priority}</p>
`;
group.stories.forEach(story => {
const storyElement = document.createElement("div");
storyElement.classList.add("user-story");
storyElement.innerHTML = `
<p><strong>Title:</strong> <span class="story-title">${story.title}</span></p>
<p><strong>Persona:</strong> <span class="story-persona">${story.persona}</span></p>
<p><strong>Goals:</strong> <span class="story-goals">${story.goals}</span></p>
<p><strong>Description:</strong> <span class="story-description">${story.description}</span></p>
<p><strong>Priority:</strong> ${story.priority}</p>
`;
groupElement.appendChild(storyElement);
});
userStoryGroups.appendChild(groupElement);
});
}
</script>
</body>
</html>