Triple-Pattern Search
Definition 3.4 : Keyword-Augmented Triple Pattern
3.1.3. Query Results
Results to triple-pattern queries are tuples of triples instantiating the query triple patterns and satisfying the query join conditions which are denoted by using the same variable in more than one triple pattern. We first explain what a triple- pattern instantiation is and then show how this can be used to retrieve results to queries consisting of more than one triple pattern.
Definition 3.6 :Mapping
A mapping µ is a partial function VAR→ U ∪ L ∪ B. The domain of µ, dom(µ), is the subset of VAR where µ is defined.
Definition 3.7 : Compatible Mappings
Two mappings, µ1and µ2are said to be compatible if ∀var ∈ dom(µ1)∩dom(µ2), µ1(var) = µ2(var).
Note that two mappings with disjoint domains are always compatible, and that the empty mapping (i.e., the mapping with empty domain) is compatible with any other mapping.
Definition 3.8 : Pattern Instantiation
Let q be a triple pattern, and let VAR(q) be the set of variables occurring in q. A triple t ∈ KB is said to instantiate triple pattern q in knowledge base KB if there exists a
mapping µ such that dom(µ) = VAR(q) and triple t is obtained by substituting each var∈ VAR(q) with µ(var).
For example, consider the triple pattern
?d hasWonPrize Academy Award for Best Director
and consider the mapping µ such that µ(?d) = Woody Allen. Substituting ?d
withWoody Allenresults in the following triple
Woody Allen hasWonPrize Academy Award for Best Director
which is an instantiation of the above triple pattern in the knowledge base shown in Table 3.1. Table 3.2 shows the set of all instantiations of the above triple pat- tern from the knowledge base shown in Table 3.1.
Definition 3.9 : Query Result
Given a triple pattern query Q = (q1, q2, ..., qn)where qi is a triple pattern, possibly augmented with keywords, a result is defined as a tuple T = (t1, t2, ..., tn)consisting of ntriples tisuch that there exist mappings µ1, µ2, ..., µnwhich are all pairwise compati- ble and ti instantiates qi by substituting each var ∈ VAR(qi)with µi(var).
For example, consider the following query consisting of three triple patterns
?d hasWonPrize Academy Award for Best Director ?d directed ?m
?d actedIn ?m
Table 3.3 shows the results to such query when run against the knowledge base in Table 3.1. All results are tuples consisting of three triples where the first triple is an instantiation of the first query triple-pattern, the second triple is an instan- tiation of the second query triple-pattern and the third triple is an instantiation of the third query triple-pattern. Moreover, each result tuple satisfies the join conditions specified in the query which requires that the subject of all the three triples be the same and the objects of the second and third triples be the same.
Results to keyword-augmented queries are defined in a similar way. They are also tuples of triples instantiating the query triple patterns and satisfying the join conditions specified in the query. In addition, the triples must also satisfy any keyword conditions specified in the triple pattern they instantiate . Recall
3.1. Query Framework
Q ?d hasWonPrize Academy Award for Best Director ?d directed ?m
?d actedIn ?m
R1 Woody Allen hasWonPrize Academy Award for Best Director
Woody Allen directed Annie Hall Woody Allen actedIn Annie Hall
R2 Mel Gibson hasWonPrize Academy Award for Best Director
Mel Gibson directed Braveheart Mel Gibson actedIn Braveheart
R3 Jules Dassin hasWonPrize Academy Award for Best Director
Jules Dassin directed Rififi Jules Dassin actedIn Rififi
Table 3.3.: Results of an example query as tuples of triples
that each triple in a keyword-augmented knowledge base is associated with a text snippet which is constructed from any contextual text present in the sources the triples were extracted from. Now, given a keyword-augmented query, the results are tuples of triples that instantiate the query triple patterns and in addi- tion, whose text snippets satisfy the keyword conditions specified in the query.
For example, consider the following keyword-augmented query asking for scandalous directors that have won the Academy Award for Best Director, and movies they directed and in which they also acted:
?d hasWonPrize Academy Award for Best Director scandal controversy ?d directed ?m
?d actedIn ?m ”major role”
One possible result to such query is the tuple:
Mel Gibson hasWonPrize Academy Award for Best Director Mel Gibson directed Braveheart
Mel Gibson actedIn Braveheart
provided that the text snippet of the first triple contains the keywordscandalor
Figure 3.1.: A query as a graph (above) and one result (below) as a subgraph of the RDF graph
In graph terminology, a triple-pattern query can be viewed as a graph whose vertices v ∈ U ∪ L ∪ B ∪ VAR and whose edge labels e ∈ U ∪ VAR. Similarly, a query result can be viewed as a subgraph of the RDF knowledge graph queried, that is isomorphic to the query graph when query variables are mapped to URIs or literals that appear in the RDF graph. Figure 3.1 shows an example query and one of its result as graphs.
Next, we motivate why result ranking is crucial, and we present a novel rank- ing model for triple-pattern queries, possibly augmented with keywords.