简体   繁体   English

本体猫头鹰和Excel数据

[英]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).我还有一张 excel 表(它包含带有所选本体标题的数据数字数据)。 Now I have to connect the excel header with ontology framework and need to extract the links in excel data from the ontology.现在我必须将 excel header 与本体框架连接起来,并且需要从本体中提取 excel 数据中的链接。

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?我是否正确理解您有一个 RDF 知识库,其架构由 OWL 本体描述,并且您希望将此数据从 RDF 导入电子表格?

The most straightforward case to transform RDF to spreadsheets is a SPARQL SELECT query.将 RDF 转换为电子表格的最直接案例是 SPARQL SELECT 查询。

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:如果您的应用程序或端点中还没有可以直接查询的数据(例如,Protégé 可能有一个用于 SPARQL 查询的小部件),则有三个先决条件,否则跳过这些:

1. Export/Convert the Data 1. 导出/转换数据

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.如果您的数据在无法执行 SPARQL 查询的应用程序中或以 OWL/XML 等语法格式的文件形式存在,则需要先将其转换,因为大多数 SPARQL 端点不理解这种格式,而是需要RDF 序列化,例如 N-Triples、RDF Turtle 或 RDF/XML,因此您需要以其中一种格式导出数据。

2. Setup a SPARQL Endpoint 2. 设置 SPARQL 端点

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.现在,您可以在本地或服务器上安装例如 Virtuoso SPARQL 端点,或者使用其他人的端点,该端点为您提供访问凭据。 It can take a while to install but you can use a Docker image if that is easier.安装可能需要一段时间,但如果这样更容易,您可以使用 Docker 映像。

3. Upload the Data 3. 上传数据

In Virtuoso SPARQL, you can now upload the ontology and the instance data in the conductor under "Linked Data" -> "Quad Store Upload".在 Virtuoso SPARQL 中,您现在可以在“链接数据”->“四存储上传”下的导体中上传本体和实例数据。

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.我不知道有任何现有工具可以根据给定的 Excel 工作表模板自动映射本体并下载实例,因此我建议手动创建SPARQL SELECT 查询

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:假设您的 Excel 工作表具有 header 行“姓名”、“年龄”和“身高”(您说您有数字数据)并且本体有一个人 ZA2F2ED4F8EBC2CBB4C21A29DC40AB61 定义如下:

: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:现在您可以编写以下 SPARQL SELECT 查询:

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.选择 CSV 电子表格格式,然后您可以将其导入 MS Excel,就我的解释而言,它可以解决您的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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