1

This is my first post,so I'm not sure how to ask the question ,but I have been working on an e-learning website using a classic search engine and a semantic one,I created my ontology,and used ARC2 and fuseki server, and the sparql query works when it comes to searching the keywords like I needed it to . In adition to the search engin, I'm also using a checkbox where the user can select the types of articles they wish to get for their search ,audio,video,pdf ,an image or a word file. While in classic search I used find_in_set and an array,which works perfectly,yet I don't seem to find a way when it comes to the semantic search ,this is my sparql query :

PREFIX  xsd:  <http://www.w3.org/2001/XMLSchema#>
PREFIX  rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX  rdf:  <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX  owl:  <http://www.w3.org/2002/07/owl#>
PREFIX  article: <http://127.0.0.1/Index.php/learning#>
SELECT  *
WHERE
  { ?Publication  article:HasLevel  ?niveau ;
              article:HasLanguage   ?Langue ;
              article:HasType       ?Type ; 
              article:HasDispo      article:Pub ;
              article:Timepub       ?Temps ;
              article:AnneePub      ?Annee ;
              article:AuteurPub     ?Auteur ;
              article:DescriptionPub ?Description ;
              article:FichierPub    ?Fichier ;
              article:IDPub         ?ID ;
              article:TaillePub     ?Taille ;
              article:TitrePub      ?Titre ;
              article:Unipulication  ?Universite ;
              article:PubliéPar     ?Professeur .
              ?Professeur article:NomUti ?NomProf.
              ?Professeur article:PrenomUti ?PrenomProf
    FILTER( 
       REGEX(STR(?Titre), "'.$r.'","i") 
    || REGEX(STR(?Description), "'.$r.'","i"))
  }
  ORDER BY DESC(?Temps)

the $r is for the keyword Do I need to use an other way,or is there a function close to find_in_set for sparql or ARC2?

Wolfgang Fahl
  • 15,016
  • 11
  • 93
  • 186
  • If you just want to search on the expensive string level and regex, why can't you just use standard regex disjunction? E.g. `(term1|term2|term3)`? – UninformedUser Jun 13 '22 at 16:08
  • 1
    I actually tried it before ,but I didn't know what to use for the array ,since in sql I used this:` $choixtype=implode(',',$_POST['choix']);` But your answer helped me figure out what I needed and I replaced the ',' with ' |' ,so thank you so much,it works now – Tala GoldenWolf Jun 13 '22 at 16:39

0 Answers0