@@ -19,7 +19,7 @@ async function loadOntologyDetails() {
1919 }
2020
2121 const ontologies = await response . json ( ) ;
22- const ontology = ontologies . find ( o => o . Name === ontologyName ) ; // Find the ontology by name
22+ const ontology = ontologies . find ( o => o . Title === ontologyName ) ; // Find the ontology by Title
2323
2424 if ( ! ontology ) {
2525 document . getElementById ( 'ontology-details' ) . innerHTML = 'Ontology not found.' ;
@@ -35,82 +35,66 @@ async function loadOntologyDetails() {
3535 }
3636}
3737
38- // Function to create and populate the ontology table
39- // function populateOntologyTable(ontology) {
40- // const tableBody = document.querySelector('#ontology-table tbody');
41- // tableBody.innerHTML = '';
42-
43- // // Populate the table with data
44- // Object.keys(ontology).forEach(key => {
45- // if (ontology[key] !== null) {
46- // const row = document.createElement('tr');
47- // row.innerHTML = `
48- // <td>${key}</td>
49- // <td>${ontology[key]}</td>
50- // `;
51- // tableBody.appendChild(row);
52- // }
53- // });
54- // }
55-
5638
5739function populateOntologyTable ( ontology ) {
5840
59- // Update the page header with ontology Name and Acronym (new addition: 20250227 )
41+ // Update the page header with ontology Title and Prefix (updated column names )
6042 const ontologyHeading = document . getElementById ( 'ontology-heading' ) ;
61- ontologyHeading . textContent = ontology . Name ; // Set Name as the title
43+ ontologyHeading . textContent = ontology . Title ; // Set Title as the title
6244
63- // Check if Acronym exists and append it
64- if ( ontology . Acronym ) {
65- ontologyHeading . textContent += ` (${ ontology . Acronym . toUpperCase ( ) } )` ;
45+ // Check if Prefix exists and append it
46+ if ( ontology . Prefix ) {
47+ ontologyHeading . textContent += ` (${ ontology . Prefix } )` ;
6648 }
6749
6850 const tableBody = document . querySelector ( '#ontology-table tbody' ) ;
6951 tableBody . innerHTML = '' ; // Clear previous content
7052
71- // Define the desired order of fields
53+ // Define the desired order of fields (updated to match JSON column names)
7254 const fieldOrder = [
7355 "Title" ,
74- "Acronym " ,
75- "Issued" ,
56+ "Prefix " ,
57+ "Created (or Issued or ) " ,
7658 "Version" ,
7759 "License" ,
7860 "URI" ,
79- "FOOPS Score" ,
61+ "FOOPs Score" ,
8062 "Description" ,
81- "Conforms To Standard" ,
63+ "Conforms to Standard(s) " ,
8264 "Primary Domain" ,
8365 "Secondary Domain" ,
84- "References " ,
85- "Linked-to ontologies AECO" ,
86- "Linked-by ontologies UPPER " ,
66+ "Reference Source " ,
67+ "Linked-to AECO Ontologies " ,
68+ "Linked-to Upper Ontologies " ,
8769 ] ;
8870
8971 // Populate the table in the defined order
9072 fieldOrder . forEach ( ( key ) => {
91- if ( ontology [ key ] !== null && ontology [ key ] !== undefined ) {
92- let value = ontology [ key ] ;
93-
94- // Capitalize specific fields
95- if ( key === "Acronym" || key === "Linked-to ontologies AECO" || key === "Linked-by ontologies UPPER" ) {
96- value = String ( value ) . toUpperCase ( ) ;
97- }
98-
73+ let value = ontology [ key ] ;
74+
75+ // Show blank for null/undefined values instead of hiding the row
76+ if ( value === null || value === undefined ) {
77+ value = "" ;
78+ }
9979
100- const row = document . createElement ( 'tr' ) ;
101- row . innerHTML = `
102- <td>${ key } </td>
103- <td>${ value } </td>
104- ` ;
105- tableBody . appendChild ( row ) ;
80+ // Make URI a clickable link
81+ if ( key === "URI" && value ) {
82+ value = `<a href="${ value } " target="_blank">${ value } </a>` ;
10683 }
84+
85+ const row = document . createElement ( 'tr' ) ;
86+ row . innerHTML = `
87+ <td>${ key } </td>
88+ <td>${ value } </td>
89+ ` ;
90+ tableBody . appendChild ( row ) ;
10791 } ) ;
10892
109- // Check if PartOfCluster is "Yes" and display ClusterName in the second box
93+ // Check if "Is Part of Ontology Cluster" exists and display ClusterName in the second box
11094 const clusterBox = document . getElementById ( 'cluster-box' ) ;
111- if ( ontology . PartOfCluster === "Yes" && ontology . ClusterName ) {
95+ if ( ontology [ "Is Part of Ontology Cluster" ] ) {
11296 clusterBox . style . display = 'block' ; // Make the cluster box visible
113- clusterBox . querySelector ( '.cluster-name' ) . textContent = ontology . ClusterName ;
97+ clusterBox . querySelector ( '.cluster-name' ) . textContent = ontology [ "Is Part of Ontology Cluster" ] ;
11498 } else {
11599 clusterBox . style . display = 'none' ; // Hide the cluster box if not part of a cluster
116100 }
@@ -124,33 +108,43 @@ function populateEvaluationTable(ontology) {
124108 // Define the fixed criteria and their corresponding keys in the JSON
125109 const evaluationCriteria = {
126110 "Connectivity" : [
127- { criteria : "Linkage to upper ontologies" , key : "Linkage to upper ontologies " } ,
128- { criteria : "Linkage to existing AECO ontologies" , key : "Linkage to existing AECO ontologies " } ,
129- { criteria : "Linkage to meta schema ontologies" , key : "Linkage to meta schema ontologies " }
111+ { criteria : "Linkage to upper ontologies" , key : "Linked-to Upper Ontologies " } ,
112+ { criteria : "Linkage to existing AECO ontologies" , key : "Linked- to AECO Ontologies " } ,
113+ { criteria : "Linkage to meta schema ontologies" , key : "Conforms to Standard(s) " }
130114 ] ,
131115 "Accessibility" : [
132- { criteria : "Conceptual Data model available" , key : "Conceptual Data model available " } ,
133- { criteria : "Accessible as Serialization" , key : "Accessible as Serialization" } ,
134- { criteria : "Accessible as a URI" , key : "Accessible as a URI" }
116+ { criteria : "Conceptual Data model available" , key : "Has Conceptual Model " } ,
117+ { criteria : "Accessible as Serialization" , key : "Has Serialization" } ,
118+ { criteria : "Accessible as a URI" , key : "URI" }
135119 ] ,
136120 "Documentation & Reuse" : [
137- { criteria : "Clearly documented" , key : "Clearly documented " } ,
138- { criteria : "Use of annotations" , key : "Use of annotations " } ,
139- { criteria : "Reused/Extended" , key : "Reused/Extended by Explicit Import " }
121+ { criteria : "Clearly documented" , key : "Has Documentation " } ,
122+ { criteria : "Use of annotations" , key : "Has Annotations " } ,
123+ { criteria : "Reused/Extended" , key : "Is Reused by Other AECO Ontologies " }
140124 ]
141125 } ;
142126
143- // Axis score mappings
127+ // Axis score mappings (updated to match JSON column names)
144128 const axisScores = {
145- "Connectivity" : ontology [ "Connectivity " ] || 0 ,
146- "Accessibility" : ontology [ "Accessability " ] || 0 ,
147- "Documentation & Reuse" : ontology [ "Documentation & Reuse " ] || 0
129+ "Connectivity" : ontology [ "Alignment Score " ] || 0 ,
130+ "Accessibility" : ontology [ "Accessibility Score " ] || 0 ,
131+ "Documentation & Reuse" : ontology [ "Quality Score " ] || 0
148132 } ;
149133
150134 Object . entries ( evaluationCriteria ) . forEach ( ( [ axis , criteriaList ] ) => {
151135 criteriaList . forEach ( ( item , index ) => {
152- let presence = ontology [ item . key ] ? ontology [ item . key ] . trim ( ) . toLowerCase ( ) : "no" ;
153- presence = presence === "yes" ? "Yes" : "No" ;
136+ let value = ontology [ item . key ] ;
137+ let presence = "No" ;
138+
139+ // Handle different value types
140+ if ( value !== null && value !== undefined ) {
141+ if ( typeof value === 'number' ) {
142+ presence = value >= 1 ? "Yes" : "No" ;
143+ } else if ( typeof value === 'string' ) {
144+ const trimmed = value . trim ( ) . toLowerCase ( ) ;
145+ presence = ( trimmed !== "" && trimmed !== "no" && trimmed !== "n/a" ) ? "Yes" : "No" ;
146+ }
147+ }
154148
155149 const row = document . createElement ( "tr" ) ;
156150
@@ -185,11 +179,11 @@ function renderSpiderChart(ontology) {
185179 labels : [ "Connectivity" , "Accessibility" , "Documentation & Reuse" ] ,
186180 datasets : [
187181 {
188- label : ontology . Name ,
182+ label : ontology . Title ,
189183 data : [
190- ontology . Connectivity || 0 ,
191- ontology . Accessability || 0 ,
192- ontology [ "Documentation & Reuse " ] || 0
184+ ontology [ "Alignment Score" ] || 0 ,
185+ ontology [ "Accessibility Score" ] || 0 ,
186+ ontology [ "Quality Score " ] || 0
193187 ] ,
194188 backgroundColor : "rgba(255, 99, 132, 0.2)" ,
195189 borderColor : "rgba(255, 99, 132, 1)" ,
@@ -210,36 +204,4 @@ function renderSpiderChart(ontology) {
210204 } ) ;
211205}
212206
213- // Fetch and Load Data
214- async function loadOntologyDetails ( ) {
215- const urlParams = new URLSearchParams ( window . location . search ) ;
216- const ontologyName = urlParams . get ( "ontology" ) ;
217-
218- if ( ! ontologyName ) {
219- document . getElementById ( "ontology-details" ) . innerHTML = "No ontology found." ;
220- return ;
221- }
222-
223- try {
224- const response = await fetch ( "data/Ontologies_forRepo.json" ) ;
225- if ( ! response . ok ) throw new Error ( "Failed to fetch ontology data" ) ;
226-
227- const ontologies = await response . json ( ) ;
228- const ontology = ontologies . find ( o => o . Name === ontologyName ) ;
229-
230- if ( ! ontology ) {
231- document . getElementById ( "ontology-details" ) . innerHTML = "Ontology not found." ;
232- return ;
233- }
234-
235- populateOntologyTable ( ontology ) ;
236- populateEvaluationTable ( ontology ) ;
237- renderSpiderChart ( ontology ) ;
238- } catch ( error ) {
239- console . error ( "Error fetching ontology data:" , error ) ;
240- document . getElementById ( "ontology-details" ) . innerHTML = "Error loading ontology data." ;
241- }
242- }
243-
244207window . onload = loadOntologyDetails ;
245-
0 commit comments