java - Semantic relations between set of words -
if have set of words (dbpedia resources) storing in arraylist how can build sparql query find possible direct on indirect relation between these terms? major problem don't know what's relation type i'm searching for.
suppose arraylist contains 3 words, france,paris, europe how can write query returns direct relation (or indirect relation of 2 hops) between france-paris ,paris-europe , france-europe
hope clear i'm looking for
what can use values
set variable set of resources, twice, once each end of relation. use variable predicate find relation is. like:
select ?resource1 ?p1 ?intermediary ?p2 ?resource2 { values ?resource1 { :paris :france :europe } values ?resource2 { :paris :france :europe } filter(?resource1 != ?resource2) { ?resource1 ?p1 ?resource2 } union { ?resource1 ?p1 ?intermediary. ?intermediary ?p2 ?resource2. } }
the results are:
Comments
Post a Comment