Some data to power the knowledge base. PREFIX : <http://justin.abrah.ms/knowledge_base#> :SteamCooked :title "Steaming" . :KoreanFood :title "Korean Food" ; :linksTo :SteamCooked . :AlternativeMedicine :title "Alternative Medicine" . :Cheong :title "Cheong (food)"; :linksTo :KoreanFood; :linksTo :AlternativeMedicine . <<:Cheong :linksTo :KoreanFood >> :inParagraph "Cheong (청; 淸) is a name for various sweetened foods in the form of syrups, marmalades, and fruit preserves. In Korean cuisine, cheong is used as a tea base, as a honey-or-sugar-substitute in cooking, as a condiment, and also as an alternative medicine to treat the common cold and other minor illnesses." . << :Cheong :linksTo :alternativeMedicine >> :inParagraph "Cheong (청; 淸) is a name for various sweetened foods in the form of syrups, marmalades, and fruit preserves. In Korean cuisine, cheong is used as a tea base, as a honey-or-sugar-substitute in cooking, as a condiment, and also as an alternative medicine to treat the common cold and other minor illnesses." . << :Cheong :linksTo :AlternativeMedicine >> :with "testing" . Query for the paths between a node. PREFIX : <http://justin.abrah.ms/knowledge_base#> SELECT ?midNode WHERE { ?am :title "Alternative Medicine" . ?steam :title "Steaming" . ?am (:linksTo|^:linksTo)* ?midNode . ?midNode (:linksTo|^:linksTo)* ?steam . } That same query, but extract the inParagraph relationship so we know where/how it is connected. PREFIX : <http://justin.abrah.ms/knowledge_base#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> SELECT ?s ?o ?paragraph WHERE { ?am :title "Alternative Medicine" . ?kf :title "Korean Food" . ?term :inParagraph ?paragraph . filter(rdf:isTriple(?term)) . bind(rdf:subject(?term) as ?s) . bind(rdf:object(?term) as ?o) . filter(rdf:subject(?term) = ?midNode) ?am (:linksTo|^:linksTo)* ?midNode . ?midNode (:linksTo|^:linksTo)* ?kf . filter(?midNode = ?s) . }