├── .gitignore
├── LICENSE
├── README.md
├── Section2_Data_Graphs
├── 2_1_1_Directed_edge_labelled_graphs
│ └── figure1.ttl
├── 2_1_2_Heterogeneous_graphs
│ ├── figure2a.ttl
│ └── figure2b.cypher
├── 2_1_3_Property_graphs
│ ├── figure3a.ttl
│ └── figure3b.cypher
├── 2_1_4_Graph_dataset
│ └── figure4.trig
├── 2_2_1_Graph_patterns
│ ├── README.md
│ └── figure5.sparql
├── 2_2_2_Complex_graph_patterns
│ └── figure6.sparql
├── 2_2_3_Navigational_graph_patterns
│ └── figure7.sparql
├── 2_3_1_Shapes_graphs
│ ├── README.md
│ ├── figure8.shapeMap
│ └── figure8.shex
├── 2_4_2_Reification
│ ├── figure9a.ttl
│ ├── figure9b.ttl
│ └── figure9c.ttl
├── 2_4_3_Higher_arity_representation
│ ├── figure10a.trig
│ ├── figure10b.cypher
│ └── figure10c.rdfstar
└── 2_4_4_Annotations
│ ├── figure11g.n4
│ └── figure11q.sparql
├── Section3_Deductive_Knowledge
├── 3_1_4_Individuals
│ └── table2.ttl
├── 3_1_5_Properties
│ └── table3.ttl
├── 3_1_6_Classes
│ └── table4.ttl
├── 3_3_1_Rules
│ ├── figure13-ontology.ttl
│ ├── figure13-query.sparql
│ ├── flight-rule.rif
│ └── sublass-rules.rif
└── figure12-query.sparql
└── Section4_Inductive_Knowledge
├── 4_1_1_Graph_algorithms
├── figure15.ttl
└── figure16.ttl
├── 4_1_2_Graph_processing_frameworks
└── figure17.ttl
├── 4_2_1_Translational_models
└── figure18.ttl
├── 4_3_1_Recursive_graph_neural_networks
└── figure20.ttl
└── 4_4_Symbolic_Learning
└── figure21.ttl
/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 | lerna-debug.log*
8 |
9 | # Diagnostic reports (https://nodejs.org/api/report.html)
10 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
11 |
12 | # Runtime data
13 | pids
14 | *.pid
15 | *.seed
16 | *.pid.lock
17 |
18 | # Directory for instrumented libs generated by jscoverage/JSCover
19 | lib-cov
20 |
21 | # Coverage directory used by tools like istanbul
22 | coverage
23 | *.lcov
24 |
25 | # nyc test coverage
26 | .nyc_output
27 |
28 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
29 | .grunt
30 |
31 | # Bower dependency directory (https://bower.io/)
32 | bower_components
33 |
34 | # node-waf configuration
35 | .lock-wscript
36 |
37 | # Compiled binary addons (https://nodejs.org/api/addons.html)
38 | build/Release
39 |
40 | # Dependency directories
41 | node_modules/
42 | jspm_packages/
43 |
44 | # TypeScript v1 declaration files
45 | typings/
46 |
47 | # TypeScript cache
48 | *.tsbuildinfo
49 |
50 | # Optional npm cache directory
51 | .npm
52 |
53 | # Optional eslint cache
54 | .eslintcache
55 |
56 | # Microbundle cache
57 | .rpt2_cache/
58 | .rts2_cache_cjs/
59 | .rts2_cache_es/
60 | .rts2_cache_umd/
61 |
62 | # Optional REPL history
63 | .node_repl_history
64 |
65 | # Output of 'npm pack'
66 | *.tgz
67 |
68 | # Yarn Integrity file
69 | .yarn-integrity
70 |
71 | # dotenv environment variables file
72 | .env
73 | .env.test
74 |
75 | # parcel-bundler cache (https://parceljs.org/)
76 | .cache
77 |
78 | # Next.js build output
79 | .next
80 |
81 | # Nuxt.js build / generate output
82 | .nuxt
83 | dist
84 |
85 | # Gatsby files
86 | .cache/
87 | # Comment in the public line in if your project uses Gatsby and *not* Next.js
88 | # https://nextjs.org/blog/next-9-1#public-directory-support
89 | # public
90 |
91 | # vuepress build output
92 | .vuepress/dist
93 |
94 | # Serverless directories
95 | .serverless/
96 |
97 | # FuseBox cache
98 | .fusebox/
99 |
100 | # DynamoDB Local files
101 | .dynamodb/
102 |
103 | # TernJS port file
104 | .tern-port
105 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Creative Commons Legal Code
2 |
3 | CC0 1.0 Universal
4 |
5 | CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
6 | LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
7 | ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
8 | INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
9 | REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
10 | PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
11 | THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
12 | HEREUNDER.
13 |
14 | Statement of Purpose
15 |
16 | The laws of most jurisdictions throughout the world automatically confer
17 | exclusive Copyright and Related Rights (defined below) upon the creator
18 | and subsequent owner(s) (each and all, an "owner") of an original work of
19 | authorship and/or a database (each, a "Work").
20 |
21 | Certain owners wish to permanently relinquish those rights to a Work for
22 | the purpose of contributing to a commons of creative, cultural and
23 | scientific works ("Commons") that the public can reliably and without fear
24 | of later claims of infringement build upon, modify, incorporate in other
25 | works, reuse and redistribute as freely as possible in any form whatsoever
26 | and for any purposes, including without limitation commercial purposes.
27 | These owners may contribute to the Commons to promote the ideal of a free
28 | culture and the further production of creative, cultural and scientific
29 | works, or to gain reputation or greater distribution for their Work in
30 | part through the use and efforts of others.
31 |
32 | For these and/or other purposes and motivations, and without any
33 | expectation of additional consideration or compensation, the person
34 | associating CC0 with a Work (the "Affirmer"), to the extent that he or she
35 | is an owner of Copyright and Related Rights in the Work, voluntarily
36 | elects to apply CC0 to the Work and publicly distribute the Work under its
37 | terms, with knowledge of his or her Copyright and Related Rights in the
38 | Work and the meaning and intended legal effect of CC0 on those rights.
39 |
40 | 1. Copyright and Related Rights. A Work made available under CC0 may be
41 | protected by copyright and related or neighboring rights ("Copyright and
42 | Related Rights"). Copyright and Related Rights include, but are not
43 | limited to, the following:
44 |
45 | i. the right to reproduce, adapt, distribute, perform, display,
46 | communicate, and translate a Work;
47 | ii. moral rights retained by the original author(s) and/or performer(s);
48 | iii. publicity and privacy rights pertaining to a person's image or
49 | likeness depicted in a Work;
50 | iv. rights protecting against unfair competition in regards to a Work,
51 | subject to the limitations in paragraph 4(a), below;
52 | v. rights protecting the extraction, dissemination, use and reuse of data
53 | in a Work;
54 | vi. database rights (such as those arising under Directive 96/9/EC of the
55 | European Parliament and of the Council of 11 March 1996 on the legal
56 | protection of databases, and under any national implementation
57 | thereof, including any amended or successor version of such
58 | directive); and
59 | vii. other similar, equivalent or corresponding rights throughout the
60 | world based on applicable law or treaty, and any national
61 | implementations thereof.
62 |
63 | 2. Waiver. To the greatest extent permitted by, but not in contravention
64 | of, applicable law, Affirmer hereby overtly, fully, permanently,
65 | irrevocably and unconditionally waives, abandons, and surrenders all of
66 | Affirmer's Copyright and Related Rights and associated claims and causes
67 | of action, whether now known or unknown (including existing as well as
68 | future claims and causes of action), in the Work (i) in all territories
69 | worldwide, (ii) for the maximum duration provided by applicable law or
70 | treaty (including future time extensions), (iii) in any current or future
71 | medium and for any number of copies, and (iv) for any purpose whatsoever,
72 | including without limitation commercial, advertising or promotional
73 | purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
74 | member of the public at large and to the detriment of Affirmer's heirs and
75 | successors, fully intending that such Waiver shall not be subject to
76 | revocation, rescission, cancellation, termination, or any other legal or
77 | equitable action to disrupt the quiet enjoyment of the Work by the public
78 | as contemplated by Affirmer's express Statement of Purpose.
79 |
80 | 3. Public License Fallback. Should any part of the Waiver for any reason
81 | be judged legally invalid or ineffective under applicable law, then the
82 | Waiver shall be preserved to the maximum extent permitted taking into
83 | account Affirmer's express Statement of Purpose. In addition, to the
84 | extent the Waiver is so judged Affirmer hereby grants to each affected
85 | person a royalty-free, non transferable, non sublicensable, non exclusive,
86 | irrevocable and unconditional license to exercise Affirmer's Copyright and
87 | Related Rights in the Work (i) in all territories worldwide, (ii) for the
88 | maximum duration provided by applicable law or treaty (including future
89 | time extensions), (iii) in any current or future medium and for any number
90 | of copies, and (iv) for any purpose whatsoever, including without
91 | limitation commercial, advertising or promotional purposes (the
92 | "License"). The License shall be deemed effective as of the date CC0 was
93 | applied by Affirmer to the Work. Should any part of the License for any
94 | reason be judged legally invalid or ineffective under applicable law, such
95 | partial invalidity or ineffectiveness shall not invalidate the remainder
96 | of the License, and in such case Affirmer hereby affirms that he or she
97 | will not (i) exercise any of his or her remaining Copyright and Related
98 | Rights in the Work or (ii) assert any associated claims and causes of
99 | action with respect to the Work, in either case contrary to Affirmer's
100 | express Statement of Purpose.
101 |
102 | 4. Limitations and Disclaimers.
103 |
104 | a. No trademark or patent rights held by Affirmer are waived, abandoned,
105 | surrendered, licensed or otherwise affected by this document.
106 | b. Affirmer offers the Work as-is and makes no representations or
107 | warranties of any kind concerning the Work, express, implied,
108 | statutory or otherwise, including without limitation warranties of
109 | title, merchantability, fitness for a particular purpose, non
110 | infringement, or the absence of latent or other defects, accuracy, or
111 | the present or absence of errors, whether or not discoverable, all to
112 | the greatest extent permissible under applicable law.
113 | c. Affirmer disclaims responsibility for clearing rights of other persons
114 | that may apply to the Work or any use thereof, including without
115 | limitation any person's Copyright and Related Rights in the Work.
116 | Further, Affirmer disclaims responsibility for obtaining any necessary
117 | consents, permissions or other rights required for any use of the
118 | Work.
119 | d. Affirmer understands and acknowledges that Creative Commons is not a
120 | party to this document and has no duty or obligation with respect to
121 | this CC0 or use of the Work.
122 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Knowledge graph paper examples
2 |
3 | This repository contains examples in concrete syntaxes from the Knowledge Graphs published with ACM CSUR.
4 |
5 | If you find any material in the paper or this repository useful, please cite it as:
6 |
7 | ```bibtex
8 | @article{DBLP:journals/csur/HoganBCdMGKGNNN21,
9 | author = {Aidan Hogan and
10 | Eva Blomqvist and
11 | Michael Cochez and
12 | Claudia d'Amato and
13 | Gerard de Melo and
14 | Claudio Guti{\'{e}}rrez and
15 | Sabrina Kirrane and
16 | Jos{\'{e}} Emilio Labra Gayo and
17 | Roberto Navigli and
18 | Sebastian Neumaier and
19 | Axel{-}Cyrille Ngonga Ngomo and
20 | Axel Polleres and
21 | Sabbir M. Rashid and
22 | Anisa Rula and
23 | Lukas Schmelzeisen and
24 | Juan F. Sequeda and
25 | Steffen Staab and
26 | Antoine Zimmermann},
27 | title = {Knowledge Graphs},
28 | journal = {{ACM} Comput. Surv.},
29 | volume = {54},
30 | number = {4},
31 | pages = {71:1--71:37},
32 | year = {2021},
33 | url = {https://doi.org/10.1145/3447772},
34 | doi = {10.1145/3447772},
35 | timestamp = {Thu, 14 Oct 2021 09:18:45 +0200},
36 | biburl = {https://dblp.org/rec/journals/csur/HoganBCdMGKGNNN21.bib},
37 | bibsource = {dblp computer science bibliography, https://dblp.org}
38 | }
39 | ```
40 |
41 | See also the extended version as a book: [Hogan, A., et al. (2021). Knowledge Graphs. Morgan and Claypool.](https://kgbook.org/)
42 |
43 | ## Overview
44 |
45 | In the paper, we opted to keep examples on a high level, in order (1) to be able to focus on the respective theoretical concepts we are explaining, (2) to not confuse newcomers with possibly confusing low level details of concrete syntaxes, and (3) to have the paper still be understandable when currently popular syntaxes inevitable fall out of favor.
46 | Nevertheless, for newcomers that are interested to learn how these theoretical concepts are implemented in practice, in this repository we provide concrete code implementation of the examples and figures of our paper.
47 |
48 | The examples are divided into folders for each subsection according to the ACM CSUR version of the paper.
49 | To find a particular example you can also search by the name of a particular figure in the repository (e.g., "figure4", "table2", etc.).
50 | In cases where there are multiple competing standards to implement some concepts, we try to include all.
51 | Thus, there are sometimes multiple implementations per figure with different file extensions.
52 |
53 | Since many different file formats and standards are used in this repository, we try to include comments that point to documentation of the respecitve standards, indicate where you can try out the examples online, or otherwise where you can find code relating to the example and the discussion it the paper.
54 |
55 | ## Resources
56 |
57 | The following is a list of resources linked to in the respective examples:
58 |
59 | * [RDFShape](https://rdfshape.weso.es/) (RDF, RDFS, OWL, SHACL, ShEx)
60 | * [RDF Playground](http://rdfplayground.dcc.uchile.cl/) (RDF, RDFS, OWL, SHACL, ShEx)
61 | * [Neo4j Sandbox](https://sandbox.neo4j.com/) (Cypher/Property Graphs)
62 | * [RDF* Implementations](https://github.com/w3c/rdf-star) (RDF*)
63 | * [AnQL](https://github.com/nunolopes/anql) (Annotated RDF/AnQL)
64 | * [RIF Implementations](https://www.w3.org/2005/rules/wiki/Implementations) (Rules)
65 | * [Virtuoso's SPARQL-BI](https://medium.com/virtuoso-blog/graph-analytics-using-virtuosos-sparql-bi-extensions-to-sparql-5e75b4be32b3) (Graph analytics on RDF)
66 | * PageRank in [Giraph](https://github.com/usi-systems/giraph-pagerank), [GraphX](https://spark.apache.org/docs/1.6.1/api/java/org/apache/spark/graphx/lib/PageRank.html), [Signal/Collect](https://uzh.github.io/signal-collect/)
67 | * [TransE visualisations](http://www.ccri.com/2018/06/27/use-transe-effectively/)
68 | * [OpenKE](https://github.com/thunlp/OpenKE) (Implementations of TransE, TransH, TransR, TransD, DistMult, RESCAL, HoIE, ComplEx, SimplE, etc.)
69 | * [GNNs in Pytorch](https://towardsdatascience.com/hands-on-graph-neural-networks-with-pytorch-pytorch-geometric-359487e221a8) (GraphSAGE)
70 | * [AMIE+](https://github.com/samehkamaleldin/amie_plus) (Rule Mining)
71 | * [DL Learner](https://dl-learner.org/) (DL Axiom Mining)
72 |
73 | ## Contributing
74 |
75 | Please feel free to submit [bug reports](https://github.com/knowledge-graphs-tutorial/examples/issues) and [pull requests](https://github.com/knowledge-graphs-tutorial/examples/pulls)!
76 |
77 | For example, if you are a lecturer and structures your slides after the paper, you might create additional examples or step-by-step calculations to explain the paper's concepts to your students.
78 | Feel free to add those to this repository!
79 |
80 | ## License
81 |
82 | 
83 |
84 | To the extent possible under law, the contributors waive all copyright and related or neighboring rights to the contents of this repository.
85 |
--------------------------------------------------------------------------------
/Section2_Data_Graphs/2_1_1_Directed_edge_labelled_graphs/figure1.ttl:
--------------------------------------------------------------------------------
1 | # Turtle
2 | # Documentation: https://www.w3.org/TR/turtle/
3 | # Try online: https://rdfshape.weso.es/
4 | # Try online: http://rdfplayground.dcc.uchile.cl/
5 |
6 | prefix :
7 | prefix rdf:
8 | prefix xsd:
9 |
10 |
11 | :EID15 :name "Ñam" ;
12 | rdf:type :OpenMarket , :FoodFestival , :DrinksFestival ;
13 | :venue :SantaLucía ;
14 | :start "2018-03-22T12:00:00"^^xsd:dateTime ;
15 | :end "2018-03-29T20:00:00"^^xsd:dateTime .
16 |
17 | :SantaLucía :city :Santiago .
18 |
19 | :EID16 :name "Food Truck" ;
20 | rdf:type :OpenMarket, :FoodFestival ;
21 | :venue :Sotomayor, :PiscinaOlímpica .
22 |
23 | :Sotomayor :city :ViñaDelMar .
24 |
25 | :PiscinaOlímpica :city :Arica .
26 |
27 | :ViñaDelMar :bus :Santiago, :Arica ;
28 | :flight :Santiago .
29 |
30 | :Arica :bus :ViñaDelMar ;
31 | :flight :Santiago .
32 |
33 | :Santiago :bus :ViñaDelMar ;
34 | :flight :ViñaDelMar, :Arica .
35 |
--------------------------------------------------------------------------------
/Section2_Data_Graphs/2_1_2_Heterogeneous_graphs/figure2a.ttl:
--------------------------------------------------------------------------------
1 | # Turtle
2 | # Documentation: https://www.w3.org/TR/turtle/
3 | # Try online: https://rdfshape.weso.es/
4 | # Try online: http://rdfplayground.dcc.uchile.cl/
5 |
6 | prefix :
7 | prefix rdf:
8 |
9 | :Santiago rdf:type :City ;
10 | :capital :Chile .
11 |
12 | :Chile rdf:type :Country ;
13 | :borders :Perú .
14 |
15 | :Perú rdf:type :Country ;
16 | :borders :Chile .
17 |
--------------------------------------------------------------------------------
/Section2_Data_Graphs/2_1_2_Heterogeneous_graphs/figure2b.cypher:
--------------------------------------------------------------------------------
1 | // Neo4j / Cypher
2 | // Documentation: https://neo4j.com/docs/cypher-manual/current/
3 | // Try online: https://sandbox.neo4j.com/
4 | CREATE (Santiago:City)-[:capital]->(Chile:Country)-[borders]->(Peru:Country)-[borders]->(Chile)
5 |
--------------------------------------------------------------------------------
/Section2_Data_Graphs/2_1_3_Property_graphs/figure3a.ttl:
--------------------------------------------------------------------------------
1 | # Turtle
2 | # Documentation: https://www.w3.org/TR/turtle/
3 | # Try online: https://rdfshape.weso.es/
4 | # Try online: http://rdfplayground.dcc.uchile.cl/
5 | # Note that to express common concepts like lattitude and longitude, in practice
6 | # you should probably use standardized vocabularies like the Basic Geo (WGS84
7 | # lat/long) Vocabular: https://www.w3.org/2003/01/geo/
8 | # To keep the examples simples and consistent we decided against this here, see
9 | # https://github.com/knowledge-graphs-tutorial/examples/issues/4
10 | 01234567890123456789012345678901234567890123456789012345678901234567890123456789
11 |
12 | prefix :
13 | prefix rdf:
14 |
15 |
16 | :LA380 :company :LATAM ;
17 | :mode :Flight ;
18 | :from :Santiago ;
19 | :to :Arica .
20 |
21 | :LA381 :company :LATAM ;
22 | :mode :Flight ;
23 | :from :Arica ;
24 | :to :Santiago .
25 |
26 | :Santiago rdf:type :CapitalCity ;
27 | :lat -33.45 ;
28 | :long -70.66 .
29 |
30 | :Arica rdf:type :PortCity ;
31 | :lat -18.48 ;
32 | :long -70.33 .
33 |
--------------------------------------------------------------------------------
/Section2_Data_Graphs/2_1_3_Property_graphs/figure3b.cypher:
--------------------------------------------------------------------------------
1 | // Neo4j / Cypher
2 | // Documentation: https://neo4j.com/docs/cypher-manual/current/
3 | // Try online: https://sandbox.neo4j.com/
4 | CREATE (Santiago:CapitalCity { name: 'Santiago' , lat: -33.45 , long: -70.66 })-[:flight { code: 'LA380' , company: 'LATAM' }]->(Arica:PortCity { name: 'Arica' , lat: -18.48 , long: -70.33 })-[:flight { code: 'LA381' , company: 'LATAM' }]->(Santiago)
5 |
--------------------------------------------------------------------------------
/Section2_Data_Graphs/2_1_4_Graph_dataset/figure4.trig:
--------------------------------------------------------------------------------
1 | # Trig
2 | # Documentation: https://www.w3.org/TR/trig/
3 |
4 | prefix :
5 | prefix rdf:
6 | prefix xsd:
7 |
8 | :Events {
9 | :EID15 :name "Ñam" ;
10 | rdf:type :OpenMarket , :FoodFestival , :DrinksFestival ;
11 | :venue :SantaLucía ;
12 | :start "2018-03-22T12:00:00"^^xsd:dateTime ;
13 | :end "2018-03-29T20:00:00"^^xsd:dateTime .
14 |
15 | :SantaLucía :city :Santiago .
16 |
17 | :EID16 :name "Food Truck" ;
18 | rdf:type :OpenMarket, :FoodFestival ;
19 | :venue :Sotomayor, :PiscinaOlímpica .
20 |
21 | :Sotomayor :city :ViñaDelMar .
22 |
23 | :PiscinaOlímpica :city :Arica .
24 | }
25 |
26 | :Routes {
27 | :ViñaDelMar :bus :Santiago, :Arica ;
28 | :flight :Santiago .
29 |
30 | :Arica :bus :ViñaDelMar ;
31 | :flight :Santiago .
32 |
33 | :Santiago :bus :ViñaDelMar ;
34 | :flight :ViñaDelMar, :Arica .
35 | }
36 |
37 | # default graph
38 | {
39 | :Routes :updated "2018-04-03"^^xsd:date .
40 | :Events :updated "2018-06-14"^^xsd:date .
41 | }
42 |
--------------------------------------------------------------------------------
/Section2_Data_Graphs/2_2_1_Graph_patterns/README.md:
--------------------------------------------------------------------------------
1 | The query can be run using any SPARQL processor. You can also run the query online using RDFShape following [this link](https://tinyurl.com/y384u3bt).
2 |
--------------------------------------------------------------------------------
/Section2_Data_Graphs/2_2_1_Graph_patterns/figure5.sparql:
--------------------------------------------------------------------------------
1 | # SPARQL 1.1
2 | # Data: figure1.ttl
3 | # Documentation: https://www.w3.org/TR/sparql11-query/
4 | # Try online: https://rdfshape.weso.es/
5 | # Try online: http://sparql-playground.sib.swiss/
6 | # Try online: http://rdfplayground.dcc.uchile.cl/
7 |
8 | PREFIX :
9 | PREFIX rdf:
10 |
11 | SELECT ?ev ?vn1 ?vn2 {
12 | ?ev rdf:type :FoodFestival .
13 | ?ev :venue ?vn1 .
14 | ?ev :venue ?vn2 .
15 | }
16 |
--------------------------------------------------------------------------------
/Section2_Data_Graphs/2_2_2_Complex_graph_patterns/figure6.sparql:
--------------------------------------------------------------------------------
1 | # SPARQL 1.1
2 | # Data: figure1.ttl
3 | # Documentation: https://www.w3.org/TR/sparql11-query/
4 | # Try online: https://rdfshape.weso.es/
5 | # Try online: http://sparql-playground.sib.swiss/
6 | # Try online: http://rdfplayground.dcc.uchile.cl/
7 |
8 | PREFIX :
9 | PREFIX rdf:
10 |
11 | SELECT ?event ?name ?start {
12 | {
13 | {
14 | {
15 | ?event rdf:type :FoodFestival . #Q1
16 | }
17 | UNION
18 | {
19 | ?event rdf:type :DrinksFestival . #Q2
20 | }
21 | MINUS
22 | {
23 | ?event :venue ?venue . #Q5
24 | ?venue :city :Santiago .
25 | }
26 | } OPTIONAL {
27 | ?event :start ?start . #Q3
28 | }
29 | } OPTIONAL {
30 | ?event :name ?name #Q4
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/Section2_Data_Graphs/2_2_3_Navigational_graph_patterns/figure7.sparql:
--------------------------------------------------------------------------------
1 | # SPARQL 1.1
2 | # Data: figure1.ttl
3 | # Documentation: https://www.w3.org/TR/sparql11-query/
4 | # Try online: https://rdfshape.weso.es/
5 | # Try online: http://sparql-playground.sib.swiss/
6 | # Try online: http://rdfplayground.dcc.uchile.cl/
7 |
8 | PREFIX :
9 | PREFIX rdf:
10 |
11 | SELECT ?event ?name ?city {
12 | ?event :name ?name ;
13 | rdf:type :FoodFestival .
14 | :Arica (:bus|:flight)* ?city .
15 | ?city ^(:venue/:city) ?event .
16 | }
17 |
--------------------------------------------------------------------------------
/Section2_Data_Graphs/2_3_1_Shapes_graphs/README.md:
--------------------------------------------------------------------------------
1 | The example can be run using [shex-s](http://www.weso.es/shex-s/) with the following invocation:
2 |
3 | ```
4 | shex-s --dataFile figure1.ttl --schemaFile figure7.shex --shapeMap :EID15@:Event,:EID16@:Event
5 | ```
6 |
7 | It can also be run using the online [rdfshape demo](http://rdfshape.weso.es) with the [following permalink](https://tinyurl.com/yyfq2p4f).
8 |
--------------------------------------------------------------------------------
/Section2_Data_Graphs/2_3_1_Shapes_graphs/figure8.shapeMap:
--------------------------------------------------------------------------------
1 | :EID15@:Event,:EID16@:Event
2 |
--------------------------------------------------------------------------------
/Section2_Data_Graphs/2_3_1_Shapes_graphs/figure8.shex:
--------------------------------------------------------------------------------
1 | # ShEx
2 | # Data: figure1.ttl
3 | # Documentation: http://shex.io/
4 | # Try online: https://rdfshape.weso.es/shExValidate
5 |
6 | prefix :
7 | prefix rdf:
8 | prefix xsd:
9 |
10 | :Place {
11 | :flight @:Place * ;
12 | :bus @:Place * ;
13 | :lat xsd:float ? ;
14 | :long xsd:float ?
15 | }
16 |
17 | :Event {
18 | :name xsd:string * ;
19 | :start xsd:dateTime ;
20 | :end xsd:dateTime ;
21 | rdf:type . + ;
22 | :venue @:Venue +
23 | }
24 |
25 | :Venue @:Place AND {
26 | :indoor xsd:boolean ? ;
27 | :city @:City ?
28 | }
29 |
30 | :City @:Place AND {
31 | :population xsd:integer MinExclusive 5000 ?
32 | }
33 |
34 |
--------------------------------------------------------------------------------
/Section2_Data_Graphs/2_4_2_Reification/figure9a.ttl:
--------------------------------------------------------------------------------
1 | # Turtle
2 | # Documentation: https://www.w3.org/TR/turtle/
3 | # Try online: https://rdfshape.weso.es/
4 | # Try online: http://rdfplayground.dcc.uchile.cl/
5 |
6 | prefix :
7 | prefix xsd:
8 | prefix rdf:
9 |
10 | :e rdf:subject :Santiago ;
11 | rdf:predicate :flight ;
12 | rdf:object :Arica ;
13 | :validFrom "1956"^^xsd:gYear .
14 |
--------------------------------------------------------------------------------
/Section2_Data_Graphs/2_4_2_Reification/figure9b.ttl:
--------------------------------------------------------------------------------
1 | # Turtle
2 | # Documentation: https://www.w3.org/TR/turtle/
3 | # Try online: https://rdfshape.weso.es/
4 | # Try online: http://rdfplayground.dcc.uchile.cl/
5 |
6 | prefix :
7 | prefix xsd:
8 | prefix rdf:
9 |
10 | :Santiago :flight :e .
11 | :e rdf:value :Arica ;
12 | :validFrom "1956"^^xsd:gYear .
13 |
--------------------------------------------------------------------------------
/Section2_Data_Graphs/2_4_2_Reification/figure9c.ttl:
--------------------------------------------------------------------------------
1 | # Turtle
2 | # Documentation: https://www.w3.org/TR/turtle/
3 | # Try online: https://rdfshape.weso.es/
4 | # Try online: http://rdfplayground.dcc.uchile.cl/
5 |
6 | prefix :
7 | prefix xsd:
8 |
9 | :Santiago :e :Arica .
10 | :e :singletonPropertyOf :flight ;
11 | :validFrom "1956"^^xsd:gYear .
12 |
--------------------------------------------------------------------------------
/Section2_Data_Graphs/2_4_3_Higher_arity_representation/figure10a.trig:
--------------------------------------------------------------------------------
1 | # Trig
2 | # Documentation: https://www.w3.org/TR/trig/
3 | # Try online: https://rdfshape.weso.es/
4 |
5 | prefix :
6 | prefix xsd:
7 |
8 | :e {
9 | :Santiago :flight :Arica .
10 | }
11 |
12 | # default graph
13 | {
14 | :e :validFrom "1956"^^xsd:gYear .
15 | }
16 |
--------------------------------------------------------------------------------
/Section2_Data_Graphs/2_4_3_Higher_arity_representation/figure10b.cypher:
--------------------------------------------------------------------------------
1 | // Neo4j / Cypher
2 | // Documentation: https://neo4j.com/docs/cypher-manual/current/
3 | // Try online: https://sandbox.neo4j.com/
4 | CREATE (Santiago { name: 'Santiago' })-[:flight { validFrom: 1956 }]->(Arica { name: 'Arica' })
5 |
--------------------------------------------------------------------------------
/Section2_Data_Graphs/2_4_3_Higher_arity_representation/figure10c.rdfstar:
--------------------------------------------------------------------------------
1 | # RDF*
2 | # Documentation: https://w3c.github.io/rdf-star/
3 | # Try online: https://github.com/w3c/rdf-star
4 |
5 | prefix :
6 | prefix xsd:
7 |
8 | << :Santiago :flight :Arica >> :validFrom "1956"^^xsd:gYear .
9 |
--------------------------------------------------------------------------------
/Section2_Data_Graphs/2_4_4_Annotations/figure11g.n4:
--------------------------------------------------------------------------------
1 | # N4
2 | # Documentation: https://github.com/nunolopes/anql
3 | # Documentation: https://arxiv.org/pdf/1103.1255.pdf
4 | # Source code: https://github.com/nunolopes/anql
5 |
6 | @domain .
7 |
8 | prefix :
9 | prefix xsd:
10 |
11 | :Santiago :flight :Arica "[[1,125], [200,365]]" .
12 | :Santiago :flight :PuntaArenas "[[1,120], [220,365]]" .
13 | :EID16 :city :Arica "[[123,130]]" .
14 | :EID17 :city :Arica "[[276,279]]" .
15 | :EID18 :city :PuntaArenas "[[150,152]]" .
16 |
--------------------------------------------------------------------------------
/Section2_Data_Graphs/2_4_4_Annotations/figure11q.sparql:
--------------------------------------------------------------------------------
1 | # SPARQL 1.1
2 | # Data: figure10g.n4
3 | # Documentation: https://www.w3.org/TR/sparql11-query/
4 | # Source code: https://github.com/nunolopes/anql
5 |
6 | PREFIX :
7 |
8 | SELECT ?city {
9 | :Santiago :flight ?city .
10 | ?event :city ?city .
11 | }
12 |
--------------------------------------------------------------------------------
/Section3_Deductive_Knowledge/3_1_4_Individuals/table2.ttl:
--------------------------------------------------------------------------------
1 | # Turtle / OWL 2
2 | # Data: figure11-data.ttl
3 | # Documentation (Turtle): https://www.w3.org/TR/turtle/
4 | # Documentation (OWL 2): https://www.w3.org/TR/owl2-primer/
5 | # Try online: https://rdfshape.weso.es/
6 | # Try online: http://rdfplayground.dcc.uchile.cl/
7 |
8 | prefix :
9 | prefix owl:
10 | prefix rdf:
11 |
12 | # OWL 2 DL Compliance:
13 | :capital rdf:type owl:ObjectProperty .
14 |
15 | # Assertion
16 | :Chile :capital :Santiago .
17 |
18 | # Negation
19 | _:n rdf:type owl:NegativePropertyAssertion ;
20 | owl:sourceIndividual :Chile ;
21 | owl:assertionProperty :capital ;
22 | owl:targetIndividual :Arica .
23 |
24 | # SameAs
25 | :RegiónV owl:sameAs :RegiónDeValparaíso .
26 |
27 | # Different From
28 | :Valparaíso owl:differentFrom :RegiónDeValparaíso .
29 |
--------------------------------------------------------------------------------
/Section3_Deductive_Knowledge/3_1_5_Properties/table3.ttl:
--------------------------------------------------------------------------------
1 | # Turtle / OWL 2
2 | # Data: figure11-data.ttl
3 | # Documentation (Turtle): https://www.w3.org/TR/turtle/
4 | # Documentation (OWL 2): https://www.w3.org/TR/owl2-primer/
5 | # Try online: https://rdfshape.weso.es/
6 | # Try online: http://rdfplayground.dcc.uchile.cl/
7 |
8 | prefix :
9 | prefix owl:
10 | prefix rdf:
11 | prefix rdfs:
12 |
13 | # OWL 2 DL Compliance:
14 | :venue rdf:type owl:ObjectProperty .
15 | :location rdf:type owl:ObjectProperty .
16 | :hosts rdf:type owl:ObjectProperty .
17 | :partOf rdf:type owl:ObjectProperty .
18 | :nearby rdf:type owl:ObjectProperty .
19 | :capital rdf:type owl:ObjectProperty .
20 | :partOf rdf:type owl:ObjectProperty .
21 | :flight rdf:type owl:ObjectProperty .
22 |
23 | :start rdf:type owl:DatatypeProperty .
24 | :begins rdf:type owl:DatatypeProperty .
25 | :population rdf:type owl:DatatypeProperty .
26 | :lat rdf:type owl:DatatypeProperty .
27 | :long rdf:type owl:DatatypeProperty .
28 |
29 | :Event rdf:type owl:Class .
30 | :Venue rdf:type owl:Class .
31 | :City rdf:type owl:Class .
32 |
33 | # Subproperty
34 | :venue rdfs:subPropertyOf :location .
35 |
36 | # Domain
37 | :venue rdfs:domain :Event .
38 |
39 | # Range
40 | :venue rdfs:range :Venue .
41 |
42 | # Equivalence
43 | :start owl:equivalentProperty :begins .
44 |
45 | # Inverse
46 | :venue owl:inverseOf :hosts .
47 |
48 | # Disjoint
49 | :venue owl:propertyDisjointWith :hosts .
50 |
51 | # Transitive
52 | :partOf rdf:type owl:TransitiveProperty .
53 |
54 | # Symmetric
55 | :nearby rdf:type owl:SymmetricProperty .
56 |
57 | # Asymmetric
58 | :capital rdf:type owl:AsymmetricProperty .
59 |
60 | # Reflexive
61 | :partOf rdf:type owl:ReflexiveProperty .
62 |
63 | # Irreflexive
64 | :flight rdf:type owl:IrreflexiveProperty .
65 |
66 | # Functional
67 | :population rdf:type owl:FunctionalProperty .
68 |
69 | # Inv. Functional
70 | :capital rdf:type owl:InverseFunctionalProperty .
71 |
72 | # Key
73 | :City owl:hasKey ( :lat :long ) .
74 |
75 | # Chain
76 | :location owl:propertyChainAxiom ( :location :partOf ) .
77 |
--------------------------------------------------------------------------------
/Section3_Deductive_Knowledge/3_1_6_Classes/table4.ttl:
--------------------------------------------------------------------------------
1 | # Turtle / OWL 2
2 | # Data: figure11-data.ttl
3 | # Documentation (Turtle): https://www.w3.org/TR/turtle/
4 | # Documentation (OWL 2): https://www.w3.org/TR/owl2-primer/
5 | # Try online: https://rdfshape.weso.es/
6 | # Try online: http://rdfplayground.dcc.uchile.cl/
7 |
8 | prefix :
9 | prefix owl:
10 | prefix rdf:
11 | prefix rdfs:
12 |
13 | # OWL 2 DL Compliance:
14 | :nationality rdf:type owl:ObjectProperty .
15 | :hasPart rdf:type owl:ObjectProperty .
16 | :driver rdf:type owl:ObjectProperty .
17 | :fluent rdf:type owl:ObjectProperty .
18 | :body rdf:type owl:ObjectProperty .
19 |
20 | :City rdf:type owl:Class .
21 | :Place rdf:type owl:Class .
22 | :Human rdf:type owl:Class .
23 | :Person rdf:type owl:Class .
24 | :Region rdf:type owl:Class .
25 | :Dead rdf:type owl:Class .
26 | :Alive rdf:type owl:Class .
27 | :Flight rdf:type owl:Class .
28 | :DomesticFlight rdf:type owl:Class .
29 | :InternationalFlight rdf:type owl:Class .
30 | :SelfDrivingTaxi rdf:type owl:Class .
31 | :Taxi rdf:type owl:Class .
32 | :SelfDriving rdf:type owl:Class .
33 | :EUState rdf:type owl:Class .
34 | :Weightless rdf:type owl:Class .
35 | :ChileanCitizen rdf:type owl:Class .
36 | :SelfDriving rdf:type owl:Class .
37 | :Polyglot rdf:type owl:Class .
38 | :BinaryStarSystem rdf:type owl:Class .
39 | :Star rdf:type owl:Class .
40 |
41 | # Note that while the definitions could be made
42 | # more simply as follows:
43 | #
44 | # :Dead owl:complementOf :alive .
45 | # :Flight owl:unionOf ( :DomesticFlight :InternationalFlight ) .
46 | # etc.
47 | #
48 | # This would make the ontologies OWL 2 Full, and
49 | # not OWL 2 DL compliant (which requires blank nodes
50 | # for class definitions). Hence we use equivalences:
51 | #
52 | # :Dead owl:equivalentClass [ owl:complementOf :alive ] .
53 | # :Flight owl:equivalentClass [ owl:unionOf ( :DomesticFlight :InternationalFlight ) ] .
54 | # etc.
55 |
56 | # Subclass
57 | :City rdfs:subClassOf :Place .
58 |
59 | # Equivalence
60 | :Human owl:equivalentClass :Person .
61 |
62 | # Disjoint
63 | :City owl:disjointWith :Region .
64 |
65 | # Complement
66 | :Dead owl:equivalentClass [ owl:complementOf :alive ] .
67 |
68 | # Union
69 | :Flight owl:equivalentClass [ owl:unionOf ( :DomesticFlight :InternationalFlight ) ] .
70 |
71 | # Intersection
72 | :SelfDrivingTaxi owl:equivalentClass [ owl:intersectionOf ( :SelfDriving :Taxi ) ] .
73 |
74 | # Enumeration
75 | :EUState owl:equivalentClass [ owl:oneOf ( :Austria :Belgium :Bulgaria :Croatia :Cyprus :Czechia :Denmark :Estonia :Finland :France :Germany :Greece :Hungary :Ireland :Italy :Latvia :Lithuania :Luxembourg :Malta :Netherlands :Poland :Portugal :Romania :Slovakia :Slovenia :Spain :Sweden ) ] .
76 |
77 | # Some Values
78 | :EUCitizen owl:equivalentClass [ owl:someValuesFrom :EUState ; owl:onProperty :nationality ] .
79 |
80 | # All Values
81 | :Weightless owl:equivalentClass [ owl:allValuesFrom :Weightless ; owl:onProperty :hasPart ] .
82 |
83 | # Has Value
84 | :ChileanCitizen owl:equivalentClass [ owl:hasValue :Chile ; owl:onProperty :nationality ] .
85 |
86 | # Has Self
87 | :SelfDriving owl:equivalentClass [ owl:hasSelf true ; owl:onProperty :driver ] .
88 |
89 | # Cardinality
90 | :Polyglot owl:equivalentClass [ owl:minCardinality 2 ; owl:onProperty :fluent ] .
91 |
92 | # Qualified Cardinality
93 | :Polyglot owl:equivalentClass [ owl:qualifiedCardinality 2 ; owl:onProperty :body ; owl:onClass :Star ] .
94 |
--------------------------------------------------------------------------------
/Section3_Deductive_Knowledge/3_3_1_Rules/figure13-ontology.ttl:
--------------------------------------------------------------------------------
1 | # Turtle / OWL 2
2 | # Data: figure12-data.ttl
3 | # Query: figure12-query.sparql
4 | # Documentation (Turtle): https://www.w3.org/TR/turtle/
5 | # Documentation (OWL 2): https://www.w3.org/TR/owl2-primer/
6 | # Try online: https://rdfshape.weso.es/
7 | # Try online: http://rdfplayground.dcc.uchile.cl/
8 |
9 | prefix :
10 | prefix owl:
11 | prefix rdfs:
12 |
13 | # for OWL 2 DL compliance
14 | :DrinksFestival a owl:Class .
15 | :FoodFestival a owl:Class .
16 | :Festival a owl:Class .
17 | :location a owl:ObjectProperty .
18 | :venue a owl:ObjectProperty .
19 | :city a owl:ObjectProperty .
20 |
21 | # class axioms
22 | :DrinksFestival rdfs:subClassOf :Festival .
23 | :FoodFestival rdfs:subClassOf :Festival .
24 |
25 | # property axioms
26 | :location owl:propertyChainAxiom ( :venue :city ) .
27 |
--------------------------------------------------------------------------------
/Section3_Deductive_Knowledge/3_3_1_Rules/figure13-query.sparql:
--------------------------------------------------------------------------------
1 | # SPARQL
2 | # Data: figure1.ttl
3 | # Ontology: figure11-ontology.ttl (not necessary as already rewritten)
4 | # Base query: figure11-query.sparql
5 | # Documentation: https://www.w3.org/TR/sparql11-query/
6 | # Try online: https://rdfshape.weso.es/
7 | # Try online: http://rdfplayground.dcc.uchile.cl/
8 |
9 | PREFIX :
10 | PREFIX rdf:
11 |
12 | SELECT DISTINCT ?name {
13 | {
14 | ?festival rdf:type :Festival .
15 | } UNION {
16 | ?festival rdf:type :FoodFestival .
17 | } UNION {
18 | ?festival rdf:type :DrinksFestival .
19 | }
20 |
21 | {
22 | ?festival :location :Santiago .
23 | } UNION {
24 | ?festival :venue ?x .
25 | ?x :city :Santiago .
26 | }
27 |
28 | ?festival :name ?name .
29 | }
30 |
--------------------------------------------------------------------------------
/Section3_Deductive_Knowledge/3_3_1_Rules/flight-rule.rif:
--------------------------------------------------------------------------------
1 | RIF-Core Presentation Syntax
2 | Documentation: https://www.w3.org/TR/rif-core/#RIF-Core_Presentation_Syntax
3 | Based on: https://www.w3.org/TR/rif-owl-rl/
4 | Implementations: https://www.w3.org/2005/rules/wiki/Implementations
5 |
6 | Document(
7 | Prefix(ex )
8 |
9 | Group(
10 | (* <#dom-flight> *)
11 | Forall ?x ?y ?z (
12 | ?x[ex:domesticFlight->?y] :- And(
13 | ?x[ex:flight->?y]
14 | ?y[ex:country->?z]
15 | ?x[ex:country->?z] ))
16 | )
17 | )
18 |
19 |
--------------------------------------------------------------------------------
/Section3_Deductive_Knowledge/3_3_1_Rules/sublass-rules.rif:
--------------------------------------------------------------------------------
1 | RIF-Core Presentation Syntax
2 | Documentation: https://www.w3.org/TR/rif-core/#RIF-Core_Presentation_Syntax
3 | Based on: https://www.w3.org/TR/rif-owl-rl/
4 | Implementations: https://www.w3.org/2005/rules/wiki/Implementations
5 |
6 | Document(
7 | Prefix(rdf )
8 | Prefix(rdfs )
9 |
10 | Group(
11 | (* <#cax-sco> *)
12 | Forall ?x ?c ?d (
13 | ?x[rdf:type->?d] :- And(
14 | ?x[rdf:type->?c]
15 | ?c[rdfs:subClassOf->?d] ))
16 |
17 | (* <#scm-sco> *)
18 | Forall ?c ?d ?e (
19 | ?c[rdfs:subClassOf->?e] :- And(
20 | ?c[rdfs:subClassOf->?d]
21 | ?d[rdfs:subClassOf->?e] ))
22 | )
23 | )
24 |
25 |
--------------------------------------------------------------------------------
/Section3_Deductive_Knowledge/figure12-query.sparql:
--------------------------------------------------------------------------------
1 | # SPARQL
2 | # Data: figure1.ttl
3 | # Ontology: figure13-ontology.ttl
4 | # Documentation: https://www.w3.org/TR/sparql11-query/
5 | # Try online: https://rdfshape.weso.es/
6 | # Try online: http://rdfplayground.dcc.uchile.cl/
7 |
8 | PREFIX :
9 | PREFIX rdf:
10 |
11 | SELECT ?name {
12 | ?festival rdf:type :Festival ;
13 | :location :Santiago ;
14 | :name ?name .
15 | }
16 |
--------------------------------------------------------------------------------
/Section4_Inductive_Knowledge/4_1_1_Graph_algorithms/figure15.ttl:
--------------------------------------------------------------------------------
1 | # Turtle
2 | # Documentation: https://www.w3.org/TR/turtle/
3 | # Try online: https://rdfshape.weso.es/
4 | # Try online: http://rdfplayground.dcc.uchile.cl/
5 | # Analytics: https://medium.com/virtuoso-blog/graph-analytics-using-virtuosos-sparql-bi-extensions-to-sparql-5e75b4be32b3
6 |
7 | prefix :
8 |
9 | :MoonValley :bus :PiedrasRojas .
10 |
11 | :PiedrasRojas :bus :LosFlamencos .
12 |
13 | :LosFlamencos :bus :SanPedro .
14 |
15 | :Calama :flight :Iquique , :Santiago ;
16 | :bus :SanPedro .
17 |
18 | :SanPedro :bus :MoonValley , :LosFlamencos , :Calama , :Arica .
19 |
20 | :Arica :flight :Santiago ;
21 | :bus :SanPedro .
22 |
23 | :Iquique :flight :Calama , :Santiago ;
24 | :bus :PuntaArenas .
25 |
26 | :Santiago :flight :Calama , :Arica , :Iquique , :EasterIsland , :PuntaArenas , :PuertoMontt ;
27 | :bus :PuertoVaras .
28 |
29 | :EasterIsland :flight :Santiago .
30 |
31 | :PuntaArenas :flight :Santiago , :PuertoMontt ;
32 | :bus :Iquique , :TorresDelPaine .
33 |
34 | :PuertoMontt :flight :Santiago , :PuntaArenas ;
35 | :bus :PuertoVaras .
36 |
37 | :PuertoVaras :bus :Santiago , :PuertoMontt , :OsornoVolcano .
38 |
39 | :TorresDelPaine :bus :GreyGlacier .
40 |
41 | :GreyGlacier :bus :PuntaArenas .
42 |
43 | :OsornoVolcano :bus :PuertoVaras .
44 |
--------------------------------------------------------------------------------
/Section4_Inductive_Knowledge/4_1_1_Graph_algorithms/figure16.ttl:
--------------------------------------------------------------------------------
1 | # Turtle
2 | # Documentation: https://www.w3.org/TR/turtle/
3 | # Try online: https://rdfshape.weso.es/
4 | # Try online: http://rdfplayground.dcc.uchile.cl/
5 | # Analytics: https://medium.com/virtuoso-blog/graph-analytics-using-virtuosos-sparql-bi-extensions-to-sparql-5e75b4be32b3
6 |
7 | prefix :
8 |
9 | _:n1 :flight _:n2 ;
10 | :elements ( :EasterIsland ) .
11 |
12 | _:n2 :flight _:n1 , _:n2 ;
13 | :bus _:n3 ;
14 | :elements ( :Arica :Calama :Iquique :PuertoMontt :PuntaArenas :Santiago ) .
15 |
16 | _:n3 :bus _:n2 , _:n3 ;
17 | :elements ( :GreyGlacier :LosFlamencos :MoonValley :OsornoVolcano :PiedrasRojas :PuertoVaras :SanPedro :TorresDelPaine ) .
18 |
19 |
--------------------------------------------------------------------------------
/Section4_Inductive_Knowledge/4_1_2_Graph_processing_frameworks/figure17.ttl:
--------------------------------------------------------------------------------
1 | # Turtle
2 | # Documentation: https://www.w3.org/TR/turtle/
3 | # Try online: https://rdfshape.weso.es/
4 | # Try online: http://rdfplayground.dcc.uchile.cl/
5 | # PageRank in Giraph (1): https://giraph.apache.org/pagerank.html
6 | # PageRank in Giraph (2): https://github.com/usi-systems/giraph-pagerank
7 | # PageRank in GraphX: https://spark.apache.org/docs/1.6.1/api/java/org/apache/spark/graphx/lib/PageRank.html
8 | # PageRank in Signal/Collect: https://uzh.github.io/signal-collect/
9 |
10 | prefix :
11 |
12 | :MoonValley :bus :PiedrasRojas .
13 |
14 | :PiedrasRojas :bus :LosFlamencos .
15 |
16 | :LosFlamencos :bus :SanPedro .
17 |
18 | :Calama :bus :SanPedro .
19 |
20 | :SanPedro :bus :MoonValley , :LosFlamencos , :Calama , :Arica .
21 |
22 | :Arica :bus :SanPedro .
23 |
--------------------------------------------------------------------------------
/Section4_Inductive_Knowledge/4_2_1_Translational_models/figure18.ttl:
--------------------------------------------------------------------------------
1 | # Turtle
2 | # Documentation: https://www.w3.org/TR/turtle/
3 | # Try online: https://rdfshape.weso.es/
4 | # Try online: http://rdfplayground.dcc.uchile.cl/
5 | # Embeddings: https://github.com/pykeen/pykeen
6 | # Embeddings: https://github.com/thunlp/OpenKE
7 | # TransE visualisations: http://www.ccri.com/2018/06/27/use-transe-effectively/
8 |
9 | prefix :
10 |
11 | :Antofagasta :northOf :Valparaíso .
12 |
13 | :Valparaíso :northOf :Licantén ;
14 | :westOf :Santiago .
15 |
16 | :Licantén :westOf :Curico .
17 |
18 | :Toconoa :northOf :Santiago .
19 |
20 | :Santiago :northOf :Curico .
21 |
--------------------------------------------------------------------------------
/Section4_Inductive_Knowledge/4_3_1_Recursive_graph_neural_networks/figure20.ttl:
--------------------------------------------------------------------------------
1 | # Turtle
2 | # Documentation: https://www.w3.org/TR/turtle/
3 | # Try online: https://rdfshape.weso.es/
4 | # Try online: http://rdfplayground.dcc.uchile.cl/
5 | # GNNs: https://towardsdatascience.com/hands-on-graph-neural-networks-with-pytorch-pytorch-geometric-359487e221a8
6 |
7 | prefix :
8 |
9 | :PuntaArenas :flight :PuertoMontt ;
10 | :bus :TorresDelPaine .
11 |
12 | :PuertoMontt :flight :PuntaArenas ;
13 | :bus :PuertoVaras .
14 |
15 | :PuertoVaras :bus :PuertoMontt , :OsornoVolcano .
16 |
17 | :TorresDelPaine :bus :GreyGlacier .
18 |
19 | :GreyGlacier :bus :PuntaArenas .
20 |
21 | :OsornoVolcano :bus :PuertoVaras .
22 |
--------------------------------------------------------------------------------
/Section4_Inductive_Knowledge/4_4_Symbolic_Learning/figure21.ttl:
--------------------------------------------------------------------------------
1 | # Turtle
2 | # Documentation: https://www.w3.org/TR/turtle/
3 | # Try online: https://rdfshape.weso.es/
4 | # Try online: http://rdfplayground.dcc.uchile.cl/
5 | # AMIE+: https://github.com/samehkamaleldin/amie_plus
6 | # DL Learner: https://dl-learner.org/
7 |
8 | prefix :
9 | prefix rdf:
10 |
11 | :Chile :capital :Santiago ;
12 | rdf:type :Country .
13 |
14 | :Peru :capital :Lima ;
15 | rdf:type :Country .
16 |
17 | :Iquique :nearby :IQQ ;
18 | :country :Chile .
19 |
20 | :IQQ :country :Chile ;
21 | :flight :ARI ;
22 | :domesticFlight :ARI ;
23 | rdf:type :DomesticAirport , :Airport .
24 |
25 | :Arica :nearby :ARI ;
26 | :country :Chile .
27 |
28 | :ARI :country :Chile ;
29 | :flight :IQQ , :SCL ;
30 | :domesticFlight :IQQ , :SCL ;
31 | rdf:type :DomesticAirport , :Airport .
32 |
33 | :Santiago :nearby :SCL ;
34 | :country :Chile .
35 |
36 | :SCL :flight :LIM ;
37 | :internationalFlight :LIM ;
38 | rdf:type :InternationalAirport , :Airport .
39 |
40 | :Lima :nearby :LIM .
41 |
42 | :LIM :country :Peru ;
43 | :flight :SCL ;
44 | :internationalFlight :SCL ;
45 | rdf:type :InternationalAirport , :Airport .
46 |
--------------------------------------------------------------------------------