Examples from the lectures: Difference between revisions

From info216
No edit summary
 
(One intermediate revision by the same user not shown)
Line 15: Line 15:
</syntaxhighlight>
</syntaxhighlight>


<!--
==Lecture 2: RDF==
==Lecture 2: RDF==
Blank nodes for anonymity, or when we have not decided on a URI:
Blank nodes for anonymity, or when we have not decided on a URI:
Line 612: Line 613:
   ?s ?p ?o
   ?s ?p ?o
}
}
</syntaxhighlight>
==Lecture 10: OWL-DL==
Here is the OWL file with the minimal Protégé / HermiT example from S10. Save it with the ''.owl'' suffix, for example ''s10-example.owl'', and ''File -> Open'' it in Protégé.
<syntaxhighlight lang='owl'>
<?xml version="1.0"?>
<rdf:RDF xmlns="http://www.semanticweb.org/sinoa/ontologies/2023/2/untitled-ontology-3#"
    xml:base="http://www.semanticweb.org/sinoa/ontologies/2023/2/untitled-ontology-3"
    xmlns:owl="http://www.w3.org/2002/07/owl#"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:xml="http://www.w3.org/XML/1998/namespace"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
    xmlns:untitled-ontology-3="http://www.semanticweb.org/sinoa/ontologies/2023/2/untitled-ontology-3#">
    <owl:Ontology rdf:about="http://www.semanticweb.org/sinoa/ontologies/2023/2/untitled-ontology-3"/>
    <!--
    ///////////////////////////////////////////////////////////////////////////////////////
    //
    // Object Properties
    //
    ///////////////////////////////////////////////////////////////////////////////////////
    -->
    <!-- http://www.semanticweb.org/sinoa/ontologies/2023/2/untitled-ontology-3#hasSource -->
    <owl:ObjectProperty rdf:about="http://www.semanticweb.org/sinoa/ontologies/2023/2/untitled-ontology-3#hasSource"/>
    <!--
    ///////////////////////////////////////////////////////////////////////////////////////
    //
    // Classes
    //
    ///////////////////////////////////////////////////////////////////////////////////////
    -->
    <!-- http://www.semanticweb.org/sinoa/ontologies/2023/2/untitled-ontology-3#Content -->
    <owl:Class rdf:about="http://www.semanticweb.org/sinoa/ontologies/2023/2/untitled-ontology-3#Content"/>
    <!-- http://www.semanticweb.org/sinoa/ontologies/2023/2/untitled-ontology-3#Source -->
    <owl:Class rdf:about="http://www.semanticweb.org/sinoa/ontologies/2023/2/untitled-ontology-3#Source">
        <owl:equivalentClass>
            <owl:Restriction>
                <owl:onProperty>
                    <rdf:Description>
                        <owl:inverseOf rdf:resource="http://www.semanticweb.org/sinoa/ontologies/2023/2/untitled-ontology-3#hasSource"/>
                    </rdf:Description>
                </owl:onProperty>
                <owl:someValuesFrom rdf:resource="http://www.semanticweb.org/sinoa/ontologies/2023/2/untitled-ontology-3#Content"/>
            </owl:Restriction>
        </owl:equivalentClass>
    </owl:Class>
    <!--
    ///////////////////////////////////////////////////////////////////////////////////////
    //
    // Individuals
    //
    ///////////////////////////////////////////////////////////////////////////////////////
    -->
    <!-- http://www.semanticweb.org/sinoa/ontologies/2023/2/untitled-ontology-3#NYTimes -->
    <owl:NamedIndividual rdf:about="http://www.semanticweb.org/sinoa/ontologies/2023/2/untitled-ontology-3#NYTimes"/>
    <!-- http://www.semanticweb.org/sinoa/ontologies/2023/2/untitled-ontology-3#article_about_Trump_rally -->
    <owl:NamedIndividual rdf:about="http://www.semanticweb.org/sinoa/ontologies/2023/2/untitled-ontology-3#article_about_Trump_rally">
        <rdf:type rdf:resource="http://www.semanticweb.org/sinoa/ontologies/2023/2/untitled-ontology-3#Content"/>
        <hasSource rdf:resource="http://www.semanticweb.org/sinoa/ontologies/2023/2/untitled-ontology-3#NYTimes"/>
    </owl:NamedIndividual>
</rdf:RDF>
<!-- Generated by the OWL API (version 4.5.9.2019-02-01T07:24:44Z) https://github.com/owlcs/owlapi -->
</syntaxhighlight>
</syntaxhighlight>


Line 745: Line 675:
vector_neighbours(embeddings['oslo'] - embeddings['norway'] + embeddings['france'])
vector_neighbours(embeddings['oslo'] - embeddings['norway'] + embeddings['france'])
</syntaxhighlight>
</syntaxhighlight>
-->

Latest revision as of 10:54, 20 January 2025

This page currently shows the examples used in the Spring of 2023. It will be updated with examples from 2024 as the course progresses.

Lecture 1: Introduction to KGs

Turtle example:

@prefix ex: <http://example.org/> .
ex:Roger_Stone
    ex:name "Roger Stone" ;
    ex:occupation ex:lobbyist ;
    ex:significant_person ex:Donald_Trump .
ex:Donald_Trump
    ex:name "Donald Trump" .