探究DB2中RDF数据的特征并描述创建优化存储的流程
资源描述框架 (Resource Description Framework, RDF) 是一系列 W3 规范标准,主要支持数据和元数据的交换。凭借 IBM DB2 10 for Linux, UNIX, and Windows Enterprise Server Edition,应用程序可以存储和查询 RDF 数据。
本探究 RDF 数据的特征并描述创建优化存储的流程。此外,还将介绍如何使用 DB2 引擎或该应用程序对 RDF 存储提供细粒度访问控制。本文包含一个样例应用程序。
本教程是由三部分组成的系列文章 “RDB2 10 for Linux, UNIX, and Windows 中的资源描述框架应用程序开发” 的第 2 部分,让您在实际操作中体验 DB2 for Linux, UNIX, and Windows 软件和资源描述框架 (RDF) 技术的使用:
- 本系列 第 1 部分 介绍了一个 RDF 应用程序的示范用用例,引导您完成构建这个应用程序的步骤,包括创建一个 RDF 存储、使用 SPARQL 查询进行数据查询,以及维护统计数据。第 1 部分提供了将 RDF 存储迁移到 DB2 软件的流程。
- 第 2 部分涵盖以下高级主题:
- 提供 RDF 数据特性以及 DB2 软件如何优化 RDF 数据存储的概述。
- 描述创建优化存储的流程。
- 将优化存储与您在第 1 部分为样例应用程序创建的默认存储进行比较,以便了解优化存储的优势。
- 描述如何为 RDF 存储提供更细粒度的访问控制。本教程将引导您使用 DB2 引擎和样例应用程执行访问控制。
在第 2 部分中,我们将在第 1 部分的样例应用程序用例基础上进行构建。如果您尚未构建,查阅 第 1 部分 获取相关内容。
第 3 部分将介绍更多特定于 SPARQL 的特性,比如 DESCRIBE 和 CONSTRUCT 查询表单以及指定图表的联合。
默认存储和优化存储
回顾第 1 部分,DB2 软件支持两类 RDF 存储的创建:
- 默认 RDF 存储 — 如果您没有正在加载的 RDF 数据相关信息或者如果没有合适的样例可用时,创建一个默认 RDF 存储。要创建这类存储,使用 createrdfstore RDF 命令。
- 优化 RDF 存储 — 如果 RDF 数据集有代表性样例数据时,创建一个优化存储。优化存储可以根据您提供的 RDF 数据集提供一种优化模式。
本教程主要关注优化存储的创建。
RDF 数据的特征
无模式数据模型
RDF 数据模型是无模式的。不同于关系模型,每个表中列的数量是固定的,RDF 数据集没有固定数量的谓词。一个特定 RDF 主题可以有任意数量的谓词。此外,一个 RDF 数据集可以跨任意数量的域来存储数据,这进一步增强了该模型的 “无模式性”。因此,当将 RDF 数据映射到一个关系模式时,必须使用一种机制来支持 RDF 数据的无模式特性。
当映射 RDF 数据到关系模式时,处理无模式特性的最常见的机制是利用一个包含 3 列的表(三个列分别对应主题、谓词和对象)。使用该方法,每个三 元组位于该表中的一个新行中,因此,可以处理数目不定的谓词。然而,该映射伸缩性不是很好,有点性能问题,因为查询数据需要许多自联接以及无用的关系索引应用。例如,检索一个主题的两个谓词的一个简单查询涉及到一个自联接和两行获取。相比之下,同一数据的传统关系建模一行中有两个谓词,不需要任何联接,使用一个 fetch 语句就可以检索到数据。
无模式特性的处理
查询 RDF 数据时,DB2 软件在表中一行或者很少几行中存储关于一个主题的所有谓词和对象,从而减少了大量自联接需求。因为一个关系表必须有固定数量的列(由页面大小和列长度控制),该机制根据表中谓词分配给列的方式处理可变数量谓词。
DB2 软件使用两个机制来将谓词分配给表中的列:
- 散列法 — 为减少散列冲突,使用一组散列函数而不是一个散列函数。散列法是随机的,尽管使用多个散列函数,仍然很容易出现冲突。如果出现冲突,将在表中创建一个新行。默认存储中使用的是散列机制。
- 谓词关联 — 如果 RDF 数据的一个代表性样例可用,DB2 软件将计算 RDF 数据集中各种资源类型谓词之间的相关性。该软件使用这种相关性来分配谓词到表中的列。这将使我们能够更好地利用表中的空间,以及减少冲突几率。多个关联函数被用于进一步减少冲突几率。优化存储中使用谓词关联机制。
创建优化存储
使用 DB2 创建优化存储有多种方法。第 1 部分中的迁移场景使用 createrdfstoreandloader 命令创建优化存储。该命令将 RDF 数据批量加载到一个 DB2 。在批量加载情况下,可以料到输入数据是谓词跨不同资源类型相关联的范例。但是,您可能会在没有代表性数据来创建优化存储的情况下开始应用程序开发。在本例中,您有两种选择:
- 首先开始创建默认存储,正如第 1 部分所述,使用默认存储直至生成足够数据(例如在应用程序系统 QA 周期中)。然后,您可以使用 DB2 数据库引擎计算默认存储的谓词相关性,并使用这些相关性信息来创建一个优化存储用于生产。在第 2 部分中我们将引导您完成这一机制。
- 首先创建一个默认存储,然后使用 REORG 系列 DB2 RDF 命令将该存储重组为一个优化存储。更多信息,参阅 DB2 Information Center 主题 “Converting a default store to an optimized store”。
要使用谓词关联重新创建您在第 1 部分中创建的默认 staffing 存储作为一个优化存储:
- 使用现有存储,生成谓词映射。
- 使用谓词映射创建优化存储。
谓词映射 是数据集中的谓词和 DB2 RDF 存储(谓词存储在其中)的底层关系表中的列之间的一个映射。谓词映射是根据其中出现的各个 RDF 资源类型之间的谓词相关性决定的。这样做是为了在最少数量的列中包装 RDF 数据。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



With the popularity of mobile Internet, Toutiao has become one of the most popular news information platforms in my country. Many users hope to have multiple accounts on the Toutiao platform to meet different needs. So, how to open multiple Toutiao accounts? This article will introduce in detail the method and application process of opening multiple Toutiao accounts. 1. How to open multiple Toutiao accounts? The method of opening multiple Toutiao accounts is as follows: On the Toutiao platform, users can register accounts through different mobile phone numbers. Each mobile phone number can only register one Toutiao account, which means that users can use multiple mobile phone numbers to register multiple accounts. 2. Email registration: Use different email addresses to register a Toutiao account. Similar to mobile phone number registration, each email address can also register a Toutiao account. 3. Log in with third-party account

In today's fast-paced society, sleep quality problems are plaguing more and more people. In order to improve users' sleep quality, a group of special sleep anchors appeared on the Douyin platform. They interact with users through live broadcasts, share sleep tips, and provide relaxing music and sounds to help viewers fall asleep peacefully. So, are these sleep anchors profitable? This article will focus on this issue. 1. Are Douyin sleep anchors profitable? Douyin sleep anchors can indeed earn certain profits. First, they can receive gifts and transfers through the tipping function in the live broadcast room, and these benefits depend on their number of fans and audience satisfaction. Secondly, the Douyin platform will give the anchor a certain share based on the number of views, likes, shares and other data of the live broadcast. Some sleep anchors will also

Differences in syntax between db2 and oracle: 1. SQL syntax differences. Although db2 and oracle both use structured query language, they have some differences in syntax; 2. db2 and oracle have different data types; 3. Foreign key constraint definition, db2 can be defined when creating the table or added after using the "ALTER TABLE" statement. Oracle needs to be defined together when creating the table; 4. There are also some differences in the syntax of db2 and oracle stored procedures and functions.

What to do when traveling through the Shadow of Death on the Collapsed Star Dome Railway? Walking through the Shadow of Death is one of the main quests [Cat among Doves], and it is also the final stage of the main quest. Below, the editor will provide a detailed explanation of the mission of Walking through the Shadow of Death on the Collapsed Star Dome Railway, for those who are interested. Come and take a look. 1. After completing the previous stage of the plot, you will be automatically transferred to the location in the picture below. After talking to March 7, you will enter the dungeon. Remember to form a team. 2. The backup plan is to fight [Stone Heart Ten] Weird Placer Gold, with four teams. The best character tactics and finishing skills are group attacks, and it is best to bring a shield and milk. This [Stone Heart Ten] strange sand gold is difficult to hit. When rolling the dice, if your points are greater than the sand gold, you will not be beaten. And after the end, the amount of finishing skills will be fully restored. If it is less than that, you will be beaten, so try to bring a group attack character to gain points. in boss

What to do with all the sad stories of the Collapsed Star Dome Railway? All Sad Stories is part of the main quest [Cat among Pigeons]. The process at this stage is relatively long. Below, the editor will provide a detailed explanation of the All Sad Stories quest on the Collapsed Star Dome Railway. Friends, please take a look. 1. After completing the previous stage, you will be automatically transferred to the second new map [Cloak Film and Television Park]. Follow the mission all the way from 1 [Pinball Machine] to 2 location and follow the third character. After completing the plot, go to Talk to the child in the 4th position and complete the mini-game [Speed and Nuts]. A mini-game similar to Tiantian Cool Run is very simple. 3. Then the tracking task is to fly from position 1 [pinball machine] in the picture below to position 2 4. After arriving at the position in the picture below, you need to walk through the maze. After entering from the left, keep walking to the right to reach task point 15.

Detailed explanation and optimization strategy of php-fpm request processing process 1. Introduction In web application development, PHP is a very popular server-side scripting language. And php-fpm (FastCGIProcessManager) is a manager of PHP, used to process PHP requests. This article will introduce the request processing process of php-fpm in detail, and discuss how to optimize php-fpm and improve the performance of web applications. 2. php-fpm request processing process When the client initiates a request

Iris, a multivariate flower dataset, is one of the most useful pyhtonscikit-learn datasets. It is divided into 3 categories with 50 instances each and contains measurements of the sepal and petal parts of three types of iris flowers (Iris mountaina, Iris virginia and Iris versicolor). In addition to this, the Iris dataset contains 50 instances of each of the three species and consists of four features, namely sepal_length(cm), sepal_width(cm), petal_length(cm), petal_width(cm). We can use Principal Component Analysis (PCA) to transform the IRIS dataset into a new feature space with 2 features. Steps we can follow

Vue.js is a popular JavaScript framework for building user interfaces and single-page applications. Its concise syntax, flexibility and powerful functions make it the first choice of many developers. In recent project development, my team and I have accumulated some experience in optimizing development processes and work efficiency, which we would like to share with you. First of all, as the basis for Vue.js development, we must fully understand the ecosystem and core concepts of Vue.js. The core concepts of Vue.js include data-driven and component systems
