Extraction Patterns to Derive Social Networks from Linked Open Data using SPARQL †

: Linked Open Data (LOD) refers to freely available data on the World Wide Web that are typically represented using the Resource Description Framework (RDF) and standards built on it. LOD is an invaluable resource of information due to its richness and openness, which create new opportunities for many areas of application. In this paper, we address the exploitation of LOD by utilizing SPARQL queries in order to extract social networks among entities. This enables the application of de-facto techniques from Social Network Analysis (SNA) to study social relations and interactions among entities, providing deep insights into their latent social structure.


Introduction
This paper is an extension of an already published conference paper [1], where we investigated how to extract social networks from Linked Open Data. In recent years, the Web has evolved from a network of linked documents to one where both documents and data are linked, resulting in what is commonly known as the Web of Data. Underpinning this evolution is a set of best practices known as Linked Open Data (LOD) [2], which provide mechanisms for publishing and connecting structured data on the Web in a machine-readable form with explicit semantics. Recently, Linked Open Data has evolved from an academic endeavor into one that has been embraced by numerous governments and industrial stakeholders.
Due to the creation of an increasing number of publicly available Linked Open Data resources, the Web of Data has become a major application area for semantic technologies. Currently, the so-called LOD cloud contains over 1200 datasets, with billions of facts from many different domains like geography, media, biology, chemistry, economy, energy, etc., and millions of links among entities (http://lod-cloud.net). Examples of large LOD datasets are DBpedia [3,4] (3.4 million entities, 1 billion facts), and YAGO [5] (17 million entities, 150 million facts).
All such data are typically represented using the Resource Description Framework (RDF) which is the World Wide Web Consortium's (W3C) standard language for representing information in the Semantic Web [6,7]. RDF is based on a directed graph data model, where both nodes and edges are labeled. An RDF graph is a set of triples of the form (s, p, o), which can be interpreted as edges labeled by p (the predicate) from nodes labeled by s (the subject) to nodes labeled by o (the object). The elements of a triple are typically Internationalized Resource Identifiers (IRIs)-global names that uniquely identify resources on the Web. SPARQL, which became a W3C recommendation in 2008, is the standard query language for RDF [8,9]. Recently, a new version of the SPARQL query language, called SPARQL 1.1, has been standardized by W3C. It addresses some of the limitations of the original language by introducing a wide range of constructs [10].
The increasing adoption of Linked Open Data is turning the Web into a global data space that connects data from diverse domains and enables genuinely novel applications. The richness and openness of Linked Open Data make it an invaluable resource of information, and creates new opportunities for many areas of application. For instance, in this present work, we address the exploitation of Linked Open Data in order to extract social networks among entities. This will enable the application of de-facto techniques from Social Network Analysis to study social relations and interactions among entities, providing deep insights into their latent social structure.
Social Network Analysis (SNA) refers to the collection of methods, techniques, and tools in sociometry aiming at the analysis of social networks. There is an abundance of tools allowing for the analysis and visualization of such networks. A social network may be dense or not, the "social distances" among individuals may be short or long, etc. An individual may be "central" (directly linked to many other individuals) or an "isolate" (not linked to others). However, more subtle notions are also possible, e.g., an individual who is only linked to people having many relationships is considered to be a more powerful node in the network than an individual having many connections to less connected individuals.
The work presented in this paper is an attempt to bring together the two research areas of Linked Open Data and Social Network Analysis. The main idea is to derive social networks from large datasets of linked open data, such that extracted networks become a fresh material for study and analysis, while at the same time forming an additional asset of knowledge added to linked open data.
The main contributions of this present paper are the following: • We propose several techniques to extract social networks from linked open data. • We express those techniques in a formal way using SPARQL algebra.

•
We present formal translations into social networks.

•
We present several case studies that apply some of the presented techniques.
The paper is organized as follows. Section 2 presents a motivation example that demonstrates the importance of the proposed approach, while Section 3 gives an overview of relevant previous work. Section 4 provides a background on social networks and SPARQL algebra. Sections 5 and 6 are the core of this paper, introducing network extraction patterns for complete networks as SPARQL queries. Then, a generic translation method that transforms query results into networks is presented in Section 7. Section 8 concludes the paper with an overall discussion.

Motivation
To motivate our work, we consider the relation between actors and movies they acted in. In the YAGO dataset, this relation is expressed using the yago:actedIn predicate, which relates an actor (subject) to a movie (object) he/she acted in. Table 1 shows a subset of RDF triples from the YAGO dataset about this relation. Thus, we can visually represent this relation as a two-mode affiliation network (two types of nodes). Figure 1 demonstrates a smaple of such a network obtained from triples in Table 1.
More interestingly, indirect relations can be derived from this two-mode affiliation relation. That is, two-mode networks are often transformed into one-mode networks (only one type of nodes) using a procedure which is often referred to as projection [11,12]. Projection is done by selecting one of the sets of nodes and linking two nodes from that set if they are connected to the same node (of the other kind). In the case of actors and movies, we can derive an actor-actor relationship if they act in the same movie. For example, Jodie Foster and Matthew McConaughey would be connected as they have acted in the movie Contact. Traditionally, the ties in projected one-mode networks do not have weights attached to them. However, recent empirical studies of two-mode networks have created a weighted one-mode network by defining the weights as the number of co-occurrences (e.g., the number of movies in which two actors have co-acted). Figure 2 shows the co-acting network derived from the actor-movie two-mode network. For instance, the connection between Penolope Cruz and Steve Zahn has a weight of 2 as they acted in two movies: Sahara and Bandidas.  The purpose of this present work is to investigate possible ways to extract such social networks from linked open data (expressed in RDF), and to present such ways as systematic techniques using: (1) SPARQL queries formally expressed in SPARQL algebra, and (2) formal transformations of the query results into networks.

Related Work
The richness and openness of Linked Open Data, as well as the inter-linking of the many datasets, known as LOD cloud, make it an invaluable resource of information, and create new opportunities for many areas of application. This leads to an increasing adoption of LOD by the scientific community, and several sectors of industry [13]. Among others, one of the major factors that foster the evolution and adoption of LOD is the semantic technologies (RDF [7], OWL [14], and SPARQL [10]) standardized by W3C. Being structured using a standard data format (RDF), the consumption of Linked Open Data is facilitated with SPARQL, a standard query language, and protocol to access RDF datasets. SPARQL is based on a solid background with respect to its syntax and semantics [9] (see Section 4.2 below). The large amount of RDF data available on the Web is exposed by means of (a) Linked Data-enabled dereferenceable URIs in various formats (such as RDF/XML, Turtle, RDFa, etc.) and by (b) SPARQL endpoints (SPARQL endpoints are RESTful web services that accept SPARQL queries over HTTP adhering to the SPARQL protocol, as defined by the respective W3C recommendations [15]). Most of the LOD datasets are interlinked, which allows navigating through them and facilitates building complex queries by combining data from different, sometimes heterogeneous and often physically distributed datasets. To address this use case, the W3C recommendation defines a federation extension [16] for SPARQL 1.1 [10], which allows for combining graph patterns that can be evaluated over several endpoints within a single query [15].
Several areas of application are increasingly benefiting from the large amount of RDF data available in the Web of Data, and exploiting their potential power. For instance, Recommender Systems are among such applications consuming Linked Open Data. Passant [17] proposes a Music recommender system, called drec, which is built on top of DBpedia. Di Noia et al. [18] develop a content-based recommender system that leverages the data available within Linked Open Data datasets in order to recommend movies to the end users.
Some works seek to combine social analytics with the Linked Open Data (LOD) cloud. De Vocht et al. [19] propose a semantically driven aggregation of social data, where they use semantic technologies, common vocabularies, and Linked Open Data to extract and mine the data about scientific events out of context of microblogs (e.g., Twitter). As a proof-of-concept, they implement and evaluate a researcher profiling use case. Razis et al. [20,21] propose an ontology schema towards linking semantified Twitter social analytics with the Linked Open Data cloud. The ontology is deployed over a publicly available service that measures how influential a Twitter account is by combining its social activity in Twitter. They also introduce in [22] a methodology for discovering and suggesting similar Twitter accounts, based entirely on their disseminated content in terms of used Twitter entities (mentions, replies, hashtags, URLs). The methodology is based on semantic representation protocols and related technologies. An ontological schema is also described towards the semantification of the Twitter accounts and their entities.
Several works in the literature have already attempted to combine Social Network Analysis with semantic technologies. For instance, Flink [23] is an early system for the extraction, aggregation, and visualization of online social networks. Flink employs semantic technology for reasoning with social information aggregated from disparate sources: web pages, emails, publication archives, and FOAF profiles. Martin et al. [24] propose a model to represent social networks in RDF and show how SPARQL can be used to query and transform networks. However, the proposed data model is unnecessarily complex as relations among nodes are represented as RDF resources, hence additional predicates are introduced to link nodes to the relations. Moreover, at that time, aggregation was missing in SPARQL, therefore SQL is used in the model. Other works have been proposed to use SPARQL and other semantic technologies not only to represent social networks, but also to perform social network analysis [25][26][27]. However, all the aforementioned works use semantic technologies to represent social networks and/or to perform social network analysis. Unlike our work, none of them extract social networks from RDF datasets (LOD). Our work focuses on network extraction patterns from RDF, not on representing the networks themselves.
Groth and Gil [28] present an approach for extracting networks from Linked Data, where extracted networks can then be analyzed through network analysis algorithms, and the results of these analyses can be published back as Linked Data. Zehetner [29] proposes in his dissertation a framework, called SocioCatcher, to extract and analyze social networks from DBpedia. However, both of these works focus on the system and its computational workflows, without a solid theoretical basis and formalism of extraction patterns as we do in our present work.

Social Networks
"A social network consists of a finite set or sets of actors and relation or relations defined on them." ( [30]). Social networks can be classified based on the set of actors and their environment into: (1) complete networks, and (2) ego centered networks. A complete network addresses an entire population, where the individuals define each other's environment [11]. Ego-centric networks address an identified individual (ego) and his environment. When we deal with social networks extracted from LOD, we also distinguish between complete and partial networks [11]. Complete networks cover an entire population of individuals in the entire dataset, whereas a partial network would cover a subset of the population defined by means of a specific context, e.g., time, location, or gender, etc. For example, let us consider a co-acting relationship among actors who acted in same movies. When we extract all co-acting relations among all actors (as defined in the dataset), we obtain a complete network, while when we extract such relations for Indian actors only, or for movies produced in the 1990s, we obtain a partial network. Moreover, when we extract such relations for Jodie Foster and her co-actors, we obtain an ego-centric network [11].
Typically, networks are represented in terms of graphs. A graph G is a pair (V, E) that consists of a set V of vertices, and a set E of edges. While the elements of V represent the actors of the network, the ties among them are represented in E. Therefore, an edge is simply a pair of vertices If the relation between a pair of vertices i, j ∈ V is asymmetric, we say the edges are directed (and so is the network). Otherwise, the edges are bidirectional and the network is said to be undirected. Relations among vertices could have a sort of strength, in this case, edges are given numeric weights, and we say the network is weighted. A weighted network is represented as a triple G = (V, E, ω) where: ω is a function ω : E → R that maps edges to their weight values.
In Social Network Analysis literature, many metrics (indices) have been developed to characterize social networks, at both (a) node level, such as: (in-, out-) degree, and centrality (closeness, betweenness), and (b) network level, such as: density, diameter, average degree, average path length, and average clustering coefficient [30]. Moreover, advanced analysis can also be applied onto social networks, including for example: community detection, diffusion dynamics, and link prediction.

SPARQL Algebra
Let I, L, and B be pairwise disjoint sets of IRIs, literals, and blank nodes, respectively, where literals can be numbers, strings, or Boolean values. The set T of (RDF) terms is I ∪ L ∪ B. An RDF triple is an element (s, p, o) of (I ∪ B) × I × T, with s called the subject, p the predicate, and o the object. An RDF graph is a finite set of RDF triples.
We adopt the SPARQL algebra from Kaminski et al. [31,32], which is based on the SPARQL 1.1 specification [10], and presents a formalisation that makes ambiguous aspects of the specification precise. We distinguish three types of building blocks: expressions, patterns, and queries that are built over terms T and an infinite set X = {? x, ? y, · · ·} of variables, disjoint from T.
Expressions in SPARQL are inductively defined as follows: • all variables in X and all terms in I ∪ L are expressions; if E 1 and E 2 are expressions, then so are: Patterns in SPARQL are inductively defined as follows: • a basic graph pattern (BGP) is a set of triple patterns, that is, elements of the set • Join(P 1 , P 2 ), Union(P 1 , P 2 ) and SetMinus(P 1 , P 2 ) are patterns if P 1 and P 2 are patterns; • Filter(E, P) is a pattern if P is a pattern and E is an expression; • Le f tJoin(E, P 1 , P 2 ) is a pattern if P 1 and P 2 are patterns and E is an expression; • GroupAgg(Z,?x, f , E, P), where Z is a set of variables, called grouping variables, ?x is a variable called aggregation variable, f is an aggregate function, E is an expression, and P is a pattern; • Extend(?x, E, P) is a pattern (which captures BIND and VALUES constructs), where ?x is a variable, E is an expression, and P is a pattern; The construct GroupAgg is close to the grouping operator in the relational algebra, where Z represents the set of grouping variables, ? x is the fresh variable storing the aggregation result, f is the aggregate function (such as: Count, Sum, Avg, Min, or Max), and E is the expression (often a variable) we are aggregating over.
Queries in SPARQL are expressions of the form Project(X, P) or Distinct(Project(X, P)), for P a pattern and X a set of variables (called free variables).
The semantics of SPARQL is defined in terms of (solution) mappings that is, partial functions µ from variables X to terms T. The domain of µ, denoted dom(µ), is the set of variables over which µ is defined. The solution of a SPARQL query Q over an RDF graph G is a multiset of mappings M = vPw G , where v.w G is an evaluation function that maps queries and RDF graphs to multisets of solution mappings.

Network Extraction Techniques
In this section and the next one, we introduce techniques for extracting complete social networks from LOD using SPARQL. Those techniques are basically based on identification of common RDF triple patterns and how the network ties are inferred from such patterns.
We classify those techniques based on the number of predicates and number of RDF triples in a pattern. We start in this section with patterns having one predicate p, where we present possible patterns composed of one and two RDF triples, all having p as predicate ( Figure 3). Then, in the next section, we discuss patterns having two predicates p, q, where we present possible patterns for two, three, and four RDF triples having p, q predicates.

Extraction Using One Predicate
We start with patterns having one predicate p ∈ I. We present the possible patterns composed of one, and two RDF triples, having p as predicate.

Pattern with One Triple (Direct Extraction)
Given certain predicate p ∈ I, let ? u, ? v ∈ X be two variables, then the BGP (? u, p, ? v) represents a direct relation (tie) from a node represented by ? u to a node represented by ? v using the predicate p, as shown in Figure 3a. We call this case: Direct Extraction. Thus, to extract all such ties among nodes in the RDF graph using p, the following SPARQL query can be used: which can be translated into SPARQL syntax as: The extracted relation in this case is always directional, i.e., the order of nodes does matter (Unless the predicate p is symmetric, such as yago:isMarriedTo, then the relation becomes bidirectional). This means the extracted social network will be a directed network. In this type of extraction, one tie in the network is extracted from one triple in the RDF graph. Example 1. The YAGO dataset has a predicate yago:influences that relates persons to others who have influence on them (on their opinions or work). To extract a social network based on this influence relationship, we can use this query: The extracted network has been analyzed in [33].

Patterns with Two Triples
Social networks can be indirectly extracted from RDF data when the relation is implicit in the RDF graph. A tie between two nodes can be derived from several triples, as we saw in the motivation example (Section 2). When we derive a tie between two nodes using two RDF triples, it does matter where the positions of those nodes in the RDF triples are: subject-subject, object-object, subject-object, or object-subject. Therefore, we distinguish three derivation patterns (variants), namely: in-2-star, out-2-star, and chain.

In-2-Star
A tie between two nodes u, v is derived when both nodes are linked to a third node o, that is, when u and v are in the subject position of two RDF triples having the same object o and the same predicate p (Figure 3b). This pattern (u, p, o), (v, p, o) is named in-2-star because it resembles a star network whose center is o and has 2 peripheries u, v directed in-to the center: The following SPARQL query can be used to extract all such ties among nodes in the RDF graph using a predicate p ∈ I, and three variables ? u, ? v, ? o ∈ X: which can be translated into SPARQL syntax as: In this case, the derived relation is bidirectional; therefore, in contrast to direct extraction, derivation using the same predicate with in-2-star pattern always yields undirected networks.

Example 2.
The DBpedia dataset has a predicate dbo:almaMater that relates people to academic institutions they studied in. This predicate can be used to derive a so-called alumni relationship among people who attended the same university. The following query can be used for this purpose: Networks derived by the same predicate can be weighted when the number of co-occurrences of the in-2-star pattern is taken into consideration. For instance, in co-acting network, the weight of a tie between two actors is the number of movies they commonly acted in. In order to express this relation in a SPARQL query, we need a group-aggregation algebraic pattern. Kaminski's SPARQL algebra provides GroupAgg(Z, ? x, f , E, P) pattern for this purpose, where Z is the set of grouping variables, ? x is aggregation variable, f is aggregation function, E is aggregation expression, and P is a pattern. Thus, the query needed to extract a weighted network using derivation by the same predicate with in-2-star pattern can be written as: In this query, the list of grouping variables is Z = ? u, ? v (as we want to count the number of their co-occurrences), the aggregation variable is ? w, a fresh variable to store the weight of the tie, the aggregation function f is Count, the aggregation expression is simply the variable ? o, and the pattern P is {(? u, p,

Out-2-Star
With out-2-star pattern, a tie between two nodes u, v is derived when both nodes have incoming links from a third node s, that is, when u and v are in the object position of two RDF triples having the same subject s and the same predicate p (Figure 3c). This pattern (s, p, u), (s, p, v) is named out-2-star because it resembles a star network whose center is s and has 2 peripheries u, v directed out from the center: u ← s → v.
The following SPARQL query can be used to extract all such ties among nodes in the RDF graph using a predicate p ∈ I, and three variables ? u, ? v, ? s ∈ X: In this case, the derived relation is also bidirectional, and hence the extracted network is undirected. This query can be translated into SPARQL syntax as:  Weighted networks can also be extracted using this pattern by taking into consideration the number of co-occurrences. The corresponding SPARQL query is as follows:

Chain
In the chain pattern, a tie between two nodes u, v is derived when there is a chain of two links starting from one of these nodes, ending at the other, and traversing a third node x. This case for instance occurs when u is the subject of a triple, v is the object of another triple, and x is the object of the first triple and the subject of the other, and, of course, p is the predicate in both triples. This pattern (u, p, x), (x, p, v) is named chain because it resembles to a chain starting at u, traversing x, and ending at v: u → x → v. The SPARQL query used to extract all such ties using a predicate p ∈ I, and three variables ? u, ? v, ? x ∈ X is: Syntactically, the query can be expressed as: In this case, the derived relation is directed according to the original direction of links in the RDF triples. For example, the extracted tie is directed from u to v because u is the subject of the first triple and v is the object of the other one. Therefore, similar to direct extraction, derivation using the same predicate with chain pattern always yields directed networks. The two triples {(? u, p, ? x), (? x, p, ? v)} can be merged using a property sequence path [10], yielding the triple pattern (? u, p/p, ? v) as a result. This is possible because the variable ? x serves as the object of the first triple, and as the subject of the second. Hence, the query can be expressed as: Sometimes, depending on the predicate p, the extracted network using chain pattern could be weighted. The corresponding SPARQL query is as follows (with the aggregation expression being ? x ):

Extraction Using Two Predicates
In this section, we continue with patterns having two predicates p, q ∈ I. We present the possible patterns composed of two, three, and four RDF triples, having p and q predicates.

Patterns with Two Triples
In this type of derivation, a tie is extracted from two RDF triples having two different predicates p, q ∈ I. Similarly to derivation using same predicate, we distinguish three patterns according to the positions of nodes in the triples, namely: in-2-star, out-2-star, and chain.

In-2-Star
This pattern is similar to the in-2-star pattern in derivation using same predicate: a tie between two nodes u, v is derived when both nodes are linked to a third node o, that is, when u and v are in the subject position of two RDF triples having the same object o (Figure 4a). However, the difference here is that the two triples have different predicates p and q, thus the basic graph pattern is: {(u, p, o), (v, q, o)}. The following SPARQL query can be used to extract all such ties among nodes in the RDF graph using two predicates p, q ∈ I, and three variables ? u, ? v, ? o ∈ X: In contrast to the in-2-star variant of same-predicate-derivation where the derived relation is bidirectional, here the in-2-star variant of derivation by different predicates is uni-directional, not because of the positions of nodes in the RDF triples (as in direct extraction, or chain variant) but because of the difference of predicates. In fact, one of the predicates can be considered as primary and the other as secondary, for instance, the primary predicate is more important than, or has a priority over, the secondary one. Thus, the derived tie between nodes would be directed from the subject of the triple with the primary predicate to the subject of the triple with the secondary predicate. Let us clarify this idea with an example.

Example 6.
The YAGO dataset has two predicates yago:exports and yago:imports that relate countries to products they export and import, respectively. These predicates can be used to derive a so-called commercial-dependency relationship among countries. If we want the relation to be such that a country is linked to another when the former exports a product imported by the later, then we consider exports predicate as primary, and imports as secondary, hence, the corresponding query is: In this case, the tie from u to v means that u has v as dependent. However, we could instead consider imports as primary and exports as secondary, here the derived tie from u to v would mean that u depends on v.
A weighted version of in-2-star variant of derivation using different predicates can be given by the following SPARQL query:

Out-2-Star
This pattern is similar to the out-2-star pattern in derivation using same predicate: a tie between two nodes u, v is derived when both nodes have incoming links from a third node s that is, when u and v are in the object position of two RDF triples having the same subject o. However, the two triples have different predicates p and q, thus the basic graph pattern is: {(s, p, u), (s, q, v)}.
The following SPARQL query can be used to extract all such ties among nodes in the RDF graph using two predicates p, q ∈ I, and three variables ? u, ? v, ? s ∈ X: It can be written in SPARQL syntax as: In this type of derivation, the extracted network is directed, and can be weighted. A weighted network can be extracted using this query: which can be syntactically expressed as:

Chain
This pattern is similar to the chain pattern in derivation using the same predicate. A node u is tied to another node v when: (1) u is the subject of a triple, (2) v is the object of another triple, and (3) x is the object of the first triple and the subject of the other. However, here the predicates of the triples are different: p and q. Thus, the pattern can be expressed as: (u, p, x), (x, q, v), and the SPARQL query used to extract all such ties is: which can be expressed in SPARQL syntax as: Here, the network is also directed and can be weighted. The query for the weighted version is:

Patterns with Three Triples
Among different possible patterns of two predicates and three triples, we chose to present two common patterns as shown in Figure 5.

Parallel-In
In this pattern, a tie is extracted from a node u to another one v, when both nodes have in-links (they are in object position in two triples with predicate p) from two other intermediary nodes x and y that are linked to each other using the other predicate q. Thus, the pattern is: (x, p, u), (y, p, v), (x, q, y). Given the two predicates p, q ∈ I, and four variables u, v, x, y ∈ X, the corresponding query is: ({? u, ? v}, {(? x, p, ? u), (? y, p, ? v), (? x, q, ? y)}) (14) which can be syntactically written as: The extracted relation is directional, such that the direction of the extracted tie (from u to v) is the same direction (parallel) of the relation between the corresponding intermediary nodes (from x to y). Example 11. The Bibliographic Ontology (http://bibliographic-ontology.org/) provides main concepts and properties for describing citations and bibliographic references on the Semantic Web. The predicate dc:contributor relates a document to its author, while bibo:cites relates a document to another document that cites the first document. Thus, using these predicates, we can extract a citation social network among authors, such that it relates an author to another one when the first writes a document that cites a document written by the second author. This network is extracted using the following query: A weighted social network can also be extracted using parallel-in when we consider the number of co-occurrences of the intermediary relations (?x, q, ?y). The corresponding query is:

Parallel-Out
In this pattern, a tie is extracted from a node u to another one v, when both nodes have out-links (they are in subject position in two triples with predicate p) to two other intermediary nodes x and y that are linked to each other using the other predicate q. Thus, the pattern is: (u, p, x), (v, p, y), (x, q, y). The extracted relation is directional. The corresponding query is: and the weighted version is:

Patterns with Four Triples
Among different possible patterns of two predicates and four triples, we chose to present four common patterns as shown in Figure 6. Networks extracted using these patterns are undirected and can be weighted when the number of co-occurrences is considered; however, we will not provide weighted versions for the sake of brevity.

Straight in-2-Star
In this pattern, we extract a bidirectional tie between two nodes u and v if they are linked (using one predicate p) to two other nodes x and y that are in turn linked to a fifth node o using another predicate q (Figure 6a). This pattern (? u, p, ? x), (? v, p, ? y), (? x, q, ? o), (? y, q, ? o) is named so because the intermediary nodes make an in-2-star pattern, and receive straight links from u, v using p (same direction as q). The corresponding query is then: The corresponding syntactic query is written as:

Example 12.
In the DailyMed dataset (https://dailymed.nlm.nih.gov/dailymed/), the predicate dailymed:producesDrug relates a pharmaceutical company to a drug it produces, and the predicate dailymed:activeIngredient relates a drug to its active ingredient. Using these two predicates, we can extract a social network of competing pharmaceutical companies where competition is defined by selling drugs with the same active ingredient [28]. The required query can be written as: where u and v are companies producing x and y drugs, respectively, and the drugs both have the same active ingredient o.

Revert in-2-Star
In this pattern, we extract a bidirectional tie between two nodes u and v if they have links (using one predicate p) from two other nodes x and y that are in turn linked to a fifth node o using another predicate q (Figure 6b), thus the pattern is: (? x, p, ? u), (? y, p, ? v), (? x, q, ? o), (? y, q, ? o). This pattern is similar to the previous one. However, the links of predicate p are not in the same direction as those of q (hence the name revert). The corresponding query is then: ({? u, ? v}, {(? x, p, ? u), (? y, p, ? v), (? x, q, ? o), (? y, q, ? o) The corresponding syntactic query is written as: ? y p ? v ; q ? o . } Example 13. The Bibliographic Ontology has a predicate bibo:presentedAt that relates a document to an event-for example, a paper to a conference. Thus, using this predicate and dc:contributor that relates a document to his author, we can extract a social network among authors whose papers are presented at the same event. The required query can be written as: (? x, dc:contributor, ? u), (? y, dc:contributor, ? v) } )

Straight Out-2-Star
In this pattern, we extract a bidirectional tie between two nodes u and v if they have links (using one predicate p) from two other nodes x and y that in turn have links from a fifth node s using another predicate q (Figure 6c). This pattern is denoted (? x, p, ? u), (? y, p, ? v), (? s, q, ? x), (? s, q, ? y), and is named so because the intermediary nodes make an out-2-star pattern, and send straight links out to u, v using p (same direction as q). The corresponding query then is: Syntactically, the query can be written as follows, using a property sequence path q/p: SELECT ? u ? v WHERE { ? s q / p ?u , ? v . }

Revert Out-2-Star
In this pattern, we extract a bidirectional tie between two nodes u and v if they are linked (using one predicate p) to two other nodes x and y that in turn have links from a fifth node s using another predicate q (Figure 6d Table 2 also provides an overview of those extraction patterns. Note that, in all these techniques, an extracted tie is always denoted with variables ? u and ? v, and that when the network is directed the direction of the tie is always from ? u to ? v.
The list of extraction techniques/patterns presented so far in this paper is not exhaustive. Many other useful patterns can be added to this list.

Translation into Networks
To this end, we have presented several techniques (as extraction patterns) to extract social networks from Linked Open Data represented using RDF data model. Each of those patterns has the form of a SPARQL query in its algebraic form. As we saw in Section 4.2, queries in SPARQL are expressions of the form Project(X, P) where P is a pattern and X is a set of free variables. The result of a SPARQL query Q over an RDF graph G is a multiset of solution mappings M = vPw G , where v.w G is an evaluation function. In order to obtain the target social network, we need a formal translation step to specify the results of a query (corresponding to an extraction pattern) as a social network. We distinguish between two cases:

Binary Networks
In this case, the query has two returned variables representing connected vertices. Thus, it has the form: Q = Project({? u, ? v}, P), where P is some pattern (as described in previous section). Let

Weighted Networks
In this case, the query has three returned variables: the first two represent connected vertices, and the third is the weight. Thus, the query has the form:

Discussion
This paper proposes several techniques to extract social networks from Linked Open Data. The proposed techniques have the form of extraction patterns that can be expressed using SPARQL queries whose results make up the target social network. The importance of the proposed approach comes from (1) the importance of Linked Open Data as a rich source of information, and (2) the role of extraction patterns as guidelines for the process of deriving new latent knowledge (social networks) from existing one (linked open data).
Linked Open Data is structured information in a machine-processable format, openly published on the Web, and linked to other datasets. Those properties of LOD make it an invaluable resource of information, and create new opportunities for many areas of application. Thus, LOD is being increasingly adopted, not only by the scientific community, but also by several groups of stakeholders such as media, industry, and governmental organizations and NGOs. LOD is already widely available in several industries, including libraries, bio-medicine, and government data. "Linking information from different sources is key for further innovation. If data can be placed in a new context, more and more valuable applications-and therefore knowledge-will be generated" [13].
From this point of view comes our proposal of mining new information i.e., social networks, from LOD, and then turning it into knowledge, through social network analysis. Hence, the extraction techniques/patterns proposed in this paper come to facilitate this process.
Extraction patterns can be considered as guidelines to help the user figure out the appropriate formulation of the query to extract a desired network, and to understand the outcomes of different design choices: which predicates are needed, how many triple patterns, which direction of predicate of each triple pattern (subject-object) is the appropriate, etc. Extraction patterns are used as building blocks to establish more complex patterns that can be used to extract complex networks (e.g., as in 3-triple and 4-triple patterns). Moreover, they can also be used as building blocks to design extraction patterns for other types of social networks, such as contextual networks and ego-centered networks.
A contextual social network differs from a complete network in that it covers a subset of the population defined by means of a specific context, e.g., entity type, time, location, or gender (e.g., a co-acting network of Indian actors, or influence network of intellectuals in a specific era). Given the general extraction patterns presented in this paper, specialized extraction patterns for contextual social networks can be constructed by applying additional triple patterns and/or filters that specify the desired context of a target partial network.
On the other hand, an ego-centered network is centered around a specific entity and includes its surrounding environment, e.g., a co-acting network centered around Jodie Foster, or an influence network centered around Isaac Newton. Hence, specialized extraction patterns for ego-centered social networks can be built on top of the general extraction patterns, taking into account whether the network is directed or not, and considering both ego-alter ties and alter-alter ties, as we demonstrated in a previous work [34].
In this paper, the focus has been on the case where a single dataset is being queried at a time, that is, the described patterns have a limited scope to one dataset only (e.g., from a movie subset, or from a bibliographic resource). However, this work can be extended to tackle the case where multiple datasets can be used to extract a target social network. This can be done using the interlinking among LOD datasets, as well as using federated SPARQL queries. One of the main objectives of Linked Open Data is linking and integration among the LOD cloud datasets. "Connectivity among two or more datasets can be achieved through common Entities, Triples, Literals, and Schema Elements, while more connections can occur due to equivalence relationships between URIs, such as owl:sameAs, owl:equivalentProperty and owl:equivalentClass, since many publishers use such equivalence relationships, for declaring that their URIs are equivalent with URIs of other datasets" [35]. As most of LOD datasets are interlinked, there are considerable amounts of overlap of RDF resources within datasets in the whole LOD cloud. Thus, such overlap is also reflected onto the social networks extracted from different datasets.
For example, consider the co-acting social network as described in the motivation example (Section 2). This network can be extracted from YAGO dataset using the predicate yago:actedIn (which relates an actor to a movie) with the in-2-star extraction pattern (Section 5.3.1) as demonstrated in Example 3. In this case, the size of the network is 225,790 edges, connecting 26,544 nodes (actors).
It is also possible to extract such a network from DBpedia using the predicate dbo:starring (which relates a movie to an actor) with the out-2-star extraction pattern (Section 5.3.2) as mentioned in Example 4. The SPARQL query is shown in Figure 8. In this case, the size of the network is 829,887 edges. This network is different from the one extracted from YAGO, not only in terms of the number of entities and edges, but also in terms of the entities themselves (RDF resources), as the entities in YAGO belong to the namespace http://yago-knowledge.org/resource/, whereas the entities in DBpedia belong to the namespace http://dbpedia.org/resource/.  Despite the differences between the two extracted networks, there are certainly many overlaps between them. For instance, the entity yago:Brad_Pitt from yago is the same as the entity dbr:Brad_Pitt from DBpedia (Here, the prefix dbr refers to DBpedia resources namespace: http: //dbpedia.org/resource/). The good news is that, thanks to the interlinking of DBpedia and YAGO, such equivalences of entities are available via the OWL property owl:sameAs. Thus, the overlap between the two co-acting social networks (from YAGO and DBpedia) can be easily detected. Figure 9 shows another version of the previous SPARQL query (to extract the network from DBpedia) where each entity from DBpedia is associated with its equivalent entity from YAGO. The results of this query consist of 94,311 ties/edges that correspond to the intersection of the the two social networks.  ? a1 ) , '' http :// yago -knowledge . org / resource / ' ') && strStarts ( STR (? a2 ) , '' http :// yago -knowledge . org / resource / ' ') ) } Figure 9. SPARQL query to extract co-acting network from DBpedia, with YAGO equivalent entities.
It is also possible to perform such an overlap investigation using federated SPARQL queries [16] (through SERVICE operator) which allow for combining graph patterns that can be evaluated over several endpoints within a single query [15].
Overall, extracting social networks from linked open data enables us to visualize those networks and study them using prominent tools of social network analysis. Besides usual types of analysis, such as connectivity and centrality, advanced analysis can be applied on extracted social networks, including e.g., community detection, diffusion dynamics, and link prediction, etc. Moreover, being extracted from linked open data, the nodes of an extracted network are LOD entities and thus can be enriched with their attributes that are readily available in the source LOD dataset. This process will turn the extracted network into a content-rich network whose nodes are associated with rich content information. For instance, consider the co-acting network when each actor is associated with extra metadata, such as country, birth date, and gender. As another example, consider the influence network of intellectuals when we associate each node (scholar) with the historical period in which he/she lived; this makes the influence network into a dynamic network and hence enables longitudinal network studies, i.e., to study how a social network develops or changes over time. In all cases, new knowledge is being generated which would be of a great interest.
Author Contributions: Conceptualization, R.G. and J.P.; writing-original draft preparation, R.G.; writing-review and editing, R.G. and J.P.; supervision, J.P. All authors have read and agreed to the published version of the manuscript.
Funding: This research received no external funding.

Conflicts of Interest:
The authors declare no conflict of interest.

Abbreviations
The following abbreviations are used in this manuscript: