From 07f7a2483391635c9a00f875bf9c91410c0f08b0 Mon Sep 17 00:00:00 2001
From: Baptiste Toulemonde <toulemonde@cines.fr>
Date: Tue, 20 Jul 2021 17:07:40 +0200
Subject: [PATCH] change sparql queries

---
 src/app/search/search.component.ts |  2 ++
 src/app/stats/stats.component.ts   | 13 +++++++++++--
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/src/app/search/search.component.ts b/src/app/search/search.component.ts
index a62bddb9c..41639e47d 100644
--- a/src/app/search/search.component.ts
+++ b/src/app/search/search.component.ts
@@ -2,6 +2,7 @@ import { Component, OnInit } from '@angular/core';
 import { HttpClient, HttpHeaders } from '@angular/common/http';
 import { ParseXmlService } from '../services/parse-xml.service';
 import { FormBuilder, FormControl, FormGroup } from '@angular/forms';
+import { environment } from 'src/environments/environment.prod';
 
 
 export interface formData{
@@ -49,6 +50,7 @@ export class SearchComponent implements OnInit {
               where {\n\?dataset a dcat:Dataset ;\n\
                         dcterms:title ?title ;\n\
                         dcterms:description ?description; \n\
+                        dcterms:isPartOf* <'+ environment.fdpUrl +'>;\n\
                         dcat:keyword ?uri ; \n\
                         FILTER (contains( ?description, "' + 
                         term +'") || contains( ?title, "'+ term +'"))\n\.\n\
diff --git a/src/app/stats/stats.component.ts b/src/app/stats/stats.component.ts
index fdd8603f5..698c4e2d2 100644
--- a/src/app/stats/stats.component.ts
+++ b/src/app/stats/stats.component.ts
@@ -1,6 +1,7 @@
 import { Component, OnInit } from '@angular/core';
 import { HttpClient, HttpHeaders } from '@angular/common/http';
 import { ParseXmlService } from '../services/parse-xml.service';
+import { environment } from 'src/environments/environment';
 
 
 @Component({
@@ -17,11 +18,19 @@ export class StatsComponent implements OnInit {
 
   ngOnInit(): void {
 
-      let query1='query=SELECT (COUNT(?s) AS ?triples) WHERE { ?s a <http://www.w3.org/ns/dcat#Catalog> }'
+      let query1='query=prefix dct: <http://purl.org/dc/terms/>\n\
+      SELECT (COUNT(?s) AS ?triples) \n\
+      WHERE { ?s a <http://www.w3.org/ns/dcat#Catalog>;\n\
+              dct:isPartOf <https://f2ds.eosc-pillar.eu>\n\
+            }'
       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> }'
+      let query2='query=prefix dct: <http://purl.org/dc/terms/>\n\
+      SELECT (COUNT(?s) AS ?triples) \n\
+      WHERE { ?s a <http://www.w3.org/ns/dcat#Dataset>;\n\
+              dct:isPartOf <'+ environment.fdpUrl +'>\n\
+            }'
       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); }})
 
-- 
GitLab