Skip to content

Instantly share code, notes, and snippets.

@Richard-Degenne
Created August 6, 2018 12:48
Show Gist options
  • Save Richard-Degenne/b03aaaf71ac8cae7269bb411ba0710d6 to your computer and use it in GitHub Desktop.
Save Richard-Degenne/b03aaaf71ac8cae7269bb411ba0710d6 to your computer and use it in GitHub Desktop.
StacOverflow answer
@prefix : <http://www.example.com#> .
@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://www.example.com> .
<http://www.example.com> rdf:type owl:Ontology .
#################################################################
# Annotation properties
#################################################################
### http://swrl.stanford.edu/ontologies/3.3/swrla.owl#isRuleEnabled
<http://swrl.stanford.edu/ontologies/3.3/swrla.owl#isRuleEnabled> rdf:type owl:AnnotationProperty .
#################################################################
# Object Properties
#################################################################
### http://www.example.com#complements
:complements rdf:type owl:ObjectProperty ;
rdfs:subPropertyOf owl:topObjectProperty ;
rdf:type owl:SymmetricProperty ;
rdfs:domain :Taste ;
rdfs:range :Taste .
### http://www.example.com#goesWellWith
:goesWellWith rdf:type owl:ObjectProperty ;
rdfs:subPropertyOf owl:topObjectProperty ;
rdf:type owl:SymmetricProperty ;
rdfs:domain :Ingredient ;
rdfs:range :Ingredient .
### http://www.example.com#tastes
:tastes rdf:type owl:ObjectProperty ;
rdfs:subPropertyOf owl:topObjectProperty ;
rdfs:domain :Ingredient ;
rdfs:range :Taste .
#################################################################
# Classes
#################################################################
### http://www.example.com#Ingredient
:Ingredient rdf:type owl:Class .
### http://www.example.com#Taste
:Taste rdf:type owl:Class .
#################################################################
# Individuals
#################################################################
### http://www.example.com#bitter
:bitter rdf:type owl:NamedIndividual ,
:Taste ;
:complements :sweet .
### http://www.example.com#kale
:kale rdf:type owl:NamedIndividual ,
:Ingredient ;
:tastes :bitter .
### http://www.example.com#pear
:pear rdf:type owl:NamedIndividual ,
:Ingredient ;
:tastes :sweet .
### http://www.example.com#sweet
:sweet rdf:type owl:NamedIndividual ,
:Taste .
#################################################################
# Rules
#################################################################
:ingredient1 rdf:type <http://www.w3.org/2003/11/swrl#Variable> .
:taste1 rdf:type <http://www.w3.org/2003/11/swrl#Variable> .
:ingredient2 rdf:type <http://www.w3.org/2003/11/swrl#Variable> .
:taste2 rdf:type <http://www.w3.org/2003/11/swrl#Variable> .
[ <http://swrl.stanford.edu/ontologies/3.3/swrla.owl#isRuleEnabled> "true"^^xsd:boolean ;
rdfs:comment ""^^xsd:string ;
rdfs:label "Flavor combination"^^xsd:string ;
rdf:type <http://www.w3.org/2003/11/swrl#Imp> ;
<http://www.w3.org/2003/11/swrl#body> [ rdf:type <http://www.w3.org/2003/11/swrl#AtomList> ;
rdf:first [ rdf:type <http://www.w3.org/2003/11/swrl#IndividualPropertyAtom> ;
<http://www.w3.org/2003/11/swrl#propertyPredicate> :tastes ;
<http://www.w3.org/2003/11/swrl#argument1> :ingredient1 ;
<http://www.w3.org/2003/11/swrl#argument2> :taste1
] ;
rdf:rest [ rdf:type <http://www.w3.org/2003/11/swrl#AtomList> ;
rdf:first [ rdf:type <http://www.w3.org/2003/11/swrl#IndividualPropertyAtom> ;
<http://www.w3.org/2003/11/swrl#propertyPredicate> :tastes ;
<http://www.w3.org/2003/11/swrl#argument1> :ingredient2 ;
<http://www.w3.org/2003/11/swrl#argument2> :taste2
] ;
rdf:rest [ rdf:type <http://www.w3.org/2003/11/swrl#AtomList> ;
rdf:first [ rdf:type <http://www.w3.org/2003/11/swrl#IndividualPropertyAtom> ;
<http://www.w3.org/2003/11/swrl#propertyPredicate> :complements ;
<http://www.w3.org/2003/11/swrl#argument1> :taste1 ;
<http://www.w3.org/2003/11/swrl#argument2> :taste2
] ;
rdf:rest rdf:nil
]
]
] ;
<http://www.w3.org/2003/11/swrl#head> [ rdf:type <http://www.w3.org/2003/11/swrl#AtomList> ;
rdf:first [ rdf:type <http://www.w3.org/2003/11/swrl#IndividualPropertyAtom> ;
<http://www.w3.org/2003/11/swrl#propertyPredicate> :goesWellWith ;
<http://www.w3.org/2003/11/swrl#argument1> :ingredient1 ;
<http://www.w3.org/2003/11/swrl#argument2> :ingredient2
] ;
rdf:rest rdf:nil
]
] .
### Generated by the OWL API (version 4.2.8.20170104-2310) https://github.com/owlcs/owlapi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment