RDF and OWL workflow question

2019-03-21 16:56发布

问题:

I have been looking at and playing with OWL through Protege and I would like to know if I understand the "workflow" and idea of it correctly (for building up a database from scratch:

  1. Generate an OWL ontology for your data using Protege or equivalent
  2. Export this schema to RDF
  3. Use the classes defined as some of the elements in a triplestore along with your target data
  4. Export your triplestore to RDF
  5. Use openRDF/sesame or Jena to load the defined data and ontology
  6. Validate your RDF triplestore against your OWL ontology to make sure everything is ok
  7. Use SPARQL to get data from your RDF triplestore
  8. Use an OWL reasoner to do something (not really clear here)

I would like to get an idea of what others are doing and how they are approaching this type of problem.

In addition I have a specific question:

It seems like an owl reasoner is used to determine sub-class superclass relationships only for ontologies. But in terms of data how to you query for subclass - superclass relationships in SPARQL. For example if my triple store defines (pizzaID1 is-a marghareta ) and I query for vegetarian pizza in SPARQL how do I make sure that pizzaID1 is returned.

I think that the answer has something to do with generating a "full-graph", one in which every relationship is explicitly stated. Does sparql do any automatic reasoning when querying triplestores, or is generating such a full graph neccessary?

回答1:

There are many possible workflows, but it really doesn't have to be that complex.

  1. Generated your OWL ontology in some editor
  2. Export ontology as RDF
  3. Import ontology to triplestore
  4. Import data to triplestore
  5. Query data with SPARQL

The sub/superclass reasoning is what the reasoner is used for, if you use a store with a builtin reasoner then then it's information will be used by SPARQL, so if you do:

SELECT ?pizza
WHERE {
  ?pizza a :VegitarianPizza .
}

You will get back all the pizzas that are members of the class VegitarianPizza, or any of it's subclasses.

I'm guessing that the class VegitarianPizza is defined in your ontology as a pizza that has no ingredients that are meat? Rather than assigning each pizza to a class by hand? Otherwise there's really no need for OWL, and you could just use RDFS, which is much simpler.