迁移查询

在 IBM® Rational® Engineering Lifecycle Manager 4.0.3 和更高版本中,生命周期索引中的某些数据表示已发生更改。这些更改可能需要对 SPARQL 查询进行更新,其中包括视图中使用的查询。本主题描述这些更改并说明如何编写在所有版本中运行的查询。

对产品表示所做的更改

V4.0.3 中更改的数据表示更适合以下列方式参与链接数据平台
  • 现在,产品与其视图之间的链接使用从产品到视图的 pd:view 链接,而不是从视图到产品的 pd_ext:isViewOf 链接。
  • 产品 (pd:Item) 和部件 (pd:Part) 的标题字符串已从简单的字符串字面值更改为类型 rdf:XMLLiteral
  • 产品的先前版本现在通过使用链接 prov:wasRevisionOf 而不是 dcterms:replaces 来指示

将您的查询更新为使用这两种形式的链接,并且在使用该链接或者对其进行搜索之前强制将标题类型转换为字符串。可使用 SPARQL 属性路径来匹配若干备用项。因此,可使用两个备用项的 UNION 或者属性路径(例如,prov:wasRevisionOf|dcterms:replaces)来同时匹配 1.x 和 4.0.3 及更高版本表示。

在版本信息要求您标识特定图形的产品定义中,由于两个备用项位于不同图形中,属性路径(例如,pd:view|^pd:isViewOf)不会工作。在这种情况下,必须使用 UNION

如果要查询其标题包括引号、和号或小于符号的产品,那么这些字符必须在 4.0.3 及更高版本的 XMLLiteral 表示中使用 XML 进行编码。

例如,以下查询显示其标题包括字符“auto&boat”、先前版本的产品以及其中每个产品的中间子产品:

PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX prov: <http://www.w3.org/ns/prov#>
PREFIX pd: <http://jazz.net/ns/pd#>
PREFIX pd_ext: <http://jazz.net/ns/pd/extensions#>

SELECT ?parentVersion ?predecessor ?childVersion
WHERE
{
   GRAPH ?parentVersion
   {
      ?parent a pd:Item ;
         	?testcase dcterms:title ?title .
      OPTIONAL { ?parent prov:wasRevisionOf|dcterms:replaces ?predecessor }
   }
   FILTER regex(str(?title),".*auto(&|&)boat.*","","i")
   {
      { GRAPH ?parentVersion { ?parent pd:view ?view } }
      UNION
      { ?view pd:isViewOf ?parentVersion }
   }
   OPTIONAL { ?view dcterms:hasPart/pd_ext:binding ?childVersion }
}

产品的已更改标识

产品的 dcterms:identifier 现在是一个长整型唯一字符串。如果有可能,在查询中使用该产品的其他已知属性。否则,将使用 dcterms:identifier 的查询更新为使用新标识。

产品分支的新维度属性

V4.0.3 将对有关产品分支的维度属性的数据建立索引。例如,可扩充先前查询以显示父级产品的维度(分支)信息:

PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX prov: <http://www.w3.org/ns/prov#>
PREFIX pd: <http://jazz.net/ns/pd#>
PREFIX pd_ext: <http://jazz.net/ns/pd/extensions#>

SELECT ?parentVersion ?dtitle ?dvalue ?predecessor ?childVersion
WHERE
{
   GRAPH ?parentVersion
   {
      ?parent a pd:Item ;
         	?testcase dcterms:title ?title .
      OPTIONAL { ?parent prov:wasRevisionOf|dcterms:replaces ?predecessor }
      OPTIONAL { ?parent pd_ext:dimensions ?bn }
   }
   FILTER regex(str(?title),".*auto(&|&)boat.*","i")
   {
      { GRAPH ?parentVersion { ?parent pd:view ?view } }
      UNION
      { ?view pd:isViewOf ?parentVersion }
   }
   OPTIONAL { ?view dcterms:hasPart/pd_ext:binding ?childVersion }
   ?bn ?dimension ?dvalue .
   ?dimension dcterms:title ?dtitle .
}

对用户数据所做的更改

在所有先前发行版中,索引使用不正确的 URL 编码表示用户的电子邮件地址。例如,电子邮件地址 URI mailto:susan@example.com 在索引中表示为 mailto:susan%40example.com。此缺陷已在 Jazz™ 4.0.3 中修正但未在 DOORS® 9 发行版中修正。因此,查询必须允许这两种形式的电子邮件地址:

PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX oslc_cm: <http://open-services.net/ns/cm#>

SELECT ?cr ?title ?contribMbox
WHERE {
  	?cr a oslc_cm:ChangeRequest ;
    		dcterms:type "Task"^^xsd:string ;
    		dcterms:title ?title ;
    dcterms:contributor/foaf:mbox ?contribMbox .
  FILTER regex(str(?contribMbox),"susan(@|%40)example.com")
}

反馈