File size: 7,172 Bytes
93aac8b
574c02e
93aac8b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
84de583
93aac8b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
991e7b0
93aac8b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c91ab38
 
 
 
93aac8b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
import streamlit as st  # πŸ“š Importing Streamlit to create our awesome app!
#import streamlit_mermaid  # πŸ§œβ€β™€οΈ Mermaid diagrams in Streamlit!
import os  # πŸ“ For file operations, because who doesn't like saving stuff?

# πŸ–ΌοΈ Setting the page configuration to make it look neat.
st.set_page_config(page_title="Knowledge Graph Completion", layout="wide")

# 🎯 Setting the title of our app.
st.title("Knowledge Graph Completion")

# πŸ“– Introducing PBF with some Markdown magic!
st.markdown("# I. Introduction to Portable Brain Format (PBF)")

st.markdown("""
**Definition and Purpose of PBF**

- Goal of human and machine readability for knowledge graph exchange
- Comparison to similar graph standards (RDF, GQL)
- Mention of tools and libraries supporting PBF and related formats (Neo4j, Apache Jena)
- Current state of language portability in knowledge management AI
""")

st.markdown("### Comparison of Graph Standards")

# πŸ§‘β€πŸŽ¨ Mermaid diagram editor for the first diagram
filename1 = st.text_input("Enter filename for Diagram 1:", "diagram1.mmd")
mermaid_code1 = st.text_area("Edit Mermaid Diagram 1:", '''graph LR
    PBF[Portable Brain Format]
    RDF[RDF]
    GQL[Graph Query Language]
    PBF -- Similarities --> RDF
    PBF -- Similarities --> GQL
    RDF -- Differences --> GQL
''')

# πŸš€ Save and Load buttons for Diagram 1
col1, col2 = st.columns(2)
with col1:
    if st.button("Save Diagram 1"):
        with open(filename1, 'w') as f:
            f.write(mermaid_code1)
        st.success(f"Diagram 1 saved to {filename1}!")
with col2:
    if st.button("Load Diagram 1"):
        if os.path.exists(filename1):
            with open(filename1, 'r') as f:
                mermaid_code1 = f.read()
            st.success(f"Diagram 1 loaded from {filename1}!")
        else:
            st.error(f"File {filename1} does not exist.")

# πŸ§œβ€β™€οΈ Displaying the Mermaid diagram for Diagram 1
st.markdown("#### Diagram 1:")
#streamlit_mermaid.mermaid(mermaid_code1)

# Repeat the process for other Mermaid diagrams in the app
st.markdown("# II. Knowledge Graph Completion")

st.markdown("## Using Language Models")

st.markdown("""
- **KG-BERT**: Using BERT for knowledge graph completion (Yao et al., 2019)
- **KG-LLM**: Exploring Large Language Models for knowledge graph completion (Yao et al., 2024)
""")

st.markdown("## Improving Existing Models")

st.markdown("""
- **ProjB**: An improved bilinear biased ProjE model for knowledge graph completion (Moattari et al., 2022)
""")

st.markdown("## Other Approaches")

st.markdown("""
- **GRank**: Graph Pattern Entity Ranking Model (Ebisu & Ichise, 2019)
""")

# 🧠 Time to dive into Knowledge Graph Embeddings.
st.markdown("# III. Knowledge Graph Embeddings")

st.markdown("## Applications")

st.markdown("- **Entity Type Prediction** (Biswas et al., 2020)")

st.markdown("## Biomedical Domain")

st.markdown("- Link prediction, rule learning, polypharmacy tasks (Gema et al., 2023)")

st.markdown("## Specific Models and Frameworks")

st.markdown("""
- **Knowledgebra**: An algebraic learning framework for KG (Yang et al., 2022)
- Deep learning on knowledge graphs for recommender systems (Gao et al., 2020)
- Neuromorphic knowledge graph embeddings (Caceres Chian et al., 2021)
""")

st.markdown("## Benchmarks and Best Practices")

st.markdown("- Benchmark and best practices for biomedical KG embeddings (Chang et al., 2020)")

st.markdown("### Knowledge Graph Embedding Process")

# πŸ§‘β€πŸŽ¨ Mermaid diagram editor for the second diagram
filename2 = st.text_input("Enter filename for Diagram 2:", "diagram2.mmd")
mermaid_code2 = st.text_area("Edit Mermaid Diagram 2:", '''graph TD
    A[Knowledge Graph] --> B[Embedding Model]
    B --> C[Vector Representations]
    C --> D[Downstream Tasks]
    D --> E[Entity Type Prediction]
    D --> F[Link Prediction]
    D --> G[Recommender Systems]
''')

# πŸš€ Save and Load buttons for Diagram 2
col3, col4 = st.columns(2)
with col3:
    if st.button("Save Diagram 2"):
        with open(filename2, 'w') as f:
            f.write(mermaid_code2)
        st.success(f"Diagram 2 saved to {filename2}!")
with col4:
    if st.button("Load Diagram 2"):
        if os.path.exists(filename2):
            with open(filename2, 'r') as f:
                mermaid_code2 = f.read()
            st.success(f"Diagram 2 loaded from {filename2}!")
        else:
            st.error(f"File {filename2} does not exist.")

# πŸ§œβ€β™€οΈ Displaying the Mermaid diagram for Diagram 2
st.markdown("#### Diagram 2:")
#streamlit_mermaid.mermaid(mermaid_code2)

# 🌐 Exploring Knowledge Graph Applications.
st.markdown("# IV. Knowledge Graph Applications")

st.markdown("## Commonsense Reasoning")

st.markdown("""
- Fusing context into KG for commonsense QA (Xu et al., 2021)
- **CSKG**: The CommonSense Knowledge Graph (Ilievski et al., 2021)
""")

st.markdown("## Conversation Generation")

st.markdown("- Knowledge-aware conversation generation with explainable reasoning over augmented graphs (Liu et al., 2019)")

st.markdown("## Question Answering")

st.markdown("- Question answering over spatio-temporal knowledge graphs (Dai et al., 2024)")

st.markdown("### Application in Commonsense Reasoning")

# πŸ§‘β€πŸŽ¨ Mermaid diagram editor for the third diagram
filename3 = st.text_input("Enter filename for Diagram 3:", "diagram3.mmd")
mermaid_code3 = st.text_area("Edit Mermaid Diagram 3:", '''graph LR
    Context -->|Fused into| KnowledgeGraph
    KnowledgeGraph -->|Used for| CommonsenseQA
''')

# πŸš€ Save and Load buttons for Diagram 3
col5, col6 = st.columns(2)
with col5:
    if st.button("Save Diagram 3"):
        with open(filename3, 'w') as f:
            f.write(mermaid_code3)
        st.success(f"Diagram 3 saved to {filename3}!")
with col6:
    if st.button("Load Diagram 3"):
        if os.path.exists(filename3):
            with open(filename3, 'r') as f:
                mermaid_code3 = f.read()
            st.success(f"Diagram 3 loaded from {filename3}!")
        else:
            st.error(f"File {filename3} does not exist.")

# πŸ§œβ€β™€οΈ Displaying the Mermaid diagram for Diagram 3
st.markdown("#### Diagram 3:")

mermaidblock="```mermaid"
mermaidblockend="```"
st.markdown(mermaidblock + mermaid_code3 + mermaidblockend)

# πŸ—οΈ Introducing Specific Knowledge Graphs.
st.markdown("# V. Specific Knowledge Graphs")

st.markdown("""
- **TechKG**: A large-scale Chinese technology-oriented knowledge graph (Ren et al., 2018)
- **Wikidata**: Discovering implicational knowledge in Wikidata (Hanika et al., 2019)
- **EventNarrative**: A large-scale event-centric dataset for knowledge graph-to-text generation (Colas et al., 2022)
""")

# 🧩 Discussing Knowledge Graph Representation.
st.markdown("# VI. Knowledge Graph Representation")

st.markdown("- **KSR**: A semantic representation of knowledge graph within a novel unsupervised paradigm (Xiao et al., 2020)")

# πŸ”„ Wrapping up with RDF Generation and Validation.
st.markdown("# VII. RDF Generation and Validation")

st.markdown("- **R2RML and RML**: Comparison for RDF generation, rules validation, and inconsistency resolution (Dimou, 2020)")