Solr is a search platform that can serve as both a search engine and a knowledge-graph system. Its built-in graph traversal avoids adding a separate graph database and reduces synchronization and infrastructure overhead. section 5.2
Solr’s faceting API traverses terms to documents and back to terms. Its RelatednessAgg function compares foreground and background document sets, normalizing semantic relatedness from −1 to 1. section 5.4.4
A Solr semantic-knowledge-graph traversal can:
- Start with a term such as “advil” in a document field. section 5.4.4
- Find other terms occurring in documents associated with that term. section 5.4.4
- Rank candidates by semantic relatedness and occurrence constraints. section 5.4.4
Discovering related health terms
A traversal over the Stack Exchange health dataset ranks “motrin,” “aleve,” “ibuprofen,” “naproxen,” and “acetaminophen” as related to “advil.” A Solr JSON faceting request performs the query, applies RelatednessAgg, and sorts the terms by the resulting score. section 5.4.4
Listing 5.4 Discovering semantically related terms to advil
health_skg = get_skg(engine.get_collection("health"))
nodes_to_traverse = [{"field": "body", #1
"values": ["advil"]}, #2
{"field": "body",
"min_occurrences": 2, #3
"limit": 8}] #4
traversal = health_skg.traverse(*nodes_to_traverse) #5
print_graph(traversal, "advil") #6
Inspect the compact traversal listing showing the source field, starting value, occurrence threshold, result limit, and graph display call. section 5.4.4
