Skip to content

LINK MANIPULATION 🔧

Work in progress

After generating a number of sets of linksets, one may want to merge, split or filter out some links while others may want to infer new links using existing alignments. The LENS menu provides means for exactly doing that. The LENS menu makes it possible to apply set like operators such as UNION, INTERSECTION, DIFFERENCE, TRANSITIVE and IN-SET over alignments in ways that suit best the user according to her envisaged final integration goal.

For the purpose of illustration, we provide two linksets (ex:DC-Heroes-Identity, ex:Marvel-Heroes-Identity) of superheroes from the DC and Marvel Universe. According to the metadata of these linksets, they originate from an attempt to de-duplicate the datasets of each universe. This can be observed as the source and target entities composing the links in each linkset are respectively from the same dataset. From the metadata we also observe that, the value of the property void:triples highlights that each linkset is composed of ten identity links. Furthermore, When taking a look at the links within each linkset, the RDF* format of the triples informs that a link validation took place for each link in the set.

Theses sets will be used for illustrating the set-like operators discussed in this section.

Example 1: Linksets originating from deduplications.
ex:DC-Heroes-Identity
    a                     void:Linkset ;
    dcterms:description   "Identifying DC's comics superheroes" ;
    ll:subjectsTarget     dataset:DC-Comics;
    ll:objectsTarget      dataset:DC-Comics;
    void:triples          10 ;
    • • •

ex:Marvel-Heroes-Identity
    a                     void:Linkset ;
    dcterms:description   "Identifying Marvel Universes' superheroes" ;
    ll:subjectsTarget     dataset:Marvel-Universe;
    ll:objectsTarget      dataset:Marvel-Universe ;
    void:triples          10 ;
    • • •

ex:DC-Heroes-Identity
{
    <<hero:Superman         owl:sameAs  person:Clark-Kent>>          validation:status  "accepted" .
    <<hero:Batman           owl:sameAs  person:Bruce-Wane>>          validation:status  "accepted" .
    <<hero:Flash            owl:sameAs  person:Barry-Allen>>         validation:status  "accepted" .
    <<hero:GreenLantern     owl:sameAs  person:Alan-Scott>>          validation:status  "accepted" .
    <<hero:WonderWoman      owl:sameAs  person:Diana-Prince>>        validation:status  "accepted" .
    <<hero:Aquaman          owl:sameAs  person:Arthur-Curry>>        validation:status  "accepted" .
    <<hero:GreenArrow       owl:sameAs  person:OliverQueen>>         validation:status  "accepted" .
    <<hero:BoosterGold      owl:sameAs  person:Michael-Jon-Carter>>  validation:status  "accepted" .
    <<hero:Spider-man       owl:sameAs  person:Peter-Parker>>        validation:status  "rejected" .
    <<hero:Iron-man         owl:sameAs  person:Tony-Stark>>          validation:status  "rejected" .   
}

ex:Marvel-Heroes-Identity
{
    <<hero:Captain-Marvel   owl:sameAs  person:Carol-Danvers>>     validation:status  "accepted" .
    <<hero:Captain-America  owl:sameAs  person:Steve-Rogers>>      validation:status  "accepted" .
    <<hero:Deadpool         owl:sameAs  person:Wade-Wilson>>       validation:status  "accepted" .
    <<hero:Black-Panther    owl:sameAs  person:T-Challa>>          validation:status  "accepted" .
    <<hero:Spider-man       owl:sameAs  person:Peter-Parker>>      validation:status  "accepted" .
    <<hero:Iron-man         owl:sameAs  person:Tony-Stark>>        validation:status  "accepted" .
    <<hero:Ant-man          owl:sameAs  person:Tony-Stark>>        validation:status  "accepted" .
    <<hero:Black-Widow      owl:sameAs  person:Natasha-Romanoff>>  validation:status  "accepted" .
    <<hero:Hulk             owl:sameAs  person:Bruce-Banner>>      validation:status  "accepted" .
    <<hero:Hawkeye          owl:sameAs  person:Clint-Barton>>      validation:status  "accepted" .
}


1. Union

Imagine having three linksets ex:Marvel-Heroes-Identity-1, ex:Marvel-Heroes-Identity-2 and ex:DC-Heroes-Identity.

Example 2: Sample of three linksets to merge.
##############################################################
#     MARVEL: Annotated Linkset of 6 Identity Statements     #
##############################################################
# Superheroes vs Fictitious-Persons

ex:Marvel-Heroes-Identity-1
    a                       void:Linkset ;
    dcterms:subject         "Fictitious Heroes" ;
    dcterms:description     "Identifying Marvel Universes' superheroes" ;
    ll:subjectsTarget       dataset:Marvel-Universe ;
    ll:objectsTarget        dataset:Marvel-Universe ;
    void:triples            6 .

ex:Marvel-Heroes-Identity-1
{
    <<hero:Black-Widow      owl:sameAs  person:Natasha-Romanoff>>  validation:status true .
    <<person:Bruce-Banner   owl:sameAs  hero:Hulk>>                validation:status true .
    <<hero:Captain-America  owl:sameAs  person:Steve-Rogers>>      validation:status true .
    <<hero:Captain-Marvel   owl:sameAs  person:Carol-Danvers>>     validation:status true .
    <<hero:Deadpool         owl:sameAs  person:Wade-Wilson>>       validation:status true .
    <<hero:Black-Panther    owl:sameAs  person:T-Challa>>          validation:status true .
}

##############################################################
#     MARVEL: Annotated Linkset of 4 Identity Statements     #
##############################################################

ex:Marvel-Heroes-Identity-2
    a                       void:Linkset ;
    dcterms:subject         "Fictitious Heroes" ;
    dcterms:description     "Identifying Marvel Universes' superheroes" ;
    ll:subjectsTarget       dataset:Marvel-Universe ;
    ll:objectsTarget        dataset:Marvel-Universe ;
    void:triples            4 .

ex:Marvel-Heroes-Identity-2
{
    <<person:Peter-Parker      owl:sameAs  hero:Spider-man>>       validation:status true .
    <<person:Tony-Stark        owl:sameAs  hero:Iron-man>>         validation:status true .
    <<person:Tony-Stark        owl:sameAs  hero:Ant-man>>          validation:status False .
    <<person:Clint-Barton      owl:sameAs  hero:Hawkeye>>          validation:status true .
}

##############################################################
# DC-COMICS: Non Annotated Linkset of 10 Identity Statements #
##############################################################
ex:DC-Heroes-Identity
    a                       void:Linkset ;
    dcterms:subject         "Fictitious Heroes" ;
    dcterms:description     "Identifying DC Comics Universes' superheroes" ;
    void:triples            9 .

ex:DC-Heroes-Identity
{
    hero:Superman       owl:sameAs  person:Clark-Kent .
    hero:Batman         owl:sameAs  person:Bruce-Wane .
    hero:GreenLantern   owl:sameAs  person:Alan-Scott .
    hero:WonderWoman    owl:sameAs  person:Diana-Prince .
    hero:Aquaman        owl:sameAs  person:Arthur-Curry .
    hero:GreenArrow     owl:sameAs  person:OliverQueen .
    hero:BoosterGold    owl:sameAs  person:Michael-Jon-Carter .
    hero:Spider-man     owl:sameAs  person:Peter-Parker .
    hero:Iron-man       owl:sameAs  person:Tony-Stark .   
}

As the above linksets individually make an attempt to align superheroes and fictitious persons in their respective universe, how about unifying these sets as the set of links identifying superheroes in the limited universe of DC and Marvel. To generate such a lens, the UNION set-like operator is required.

Using such operator over the three linksets generates the ex:Union-Marvel-DC-Heroes lens. Here, each link is annotated with its provenance as they all originate from one or more linksets. For example, the identity triple hero:Iron-man owl:sameAs person:Tony-Stark is derive from the linksets ex:Marvel-Heroes-Identity-2 and ex:DC-Heroes-Identity. This enables the links in the newly created lens to carry their own annotations while being able to still use the annotations present it their respective linkset of origin (linkset they are derived from).

Example 3: UNION of three linksets.

With the UNION operator, the same link appearing in various sets (linksets and/or lenses) regardless of its direction is represented only once in the resulting lens of UNION. In a linkset for example, the subject and object targets are explicitly defined. As such, ⟨ ex:e1 owl:sameAs ex:e2 ⟩\lang \text{ ex:e1 owl:sameAs ex:e2 } \rang and ⟨ ex:e2 owl:sameAs ex:e1 ⟩\lang \text{ ex:e2 owl:sameAs ex:e1 } \rang are different and stem from different linksets. However, in the resulting UNION, a distinction between the two triples is not explicitly made, meaning that the direction is not of much importance here. This can be observed in the metadata of the union where only the property void:target is used instead of void:subjectsTarget and void:objectsTarget.

### Lens metadata
ex:Union-Marvel-DC-Heroes
    a                            voidPlus:Lens;
    voidPlus:has-lens-operator   voidPlus:Union ;
    dcterms:description          "Identifying superheroes from DC and Marvel Universes'" ;
    ll:target                    ex:Marvel-Heroes-Identity-1 ;
    ll:target                    ex:Marvel-Heroes-Identity-2 ;
    ll:target                    ex:DC-Heroes-Identity-1 ;
    void:triples                 10 .

### The annotated Lens
ex:Union-Marvel-Heroes
{
    <<hero:Black-Panther    owl:sameAs  person:T-Challa>>            prov:wasDerivedFrom  ex:Marvel-Heroes-Identity-1 .
    <<hero:Black-Widow      owl:sameAs  person:Natasha-Romanoff>>    prov:wasDerivedFrom  ex:Marvel-Heroes-Identity-1 .
    <<hero:Captain-America  owl:sameAs  person:Steve-Rogers>>        prov:wasDerivedFrom  ex:Marvel-Heroes-Identity-1 .
    <<hero:Captain-Marvel   owl:sameAs  person:Carol-Danvers>>       prov:wasDerivedFrom  ex:Marvel-Heroes-Identity-1 .
    <<hero:Deadpool         owl:sameAs  person:Wade-Wilson>>         prov:wasDerivedFrom  ex:Marvel-Heroes-Identity-1 .
    <<hero:Hulk             owl:sameAs  person:Bruce-Banner>>        prov:wasDerivedFrom  ex:Marvel-Heroes-Identity-1 .

    <<hero:Ant-man          owl:sameAs  person:Tony-Stark>>          prov:wasDerivedFrom  ex:Marvel-Heroes-Identity-2 .
    <<hero:Hawkeye          owl:sameAs  person:Clint-Barton>>        prov:wasDerivedFrom  ex:Marvel-Heroes-Identity-2 .

    <<hero:Iron-man         owl:sameAs  person:Tony-Stark>> 
        prov:wasDerivedFrom    ex:Marvel-Heroes-Identity-2 ;
        prov:wasDerivedFrom    ex:DC-Heroes-Identity.

    <<hero:Spider-man       owl:sameAs  person:Peter-Parker>>
        prov:wasDerivedFrom    ex:Marvel-Heroes-Identity-2 ;
        prov:wasDerivedFrom    ex:DC-Heroes-Identity.

    <<hero:Superman         owl:sameAs  person:Clark-Kent>>          prov:wasDerivedFrom  ex:Marvel-Heroes-Identity .
    <<hero:Batman           owl:sameAs  person:Bruce-Wane>>          prov:wasDerivedFrom  ex:Marvel-Heroes-Identity .
    <<hero:Flash            owl:sameAs  person:Barry-Allen>>         prov:wasDerivedFrom  ex:Marvel-Heroes-Identity .
    <<hero:GreenLantern     owl:sameAs  person:Alan-Scott>>          prov:wasDerivedFrom  ex:Marvel-Heroes-Identity .
    <<hero:WonderWoman      owl:sameAs  person:Diana-Prince>>        prov:wasDerivedFrom  ex:Marvel-Heroes-Identity .
    <<hero:Aquaman          owl:sameAs  person:Arthur-Curry>>        prov:wasDerivedFrom  ex:Marvel-Heroes-Identity .
    <<hero:GreenArrow       owl:sameAs  person:OliverQueen>>         prov:wasDerivedFrom  ex:Marvel-Heroes-Identity .
    <<hero:BoosterGold      owl:sameAs  person:Michael-Jon-Carter>>  prov:wasDerivedFrom  ex:Marvel-Heroes-Identity . 
}


2. Intersection

Intersecting the DC (ex:DC-Heroes-Identity) and Marvel (ex:Marvel-Heroes-Identity) linksets of superheroes results in ex:Comics-Heroes-Identity, a lens which reveals the only two links shared by the sets. The first link in this lens establishes an identity relation between hero:Spider-man the hero and person:Peter-Parker the fictitious character, while the second link asserts that the superhero hero:Iron-man and the fictitious entity representing Tony Stark are co-referent entities.

Example 4: Intersection: Extracting shared links.
ex:Comics-Heroes-Identity
    a                            voidPlus:Lens ;
    voidPlus:has-lens-operator   voidPlus:Intersection ;
    dcterms:description          "Quality Check: Identifying superheroes from both Marvel and DC comics" ;
    voidPlus:expression          "ex:DC-Heroes-Identity INTERSECTION ex:Marvel-Heroes-Identity" ;
    void:target                  ex:DC-Heroes-Identity , ex:Marvel-Heroes-Identity ;
    void:triples                 4 ;
    • • •

ex:Comics-Heroes-Identity
{   
    <<hero:Spider-man      owl:sameAs  person:Peter-Parker>>
        prov:wasDerivedFrom   ex:DC-Heroes-Identity ;
        prov:wasDerivedFrom   ex:Marvel-Heroes-Identity .

    <<hero:Iron-man         owl:sameAs  person:Tony-Stark>> 
        prov:wasDerivedFrom   ex:DC-Heroes-Identity ;
        prov:wasDerivedFrom   ex:Marvel-Heroes-Identity .
}


3. Difference

Contrarily to the UNION and INTERSECTION operators, the DIFFERENCE operator requires assigning values to the following two properties: void:subjectsTarget and void:objectsTarget. This allows for the explicit and accurate documentation of the lens resulting from performing the Difference manipulation over linksets, lenses or the combination of both a linkset and a lens. This specification is not to put a particular emphasis on the direction of the links instead, it is for knowing the linkset or lens from which the resulting links will stem from.

Example 5: DIFFERENCE for extracting triples only existing in void:subjectsTarget.
ex:Comics-Heroes-Identity
    a                            voidPlus:Lens ;
    voidPlus:has-lens-operator   voidPlus:Difference;
    dcterms:description          "Quality Check: Identifying superheroes from both Marvel and DC comics" ;
    voidPlus:expression          "ex:DC-Heroes-Identity DIFFERENCE ex:Marvel-Heroes-Identity" ;
    void:target                  ex:DC-Heroes-Identity , ex:Marvel-Heroes-Identity ;
    void:triples                 8 ;
    • • •

ex:DC-Heroes-Identity
{
    <<hero:Superman         owl:sameAs  person:Clark-Kent>>          validation:status "True" .
    <<hero:Batman           owl:sameAs  person:Bruce-Wane>>          validation:status "True" .
    <<hero:Flash            owl:sameAs  person:Barry-Allen>>         validation:status "True" .
    <<hero:GreenLantern     owl:sameAs  person:Alan-Scott>>          validation:status "True" .
    <<hero:WonderWoman      owl:sameAs  person:Diana-Prince>>        validation:status "True" .
    <<hero:Aquaman          owl:sameAs  person:Arthur-Curry>>        validation:status "True" .
    <<hero:GreenArrow       owl:sameAs  person:OliverQueen>>         validation:status "True" .
    <<hero:BoosterGold      owl:sameAs  person:Michael-Jon-Carter>>  validation:status "True" .  
}

4. Composition

5. In Set

Imagine being a movie fan particularly interested in knowing more on a set of ten fictional characters carefully handpicked. This intellectual knowledge includes discovering for example knowing in what movies a fictional character played in, what was the rate of the movies, and so on… Example 6 exhaustively lists these movie characters of interest.

Example 6: ex:preference, set of movie characters.
ex:preference
    rdf:_4735532571260424746
        hero:Captain-Marvel,   person:Carol-Danvers,  hero:Captain-America,  person:Steve-Rogers,
        hero:Deadpool,         person:Wade-Wilson,    hero:Black-Panther,    person:T-Challa,
        hero:Spider-man,       person:Peter-Parker,   hero:Iron-man,          person:Tony-Stark,
        hero:Ant-man,          person:Tony-Stark,     hero:Black-Widow,       person:Natasha-Romanoff,
        hero:Hulk,             person:Bruce-Banner,   hero:Hawkeye,           person:Clint-Barton .

To know more about these handpicked characters, we have isolated ex:MovieInfo, a dataset where information such as movie’s fictional character and movie’s rate are documented.

Example 7: ex:MovieCharacter, a movie database.
ex:MovieInfo
{
    movie:WonderWoman 
        schema:character        hero:WonderWoman;
        schema:contentRating   7.4.

    movie:WonderWoman-Bloodlines 
        schema:character        hero: WonderWoman;
        schema:contentRating   5.8.

    movie:Superman 
        schema:character        hero:Superman;
        schema:contentRating   7.3.

    movie:Superman-Returns 
        schema:character        hero:Superman;
        schema:contentRating   6.

    movie:Man-of-Steel 
        schema:character        hero:Superman;
        schema:contentRating   7.

    movie:Batman 
        schema:character        hero:Batman;
        schema:contentRating   7.5.

    movie:Batman-Returns
        schema:character        hero:Batman;
        schema:contentRating   7.

    movie:Batman-Robin
        schema:character        hero:Batman;
        schema:contentRating   3.7.

    movie:Spider-man  
        schema:character        hero:Spider-man;
        schema:contentRating   7.3.

    movie:The-amazing-Spider-man  
        schema:character        hero:Spider-man;
        schema:contentRating   6.5.

    movie:Spider-man-home-coming 
        schema:character        hero:Spider-man;
        schema:contentRating   7.4.
}

From the dataset ex:MovieInfo, an embedded linkset defined by the link predicate schema:character is extracted and presented in Example 8. In this example, four fictional characters (hero:WonderWoman, Superman, Batman and Spider-man) are linked to various superhero-movies leading to a total of eleven links.

Example 8: ex:LinksetMovieCharacter, the movie character linkset.
ex:LinksetMovieCharacter
{
    movie:WonderWoman             schema:character  hero:WonderWoman .
    movie:WonderWoman-Bloodlines  schema:character  hero:WonderWoman .
    movie:Superman                schema:character  hero:Superman .
    movie:Superman-Return         schema:character  hero:Superman .
    movie:Man-of-Steel            schema:character  hero:Superman .
    movie:Batman                  schema:character  hero:Batman .
    movie:Batman-Returns          schema:character  hero:Batman .
    movie:Batman-Robin            schema:character  hero:Batman .
    movie:Spider-man              schema:character  hero:Spider-man .
    movie:The-amazing-Spider-man  schema:character  hero:Spider-man .
    movie:Spider-man-home-coming  schema:character  hero:Spider-man .
}

A close look at Example 6 reveals that the set of handpicked characters is a subset of the Marvel Universe. Now, overlaying this set (ex:preference) onto the linkset of movie characters (ex:LinksetMovieCharacter) implies extracting the links in ex:LinksetMovieCharacter where entities at the subject or object position of the link can be find in ex:preference. Formally, this can be translated into: ex:LinksetMovieCharacter InSet ex:preference.

Example 9: Movie Characters from ex:LinksetMovieCharacter that
                    are derived from Marvel’s matched universe set.
ex:MovieCharacter
{
    movie:Spider-man              schema:character  hero:Spider-man .
    movie:The-amazing-Spider-man  schema:character  hero:Spider-man .
    movie:Spider-man-home-coming  schema:character  hero:Spider-man .
}