Pular para o conteúdo principal

RDF e Reificação

Reification is mechanism for adding properties to RDF graph edges, thus making them directly translatable to property graphs. Reification: break down any structured data into triples, without loss of information. N-ary relations

Reificação em RDF para suportar atributos nas arestas como por exemplo dados de proveniência. Uso de nós brancos. Reificação: incluir outras propriedades para a tripla

rdf:Statement
rdf:subject
rdf:predicate
rdf:object

Reificação também se aplica a LPG para relações n-árias assim como em RDF. Reduzir relacionamentos n-ários a n relacionamentos binários (coleção, reificação).

The RDF* and SPARQL* Approach to Annotate Statements in RDF: Although this is possible, up to now there has not been one standard, agreed upon way to do this. RDF* is a proposal on how to do this, introduced in 2014, which is getting traction in the RDF world.

Relação ternária
============

Professor X ministra a disciplina Y para a turma Z

1 X - é um -> Professor
2 Y - é um -> Disciplina
3 Z - é uma -> Turma
4 X - ministra -> Y
5 Y - é ministrada para -> Z

Id    node1        label                        node2
1     X                é um                        Professor
2     Y                é um                        Disciplina
3     Z                é uma                        Turma
4     X                ministra                    Y
5     Y                é ministrada para        Z

1 X - é um -> Professor
2 Z - é uma -> Turma
3 Y - é um -> Disciplina
4 X - ministra -> Y - para -> Z

Id    node1        label                node2
1     X            é um                Professor
2     Z            é uma                Turma
3     Y            é um                Disciplina
4     X            ministra            Y
5    4            para                Z

Id    node1        label                node2
1     X            é um                Professor
2     Z            é uma                Turma
3     Y            é um                Disciplina
4     ST            é um                RDF Statement
5     ST            sujeito            X
6    ST            objeto            Y
7    ST            predicado         ministra
8    ST            para                Z

Standard Reification

Welles  name       "Orson Welles" .
 Welles  mentioned  Kubrick .
 Kubrick  name    "Stanley Kubrick" .
 Kubrick  influencedBy  Welles .
s significance 0.8 .
s rdf:type rdf:Statement .
s rdf:subject Kubrick .
s rdf:predicate influencedBy .
s rdf:object Welles .

Single-Triple Named Graphs

g1 { Kubrick influencedBy Welles }
g1 significance 0.8 .

Singleton Properties

Kubrick influencedBy Welles .
Kubrick p1 Welles .
p1 singletonPropertyOf influencedBy .
p1 significance 0.8 .

Fonte: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4350149/

KGTK

kgtk unreify-rdf-statements -i graph-reification.tsv -o graph-unreification-statement.tsv -v

Opening the input file: graph-reification.tsv
KgtkReader: File_path.suffix: .tsv
KgtkReader: reading file graph-reification.tsv
header: node1   label   node2   id
input format: kgtk
KgtkReader: Special columns: node1=0 label=1 node2=2 id=3
KgtkReader: Reading an edge file.
Opening the output file: graph-unreification-statement.tsv
File_path.suffix: .tsv
KgtkWriter: writing file graph-unreification-statement.tsv
header: node1   label   node2   id
Reading and grouping the input records.
Processing the input records.
Processed 15 records in 5 groups.
Unreified 1 groups.
Wrote 12 output records

Entrada

node1    label    node2    id
Welles    name    "Orson Welles"    E1
Welles    mentioned    Kubrick    E2
Kubrick    name    "Stanley Kubrick"    E3
Kubrick    influencedBy    Welles    E4
s    significance    0.8    E5
s    rdf:type    rdf:Statement    E6
s    rdf:subject    Kubrick    E7
s    rdf:predicate    influencedBy    E8
s    rdf:object    Welles    E9

Kubrick    influencedBy    Welles    G1
G1    significance    0.8    E10
Kubrick    influencedBy    Welles    E11
Kubrick    p1    Welles    E12
p1    singletonPropertyOf    influencedBy    E13
p1    significance    0.8    E14

Saída

node1    label    node2    id
G1    significance    0.8    E10
Kubrick    name    "Stanley Kubrick"    E3
Kubrick    influencedBy    Welles    E4
Kubrick    influencedBy    Welles    G1
Kubrick    influencedBy    Welles    E11
Kubrick    p1    Welles    E12
Welles    name    "Orson Welles"    E1
Welles    mentioned    Kubrick    E2
p1    singletonPropertyOf    influencedBy    E13
p1    significance    0.8    E14
Kubrick    influencedBy    Welles    s
s    significance    0.8    s-1

Não consegui usar o unreify values pq não entendi bem que tipo de reificação é essa

unreify-values -i graph-reification.tsv -o graph-unreification-values.tsv ....

Reificação da Wikidata para representação em RDF
=====================================

Na International Semantic Web Conference (ISWC) de 2015 um artigo comparativo com 4 abordagens de reificação dos dados da Wikidata

  • standard reification (sr) whereby an RDF resource is used to denote the triple itself, denoting its subject, predicate and object as attributes and allowing additional meta-information to be added.
  • n-ary relations (nr) whereby an intermediate resource is used to denote the relationship, allowing it to be annotated with meta-information.
  • singleton properties (sp) whereby a predicate unique to the statement is created, which can be linked to the high-level predicate indicating the relationship, and onto which can be added additional meta-information.
  • Named Graphs (ng) whereby triples (or sets thereof) can be identified in a fourth field using, e.g., an IRI, onto which meta-information is added

e em cinco Graph Databases: 4store, BlazeGraph, GraphDB, Jena TDB, Virtuoso.

Hernández, D., A. Hogan and M. Krötzsch. “Reifying RDF: What Works Well With Wikidata?” SSWS@ISWC (2015).


Comentários

Postagens mais visitadas deste blog

Aula 12: WordNet | Introdução à Linguagem de Programação Python *** com NLTK

 Fonte -> https://youtu.be/0OCq31jQ9E4 A WordNet do Brasil -> http://www.nilc.icmc.usp.br/wordnetbr/ NLTK  synsets = dada uma palavra acha todos os significados, pode informar a língua e a classe gramatical da palavra (substantivo, verbo, advérbio) from nltk.corpus import wordnet as wn wordnet.synset(xxxxxx).definition() = descrição do significado É possível extrair hipernimia, hiponimia, antonimos e os lemas (diferentes palavras/expressões com o mesmo significado) formando uma REDE LEXICAL. Com isso é possível calcular a distância entre 2 synset dentro do grafo.  Veja trecho de código abaixo: texto = 'útil' print('NOUN:', wordnet.synsets(texto, lang='por', pos=wordnet.NOUN)) texto = 'útil' print('ADJ:', wordnet.synsets(texto, lang='por', pos=wordnet.ADJ)) print(wordnet.synset('handy.s.01').definition()) texto = 'computador' for synset in wn.synsets(texto, lang='por', pos=wn.NOUN):     print('DEF:',s

truth makers AND truth bearers - Palestra Giancarlo no SBBD

Dando uma googada https://iep.utm.edu/truth/ There are two commonly accepted constraints on truth and falsehood:     Every proposition is true or false.         [Law of the Excluded Middle.]     No proposition is both true and false.         [Law of Non-contradiction.] What is the difference between a truth-maker and a truth bearer? Truth-bearers are either true or false; truth-makers are not since, not being representations, they cannot be said to be true, nor can they be said to be false . That's a second difference. Truth-bearers are 'bipolar,' either true or false; truth-makers are 'unipolar': all of them obtain. What are considered truth bearers?   A variety of truth bearers are considered – statements, beliefs, claims, assumptions, hypotheses, propositions, sentences, and utterances . When I speak of a fact . . . I mean the kind of thing that makes a proposition true or false. (Russell, 1972, p. 36.) “Truthmaker theories” hold that in order for any truthbe

DGL-KE : Deep Graph Library (DGL)

Fonte: https://towardsdatascience.com/introduction-to-knowledge-graph-embedding-with-dgl-ke-77ace6fb60ef Amazon recently launched DGL-KE, a software package that simplifies this process with simple command-line scripts. With DGL-KE , users can generate embeddings for very large graphs 2–5x faster than competing techniques. DGL-KE provides users the flexibility to select models used to generate embeddings and optimize performance by configuring hardware, data sampling parameters, and the loss function. To use this package effectively, however, it is important to understand how embeddings work and the optimizations available to compute them. This two-part blog series is designed to provide this information and get you ready to start taking advantage of DGL-KE . Finally, another class of graphs that is especially important for knowledge graphs are multigraphs . These are graphs that can have multiple (directed) edges between the same pair of nodes and can also contain loops. The