Commit 5f021fc4 authored by cazenave's avatar cazenave
Browse files

add stats

parent b6722dcb
......@@ -28,6 +28,7 @@
<router-outlet></router-outlet>
<!--<hr style="border-bottom: 1px solid gray; width: 80%; position: absolute;margin-top: 25%;">
<p>Test</p>-->
<app-stats></app-stats>
</nb-layout-column>
<nb-layout-footer>Contact us</nb-layout-footer>
......
......@@ -43,6 +43,7 @@ import { NbEvaIconsModule } from '@nebular/eva-icons';
import { AccountComponent } from './account/account.component';
import { AccountModule } from './account/account.module';
import { SearchModule} from './search/search.module';
import { StatsComponent } from './stats/stats.component';
@NgModule({
......@@ -62,7 +63,8 @@ import { SearchModule} from './search/search.module';
ElasticsearchComponent,
PublishApiComponent,
SearchComponent,
AccountComponent
AccountComponent,
StatsComponent
],
imports: [
BrowserModule,
......
<div class="w3-container">
<table class="w3-table-all w3-card-4">
<thead style="background-color: #3366ff">
<th style="text-align: center;">Number of Catalogs</th>
<th style="text-align: center;">Number of Datasets</th>
</thead>
<tbody >
<tr><td *ngFor="let stat of stats"><strong>{{stat}}</strong></td></tr>
</tbody>
</table>
</div>
\ No newline at end of file
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { StatsComponent } from './stats.component';
describe('StatsComponent', () => {
let component: StatsComponent;
let fixture: ComponentFixture<StatsComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ StatsComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(StatsComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { ParseXmlService } from '../services/parse-xml.service';
@Component({
selector: 'app-stats',
templateUrl: './stats.component.html',
styleUrls: ['./stats.component.scss']
})
export class StatsComponent implements OnInit {
public results: string[] = [];
public stats: string[] = [];
constructor(private parserService: ParseXmlService) { }
ngOnInit(): void {
let query1='query=SELECT (COUNT(?s) AS ?triples) WHERE { ?s a <http://www.w3.org/ns/dcat#Catalog> }'
this.parserService.getXmlResult(query1).subscribe(data=>{if (data){this.results = []; data.results.bindings.forEach(element => { this.results.push(element);});
this.stats.push(this.results[0]["triples"].value)
let query2='query=SELECT (COUNT(?s) AS ?triples) WHERE { ?s a <http://www.w3.org/ns/dcat#Dataset> }'
this.parserService.getXmlResult(query2).subscribe(data=>{if (data){this.results = []; data.results.bindings.forEach(element => { this.results.push(element);});
this.stats.push(this.results[0]["triples"].value); }})
console.log(this.stats);
}})
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment