Skip to content

Instantly share code, notes, and snippets.

@justin2004
Created May 31, 2025 13:55
Show Gist options
  • Select an option

  • Save justin2004/97b018e687c30d489c1da49e13a9ed46 to your computer and use it in GitHub Desktop.

Select an option

Save justin2004/97b018e687c30d489c1da49e13a9ed46 to your computer and use it in GitHub Desktop.
veggie pizza better definition
@prefix : <http://example.org/pizza#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
:hasTopping a owl:ObjectProperty .
:VegetablePizza a owl:Class ;
owl:equivalentClass [
a owl:Class ;
owl:intersectionOf (
:Pizza
[ a owl:Restriction ;
owl:onProperty :hasTopping ;
owl:someValuesFrom :VegetableTopping
]
[ a owl:Restriction ;
owl:onProperty :hasTopping ;
owl:allValuesFrom :VegetableTopping
]
)
] .
# not veggie pizza unless you turn off the (only :VegetableTopping) condition
:isItVeggie :hasTopping :pepper5 ;
a owl:NamedIndividual, :Pizza .
:fredPie a :VegetablePizza ;
# :hasTopping [ a :VegetableTopping ] ;
:hasTopping :topping99, :topping55 ; # these have to be veggie toppings
a owl:NamedIndividual .
:pepper5 a :VegetableTopping .
# this is also veggie pizza since it has some and only veggie toppings
:pie5 a owl:NamedIndividual, :Pizza ;
:hasTopping :pepper5 ;
rdf:type [
a owl:Restriction ;
owl:onProperty :hasTopping ;
owl:allValuesFrom [
owl:oneOf ( :pepper5 )
]
] .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment