javaowlontologyowl-apimanchester-syntax

How-to serialize OWLClassExpression to triples


I am trying to parse a Manchester syntax class expression, and retrieve its corresponding RDF serialization triples. This question helped me a lot : OWLAPI : "ParserException" while converting String to Class Expression using ManchesterOWLSyntaxParser.

I want to move from Pizza and (not (hasTopping some FishTopping)) and (not (hasTopping some MeatTopping)) to

(_:fe7fad725e5c44e081bfa45c97ad15731, http://www.w3.org/2002/07/owl#intersectionOf, _:fe7fad725e5c44e081bfa45c97ad15732) [null]
(_:fe7fad725e5c44e081bfa45c97ad15731, http://www.w3.org/1999/02/22-rdf-syntax-ns#type, http://www.w3.org/2002/07/owl#Class) [null]
(_:fe7fad725e5c44e081bfa45c97ad15732, http://www.w3.org/1999/02/22-rdf-syntax-ns#first, http://www.co-ode.org/ontologies/pizza/pizza.owl#Pizza) [null]
(_:fe7fad725e5c44e081bfa45c97ad15732, http://www.w3.org/1999/02/22-rdf-syntax-ns#rest, _:fe7fad725e5c44e081bfa45c97ad15733) [null]
(_:fe7fad725e5c44e081bfa45c97ad15733, http://www.w3.org/1999/02/22-rdf-syntax-ns#first, _:fe7fad725e5c44e081bfa45c97ad15734) [null]
(_:fe7fad725e5c44e081bfa45c97ad15733, http://www.w3.org/1999/02/22-rdf-syntax-ns#rest, _:fe7fad725e5c44e081bfa45c97ad15736) [null]
(_:fe7fad725e5c44e081bfa45c97ad15734, http://www.w3.org/1999/02/22-rdf-syntax-ns#type, http://www.w3.org/2002/07/owl#Class) [null]
(_:fe7fad725e5c44e081bfa45c97ad15734, http://www.w3.org/2002/07/owl#complementOf, _:fe7fad725e5c44e081bfa45c97ad15735) [null]
(_:fe7fad725e5c44e081bfa45c97ad15735, http://www.w3.org/1999/02/22-rdf-syntax-ns#type, http://www.w3.org/2002/07/owl#Restriction) [null]
(_:fe7fad725e5c44e081bfa45c97ad15735, http://www.w3.org/2002/07/owl#onProperty, http://www.co-ode.org/ontologies/pizza/pizza.owl#hasTopping) [null]
(_:fe7fad725e5c44e081bfa45c97ad15735, http://www.w3.org/2002/07/owl#someValuesFrom, http://www.co-ode.org/ontologies/pizza/pizza.owl#FishTopping) [null]
(_:fe7fad725e5c44e081bfa45c97ad15736, http://www.w3.org/1999/02/22-rdf-syntax-ns#first, _:fe7fad725e5c44e081bfa45c97ad15737) [null]
(_:fe7fad725e5c44e081bfa45c97ad15736, http://www.w3.org/1999/02/22-rdf-syntax-ns#rest, http://www.w3.org/1999/02/22-rdf-syntax-ns#nil) [null]
(_:fe7fad725e5c44e081bfa45c97ad15737, http://www.w3.org/1999/02/22-rdf-syntax-ns#type, http://www.w3.org/2002/07/owl#Class) [null]
(_:fe7fad725e5c44e081bfa45c97ad15737, http://www.w3.org/2002/07/owl#complementOf, _:fe7fad725e5c44e081bfa45c97ad15738) [null]
(_:fe7fad725e5c44e081bfa45c97ad15738, http://www.w3.org/1999/02/22-rdf-syntax-ns#type, http://www.w3.org/2002/07/owl#Restriction) [null]
(_:fe7fad725e5c44e081bfa45c97ad15738, http://www.w3.org/2002/07/owl#onProperty, http://www.co-ode.org/ontologies/pizza/pizza.owl#hasTopping) [null]
(_:fe7fad725e5c44e081bfa45c97ad15738, http://www.w3.org/2002/07/owl#someValuesFrom, http://www.co-ode.org/ontologies/pizza/pizza.owl#MeatTopping) [null]

I can get from the original String to an OWLClassExpression. But then how do I get the corresponding set of triples from the OWLClassExpression ?

Thanks !


Solution

  • Put the classes in an axiom, the axiom in an ontology, and save with a triple oriented format such as ntriples.