Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
dad
FFDS-register-front
Commits
1daa3df5
Commit
1daa3df5
authored
Oct 19, 2020
by
Paulo
Browse files
refactor(code): Form code change 2
parent
5b0c91b8
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/app/search/search.component.ts
View file @
1daa3df5
...
...
@@ -16,57 +16,59 @@ export class SearchComponent implements OnInit {
results
:
string
[][]
=
[];
//seachForm: FormGroup;
submitted
=
false
;
searchForm
=
new
FormGroup
({
searchTerm
:
new
FormControl
()
});
});
constructor
(
private
parserService
:
ParseXmlService
)
{
}
constructor
(
private
parserService
:
ParseXmlService
,
private
formBuild
:
FormBuilder
)
{
}
ngOnInit
():
void
{
}
ngOnDestroy
():
void
{}
simpleSearch
(){
//effectuer une recherche plein text en SPARL sur la BDD Blazegraph
//curl -X POST -H 'Accept: application/rdf+xml' -i 'http://10.6.10.9:8888/blazegraph/sparql' --data 'query=SELECT * where {?s a <http://www.w3.org/ns/dcat#Dataset> }'
let
query
:
string
;
// query ='query=SELECT * where {?s a <http://www.w3.org/ns/dcat#Dataset> }'
ngOnInit
():
void
{}
simpleSearch
()
{
this
.
submitted
=
true
;
this
.
results
=
[];
//effectuer une recherche plein text en SPARL sur la BDD Blazegraph
//curl -X POST -H 'Accept: application/rdf+xml' -i 'http://10.6.10.9:8888/blazegraph/sparql' --data 'query=SELECT * where {?s a <http://www.w3.org/ns/dcat#Dataset> }'
query
=
'
query=PREFIX dcat: <http://www.w3.org/ns/dcat#>
\n\
PREFIX dcterms: <http://purl.org/dc/terms/>
\n\
SELECT ?title ?description ?uri
\n\
where {
\n\
?dataset a dcat:Dataset ;
\n\
dcterms:title ?title ;
\n\
dcterms:description ?description;
\n\
dcat:keyword ?uri ;
\n\
FILTER (contains( ?description, "
'
+
this
.
searchForm
.
value
.
searchTerm
+
'
") || contains( ?title, "
'
+
this
.
searchForm
.
value
.
searchTerm
+
'
"))
\n\
.
\n\
}
'
//if (searchData) {
let
query
:
string
;
let
searchTerm
=
this
.
searchForm
.
get
(
"
searchTerm
"
).
value
console
.
log
(
"
Log arrived :
"
,
searchTerm
)
//query ='query=SELECT * where {?s a <http://www.w3.org/ns/dcat#Dataset> }'
query
=
'
query=PREFIX dcat: <http://www.w3.org/ns/dcat#>
\n\
PREFIX dcterms: <http://purl.org/dc/terms/>
\n\
SELECT ?title ?description ?uri
\n\
where {
\n\
?dataset a dcat:Dataset ;
\n\
dcterms:title ?title ;
\n\
dcterms:description ?description;
\n\
dcat:keyword ?uri ;
\n\
FILTER ( contains( ?description, "
'
+
searchTerm
+
'
") || contains( ?title, "
'
+
searchTerm
+
'
"))
\n\
.
\n\
}
'
this
.
parserService
.
getXmlResult
(
query
).
subscribe
(
data
=>
{
data
=>
{
if
(
data
){
console
.
error
(
"
Data
"
,
data
)
this
.
results
=
[];
data
.
results
.
bindings
.
forEach
(
element
=>
{
this
.
results
.
push
(
element
);
});
}
//console.warn('Data submited ', searchTerm, "Results : ", this.results);
});
})
this
.
searchForm
.
reset
();
}
//}
}
isXmlItemsEmpty
(){
return
this
.
results
.
length
===
0
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment