Skip to content

Instantly share code, notes, and snippets.

@balhoff
Created February 24, 2022 17:23
Show Gist options
  • Save balhoff/62fb8f2c1e29bc0d4d27c3df0d005154 to your computer and use it in GitHub Desktop.
Save balhoff/62fb8f2c1e29bc0d4d27c3df0d005154 to your computer and use it in GitHub Desktop.
An example OWL ontology (Turtle syntax) using RDF lists (against the spec)
@prefix : <http://example.org/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@base <http://example.org/> .
<http://example.org/> rdf:type owl:Ontology .
#################################################################
# Object Properties
#################################################################
### http://example.org/contains
:contains rdf:type owl:ObjectProperty ;
owl:propertyChainAxiom ( rdf:rest
:contains
) .
### http://example.org/has_book
:has_book rdf:type owl:ObjectProperty ;
owl:propertyChainAxiom ( :has_books
:contains
) .
### http://example.org/has_books
:has_books rdf:type owl:ObjectProperty .
### http://www.w3.org/1999/02/22-rdf-syntax-ns#first
rdf:first rdf:type owl:ObjectProperty ;
rdfs:subPropertyOf :contains .
### http://www.w3.org/1999/02/22-rdf-syntax-ns#rest
rdf:rest rdf:type owl:ObjectProperty .
#################################################################
# Classes
#################################################################
### http://example.org/Book
:Book rdf:type owl:Class .
### http://example.org/Library
:Library rdf:type owl:Class ;
rdfs:subClassOf [ rdf:type owl:Restriction ;
owl:onProperty :has_books ;
owl:allValuesFrom [ rdf:type owl:Restriction ;
owl:onProperty :contains ;
owl:allValuesFrom :Book
]
] .
#################################################################
# Individuals
#################################################################
### http://example.org/moby_dick
:moby_dick rdf:type owl:NamedIndividual .
### http://example.org/the_library
:the_library rdf:type owl:NamedIndividual ,
:Library ;
:has_books _:genid7 .
_:genid7 rdf:first :the_republic ;
rdf:rest _:genid8 .
_:genid8 rdf:first :moby_dick ;
rdf:rest rdf:nil .
### http://example.org/the_republic
:the_republic rdf:type owl:NamedIndividual .
### http://www.w3.org/1999/02/22-rdf-syntax-ns#nil
rdf:nil rdf:type owl:NamedIndividual .
### Generated by the OWL API (version 4.5.9.2019-02-01T07:24:44Z) https://github.com/owlcs/owlapi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment