ordia
ordia copied to clipboard
Determine most similar words: odd-one-out
SELECT DISTINCT
?form1 ?word1 ?form2 ?word2
(COUNT(DISTINCT ?grammatical_feature) +
COUNT(DISTINCT ?lexical_category) +
COUNT(DISTINCT ?value) +
COUNT(DISTINCT ?concept_property)
AS ?score)
(GROUP_CONCAT(DISTINCT STR(?grammatical_feature)) AS ?f1)
(GROUP_CONCAT(DISTINCT STR(?lexical_category)) AS ?f2)
(GROUP_CONCAT(DISTINCT STR(?value)) AS ?f3)
(GROUP_CONCAT(DISTINCT STR(?concept_property)) AS ?f4)
WHERE {
hint:Query hint:optimizer "None".
VALUES ?word1 { "sjov"@da "dårlig"@da "vanvittig"@da "papir"@da }
VALUES ?word2 { "sjov"@da "dårlig"@da "vanvittig"@da "papir"@da }
?form1 ontolex:representation ?word1 .
?form2 ontolex:representation ?word2 .
?lexeme1 ontolex:lexicalForm ?form1 .
?lexeme2 ontolex:lexicalForm ?form2 .
OPTIONAL {
?grammatical_feature ^wikibase:grammaticalFeature ?form1, ?form2 .
}
OPTIONAL {
?lexical_category ^wikibase:lexicalCategory ?lexeme1, ?lexeme2 .
}
OPTIONAL {
?lexeme1 ?lexeme_property ?value .
?lexeme2 ?lexeme_property ?value .
[] ?ref ?lexeme_property ; rdf:type wikibase:Property .
}
OPTIONAL {
?lexeme1 ontolex:sense / wdt:P5137 ?concept1 .
?lexeme2 ontolex:sense / wdt:P5137 ?concept2 .
?concept1 ?concept_property ?concept_value .
?concept2 ?concept_property ?concept_value .
?concept_property a owl:ObjectProperty .
}
FILTER (STR(?word1) != STR(?word2))
}
GROUP BY
?form1 ?word1 ?form2 ?word2
ORDER BY DESC(?score)