简体   繁体   中英

Ontology owl and Excel data

I am a non programmer. I have a ontology in owl format. I also have an excel sheet (it contains data numeric data with headers of selected ontology). Now I have to connect the excel header with ontology framework and need to extract the links in excel data from the ontology.

Do I understand you correctly that you have an RDF knowledge base whose schema is described by an OWL ontology and you want to import this data from RDF to a spreadsheet?

The most straightforward case to transform RDF to spreadsheets is a SPARQL SELECT query.

Prerequisites

If you don't already have the data in an application or endpoint where you can query it directly (eg Protégé may have a widget for SPARQL queries), there are three prerequisites, else skip those:

1. Export/Convert the Data

If you have your data in an application where you can't perform SPARQL queries or as a file in a syntax such as OWL/XML, you need to convert it first, because most SPARQL endpoints don't understand this format, but rather need an RDF serialization such as N-Triples, RDF Turtle or RDF/XML, so you need to export the data in one of those formats.

2. Setup a SPARQL Endpoint

Now you can install eg a Virtuoso SPARQL endpoint, either locally or on a server or use the endpoint of someone else who gives you access credentials. It can take a while to install but you can use a Docker image if that is easier.

3. Upload the Data

In Virtuoso SPARQL, you can now upload the ontology and the instance data in the conductor under "Linked Data" -> "Quad Store Upload".

Querying

I don't know of any existing tool that automatically maps ontologies and downloads instances according to a given Excel sheet templates so I recommend to create a SPARQL SELECT query manually.

Example

Let's say your Excel sheet has the header rows "name", "age" and "height" (you said you have numeric data) and the ontology has a person class defined like this in RDF Turtle:

:Person a owl:Class;
        rdfs:label "Person"@en.

:age a owl:DatatypeProperty;
  rdfs:label "age"@en;
  rdfs:domain :Person;
  rdfs:range xsd:nonNegativeInteger.

:height a owl:DatatypeProperty;
  rdfs:label "height"@en;
  rdfs:domain :Person;
  rdfs:range xsd:decimal.

Now you can write the following SPARQL SELECT query:

PREFIX :<http://my.prefix/>
SELECT ?person ?age ?height
{
 ?person a :person;
         :age ?age;
         :height ?height.
}

This will generate a result table, which you can obtain in different formats. Choose the CSV spreadsheet format and then you can import it into MS Excel, which solves your problem as far as I interpret it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM