3. Metodología
3.3 Análisis y procesamiento de información básica
3.3.2 Obtención de las variables explicativas
Let
v
s be the first entity of an exploration path. The first entityv
s can be any class entity in the graph (i.e. any entity in the subsumption class hierarchy of all entities linked via the subsumption relationship rdfs:subClassOf). Ifv
s is a knowledge anchor (v
s
KADG), then there is no need to identify the closest knowledge anchor (i.e. find another anchor in the data graph), and the subsumption process can start immediately fromv
s. However, ifv
sis not a knowledge anchor (v
sKADG), thenv
s can be superordinate, subordinate, or siblingof one or more knowledge anchors.In this case, an automatic approach for identifying the closest knowledge anchor
v
KA tov
s is required. To find the closest knowledge anchor, we calculate the semantic similarity between vs and every knowledge anchor in the data graph
i
v
KADG. The semantic similarity between two entities in the class hierarchy is based on their distances (i.e. length of data graph trajectory between both entities). Due to the fact that class hierarchies exist in most data graphs, we adopt the semantic similarity metric from [163] and apply it in the context of a data graph. The semantic similarity betweenv
s and a knowledge anchorv
i is calculated as:
)
(
)
(
))
,
(
(
.
2
:
)
,
(
i s i s i sdepth
v
depth
v
v
v
lca
depth
v
v
sim
(5) where, lca(vs,vi)is the least common ancestor ofv
sandv
i, and depth(v) is a function foridentifying the depth of the entity v in the class hierarchy. Algorithm 6.1 describes how the semantic similarity metric is applied to identify the closest knowledge anchor
v
KA tov
s.Algorithm 6.1: Identifying Closest KADG
Input: DG V,E,T, vs V, KADG {v1,v2,..., vi}
Output: vKA –the closest knowledge anchorwith the highest semantic similarity value to
v
s 1. ifv
sKA
DG then // vs is a knowledge anchor2.
v
KA:v
s;3. else // vs is NOT a knowledge anchor
4. S :{}; //list for storing semantic similarity values
5. for all
v
iKA
DG do //for all knowledge anchors6. CA :{}; //list for storing common ancestors of vs and vi
7. L :{} ; //list for storing trajectory lengths
8. CA common _ancestors (vs,vi); //get all common ancestors of vs and vi
9. for all
v
caCA
//for all common ancestors10. L length(vca,vi); //get length of the trajectory between vca and vi 11. end for;
12. vlca:vcawith least length in L; //get least common ancestor of vs and vi
13. ) ( ) ( ) ( 2 i s lca v depth v depth v depth S
; //calculate semantic similarity between vs and vi
14. end for;
15.
v
KA:v
i with maximum semantic similarity value in list S . 16. end if;The algorithm takes a data graph, the first entity vs of an exploration path and a set of knowledge anchors KADG as an input, and identifies the closest knowledge anchor vKA
KADG with highest semantic similarity value to
v
s. If the first entityv
s belongs to the set of knowledge anchors vs
KADG (line 1), then the first entityv
s is identified as the closest knowledge anchor vKA(line 2). However, if the first entityv
s does not belong to the set of knowledge anchors in the data graphv
sKADG (line 3), the following steps are conducted: The algorithm initialises a list S to store semantic similarity values between the vs andevery knowledge anchor
v
i
KADG (line 4). For every knowledge anchor
v
i
KADG (line 5), the algorithm initiates two lists: listCA
for storing the common ancestors (i.e. common superclasses) ofv
s andv
i (line 6), and list L for storing the trajectory lengths between the common ancestors in listCA
and the knowledge anchorv
i (line 7). The algorithm in (line 8) uses a function common _ancestors (vs,vi)which retrieves all
common ancestors of vsand vi in the class hierarchy, and stores them in list
CA
. The function uses the following SPARQL query to retrieve common ancestors ofv
sandv
i: SELECT distinct ?common_ancestorWHERE {
vs rdfs:subClassOf ?common_ancestor. vi rdfs:subClassOf ?common_ancestor }.
For every common ancestor in list
CA
(line 9), the algorithm identifies the length of the data graph trajectories betweenv
i and each of the common ancestorsv
ca inCA
, via the following SPARQL query:SELECT (count(?intermediate)-1 as ?length) WHERE {
v
i rdfs:subClassOf ?intermediate. ?intermediate rdfs:subClassOfv
ca.} The common ancestor vcawith least trajectory length with
v
i in list L is identifies as the least common ancestor vlca (line 12). After that, the semantic similarity metric (Formula 5) is applied (line 13). The metric includes identifying depths of
v
s,v
i , andv
lca . Depth of entityv
is identified using the following SPARQL query:SELECT (count(?intermediate)-1 as ?depth) WHERE {
v
rdfs:subClassOf ?intermediate. ?intermediate rdfs:subClassOf r .} The semantic similarity value is then inserted into the list S (line 13), and the knowledge anchor with the highest similarity value to the first entity