• No se han encontrado resultados

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 entity

v

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). If

v

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 from

v

s. However, if

v

sis not a knowledge anchor (

v

sKADG), then

v

s can be superordinate, subordinate, or sibling

of one or more knowledge anchors.In this case, an automatic approach for identifying the closest knowledge anchor

v

KA to

v

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 between

v

s and a knowledge anchor

v

i is calculated as:

)

(

)

(

))

,

(

(

.

2

:

)

,

(

i s i s i s

depth

v

depth

v

v

v

lca

depth

v

v

sim

(5) where, lca(vs,vi)is the least common ancestor of

v

sand

v

i, and depth(v) is a function for

identifying 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 to

v

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. if

v

s

KA

DG then // vs is a knowledge anchor

2.

v

KA

:v

s;

3. else // vs is NOT a knowledge anchor

4. S :{}; //list for storing semantic similarity values

5. for all

v

i

KA

DG do //for all knowledge anchors

6. 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

ca

CA

//for all common ancestors

10. 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 entity

v

s belongs to the set of knowledge anchors vs

KADG (line 1), then the first entity

v

s is identified as the closest knowledge anchor vKA(line 2). However, if the first entity

v

s does not belong to the set of knowledge anchors in the data graph

v

sKADG (line 3), the following steps are conducted:  The algorithm initialises a list S to store semantic similarity values between the vs and

every knowledge anchor

v

i

KADG (line 4).

 For every knowledge anchor

v

i

KADG (line 5), the algorithm initiates two lists: list

CA

for storing the common ancestors (i.e. common superclasses) of

v

s and

v

i (line 6), and list L for storing the trajectory lengths between the common ancestors in list

CA

and the knowledge anchor

v

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 of

v

sand

v

i: SELECT distinct ?common_ancestor

WHERE {

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 between

v

i and each of the common ancestors

v

ca in

CA

, via the following SPARQL query:

SELECT (count(?intermediate)-1 as ?length) WHERE {

v

i rdfs:subClassOf ?intermediate. ?intermediate rdfs:subClassOf

v

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 , and

v

lca . Depth of entity

v

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

v

s will be identified as the closest knowledge anchor

v

KA (line 15). Implementation example can be found here56.