我有以下示例三元组
r1 -> property -> resourceA
r1 -> property -> resourceB
r1 -> property -> resourceC
resourceA -> name -> word1
resourceB -> name -> word2
resourceC -> name -> word4
r2 -> property -> resourceD
r2 -> property -> resourceE
r2 -> property -> resourceF
resourceD -> name -> word1
resourceE -> name -> word2
resourceF -> name -> word3
r3 -> property -> resourceG
r3 -> property -> resourceH
r3 -> property -> resourceI
resourceG -> name -> word5
resourceH -> name -> word6
resourceI -> name -> word7
作为参数,我使用 word1 和 word2。我想得到所有的话,包括。word1 和 word2,与 word1 和 word2 一起出现。
此示例的结果必须是:
word1
word2
word3
word4
我真的不知道怎么做这个:(