Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pb with spq_filter, str_detect and | #171

Open
lvaudor opened this issue Sep 7, 2023 · 3 comments
Open

pb with spq_filter, str_detect and | #171

lvaudor opened this issue Sep 7, 2023 · 3 comments

Comments

@lvaudor
Copy link
Owner

lvaudor commented Sep 7, 2023

Hey!
I think there's something wrong with the results of filtering through "spq_filter(str_detect(x,"a|b"))

For instance:

spq_init() %>%      
    spq_add("?labo skos:prefLabel ?labo_label") %>%
    spq_filter(str_detect(labo_label,"Environnement Ville Soc|EVS")) %>%
    spq_perform("hal")

returns 0 lines while

spq_init() %>%      
    spq_add("?labo skos:prefLabel ?labo_label") %>%
    spq_filter(str_detect(labo_label,"Environnement Ville Soc")) %>%
    spq_perform("hal")

returns 3 lines

Right now I have this as a workaround:

spq_init() %>%      
    spq_add("?labo skos:prefLabel ?labo_label") %>%
    spq_filter(str_detect(labo_label,"EVS")|str_detect(labo_label,"Environnement Ville Soc")) %>%
    spq_perform("hal")
@maelle
Copy link
Collaborator

maelle commented Sep 7, 2023

@maelle
Copy link
Collaborator

maelle commented Sep 7, 2023

but the example has FILTER REGEX (?itemLabel, "(ow|itz)$").

@maelle
Copy link
Collaborator

maelle commented Sep 7, 2023

library("glitter")
spq_init() %>%      
    spq_add("?labo skos:prefLabel ?labo_label") %>%
    spq_filter(str_detect(labo_label,"(Environnement Ville Soc)|EVS")) %>%
    spq_perform("hal")
#> # A tibble: 20 × 2
#>    labo                                                labo_label               
#>    <chr>                                               <chr>                    
#>  1 https://data.archives-ouvertes.fr/revue/36364       REVSTAT - Statistical Jo…
#>  2 https://data.archives-ouvertes.fr/revue/115361      Issue 4 of SCS Transacti…
#>  3 https://data.archives-ouvertes.fr/structure/54063   GEVSM                    
#>  4 https://data.archives-ouvertes.fr/structure/145345  Environnement Ville Soci…
#>  5 https://data.archives-ouvertes.fr/structure/390864  UMR 5600 EVS             
#>  6 https://data.archives-ouvertes.fr/structure/493368  Environnement Ville Soci…
#>  7 https://data.archives-ouvertes.fr/structure/516259  UMR CNRS 5600 EVS-EMSE-G…
#>  8 https://data.archives-ouvertes.fr/structure/516301  Environnement Ville Soci…
#>  9 https://data.archives-ouvertes.fr/structure/520344  EVS-LAURE                
#> 10 https://data.archives-ouvertes.fr/structure/536301  Mines Saint-Etienne, Uni…
#> 11 https://data.archives-ouvertes.fr/structure/540878  Mines Saint-Etienne, Uni…
#> 12 https://data.archives-ouvertes.fr/structure/553708  UMR EVS/EA EIREST        
#> 13 https://data.archives-ouvertes.fr/structure/1029995 MSH UMR EVS LYON         
#> 14 https://data.archives-ouvertes.fr/structure/1030105 UNIVERSITE DE LYON II UM…
#> 15 https://data.archives-ouvertes.fr/structure/1030283 UMR 5600 EVS « ENVIRONNE…
#> 16 https://data.archives-ouvertes.fr/structure/1028810 EVS UMR 5600 LYON FRA    
#> 17 https://data.archives-ouvertes.fr/structure/1027291 ENTSORGUNGSVERBAD SAAR E…
#> 18 https://data.archives-ouvertes.fr/structure/1050501 University of Lyon, UJM-…
#> 19 https://data.archives-ouvertes.fr/structure/1053792 EVS-LAURe                
#> 20 https://data.archives-ouvertes.fr/structure/1098107 AECTT-EVS UMR 5600, Univ…

Created on 2023-09-07 with reprex v2.0.2

@lvaudor I think it's due to the space. Maybe an example to put in the docs?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants