0

I am trying to retrieve from Dbnary database based on dbpedia all words belongigs to categorie of noun, adjectif, adverb and verb and their synonyms.

So far I get can access it just for one categorie but I would like to know how to improve my query to get all words from the 4 categories and their synonym with only one query rather than making one query per category (i.e 4 query and 4 files)

#Query for noun which work 

SELECT DISTINCT * where {
?l a ontolex:LexicalEntry;
lime:language "fr";
ontolex:canonicalForm ?f ;
lexinfo:partOfSpeech lexinfo:noun ;
ontolex:sense ?s .


?f ontolex:writtenRep ?w .
OPTIONAL { ?l dbnary:synonym ?syn ; rdfs:label ?synonyme .}
}

LIMIT 100

This query work , you can test it since dbnary in online : http://kaiko.getalp.org/sparql

but I wanted to upgrade the query below. When adding the following line on the previous query, it does not work :

#lexinfo:partOfSpeech lexinfo:verb ; 

Any help will be fine.

emma
  • 193
  • 2
  • 13
  • just adding the triple indeed doesn't work because logically this is the intersection or "and". What you want is a union or "or" - there are multiple ways to achieve this, e.g. by means of a filter: `FILTER (?pos in (lexinfo:noun, lexinfo:verb))` and write `lexinfo:partOfSpeech ?pos; ` - or you can provide those POS tags as inline data via `VALUES ?pos {lexinfo:noun lexinfo:verb}` - or you use a good old `UNION`, i.e. `{?l lexinfo:partOfSpeech lexinfo:noun } UNION {?l lexinfo:partOfSpeech lexinfo:verb }` – UninformedUser Nov 05 '21 at 10:15
  • Thank you, but I do not understand How to insert those lines ? Should I pout them after the optional parameter – emma Nov 18 '21 at 15:42

0 Answers0