照会の作成と実行

特定の成果物一式を収集する必要がある場合があります。 失敗したテスト一式を集めて、状況レポートに組み込む場合があるかもしれません。 照会は、成果物一式を集めて、その結果を表示し、ユーザーがそれに対してアクションを実行できるようにします。

始める前に

照会は、SPARQL 照会言語で作成します。(SPARQL は、Linked Lifecycle Data 用の照会言語です。) したがって、照会を初めから作成するには、SPARQL 照会言語を理解している必要があります。

このタスクについて

以下のステップでは、3 つのカスタム照会を作成し、実行する方法を示します。 各照会は、自分用にカスタマイズできるように注釈が付けられています。

手順

  1. 「照会」ダイアログ・ボックスを開きます。

    メインメニューで、「照会」 > 「照会の作成」を選択します。

  2. 「照会」ダイアログ・ボックスで、照会の名前を入力します。
  3. 照会の説明を入力します。

    この説明は、「自分の照会」または「共有照会」画面で照会の上にカーソルを移動すると表示されます。

  4. この照会を「自分の照会」フォルダーに保存します。

    自分用でもチーム用でも照会を作成する場合は常に、作成した照会をプライベート・フォルダー 「自分の照会」に保存します。照会をテストして、必要な成果物を収集するように微調整してから、その照会を共有することができます。

  5. 置換または変更によりサンプル照会コードを変更します。
    • サンプル照会コードを置換します。下の「例」セクションにある 3 つの例から照会を 1 つ選択します。 照会をコピーして、フィールドに貼り付けます。
    • あるいは、デフォルトのサンプル SPARQL 照会コードをカスタム・コードで変更します。

      ご使用のプラットフォームで、標準的な編集キーが使用可能です。 SPARQL 照会を編集する際、Control+space と入力すると、コンテンツ支援を受けることができます。

      表示されているものと異なる接頭部が必要な場合は、「接頭部の追加」ボタンをクリックします。

      ユーザーに値を求めるプロンプトを出す照会を作成するようパラメーターを設定する場合は、今ここでも後でも追加できます。パラメーターは、検索する成果物のセットの特性を識別します。例えば、 特定の日付以降に変更された成果物、または特定のユーザーにより変更された成果物を検索するパラメーターを追加できます。

      プロンプトを出すパラメーターを照会に追加すると、 照会を実行するときにユーザーがパラメーター値を指定できるため、より柔軟な照会ができます。パラメーター値は照会ストリングに置換されて、照会結果をカスタマイズします。

      パラメーター値は、通常 $workitem$ のような形式を使用します。

      パラメーターとして追加できるものの完全な構文は複雑な場合がありますが、 代表的な形式は以下のようなものです。

      $name$

      $name.field$

      $name;format="formatString"$

      $name.field;format="formatString"$

      StringTemplate は、 SPARQL 照会ストリングでパラメーターの置換を実装するのに使用されるテンプレート・エンジンです。StringTemplate では、スペースを含むパラメーターがサポートされていますが、Rational® Engineering Lifecycle Manager ではサポートされていません。

      StringTemplate の構文規則の簡単なセットは、 StringTemplate cheat sheet を参照してください。区切り文字には、Cheat Sheet で指定されている <...> ではなく、$...$ を使用する必要があります。

      照会にパラメーターを 1 つ以上使用する場合は、 パラメーター化照会のトラブルシューティングに記載されている既知の問題についての説明を参照してください。

      日付パラメーター、列挙型パラメーター、およびシステム・パラメーターの表と、それぞれのサンプル出力を表示するには、定義済み照会パラメーターを参照してください。

      「照会」ダイアログ・ボックスでのパラメーター設定についての詳細は、「SPARQL 照会」セクションや「パラメーター」セクションの右にある小さな疑問符 (?) にカーソルを移動して吹き出しヘルプを開いて、確認することができます。

  6. 「作成」をクリックして、照会を作成します。
  7. 「実行」をクリックして、照会を実行します。
  8. 「照会結果」ページで成果物に対するアクションを実行できます。 成果物をクリックしてから、右にある矢印をクリックしてメニューを表示します。
    • 「成果物を開く」は、その成果物を作成したネイティブ・ツールを起動して、 そのツールで成果物を表示します。
    • 「プロパティーの表示」は、成果物のプロパティーを結果ウィンドウに表示します。
    • 「分析の開始」は、デフォルトの影響分析のプロファイルをロードします。「実行」をクリックすると、分析が開始されます。

    照会は、右上にある「スプレッドシートとしてダウンロード」アイコンをクリックし、「.csv」のスプレッドシートとしてダウンロードしてください。

以下の例は、Susan に割り当てられた未完了の技術変更依頼をすべて照会する方法を示しています。

「Susan に割り当てられた ECR を開く (Open ECRs assigned to Susan)」

# Name: Open ECRs assigned to Susan
# Description: Show all open ECRs assigned to Susan

# Prefixes used in this query
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX oslc_cm: <http://open-services.net/ns/cm#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

SELECT ?cr ?title ?contrib
WHERE
{
	# Find all ECRs - in this example, we find work items of type "Task"; change this to the type of work item you use
	?cr rdf:type oslc_cm:ChangeRequest ;
		dcterms:type "Task"^^xsd:string ;
		dcterms:title ?title ;
		dcterms:contributor ?contrib .

	# Change the name string to match the user name you want
	FILTER regex(str(?contrib),"susan")

	# Find open CRs (those with status that is none of closed, fixed, or verified)
	# You can adjust this to use any combination of the OSLC CM state predicates
	# oslc_cm:closed, oslc_cm:inprogress, oslc_cm:fixed, oslc_cm:approved, oslc_cm:reviewed, and oslc_cm:verified
	{
		?cr oslc_cm:closed "false"^^xsd:boolean ;
			oslc_cm:fixed "false"^^xsd:boolean .
	}
	# for example, the following alternative to the above clause would find CRs that are either in progress or not closed:
	# {
	#	{ ?cr oslc_cm:inprogress "true"^^xsd:boolean } UNION { ?cr oslc_cm:closed "false"^^xsd:boolean }
	# }
}

以下の例は、自分に割り当てられている、失敗したテスト・ケースを照会する方法を示しています。

不成功のテスト

# Name: Failing tests
# Descriptions: Testcases that fail and are assigned to me

# Prefixes used in this query
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX oslc_qm: <http://open-services.net/ns/qm#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

SELECT ?testcase ?title
WHERE
{
	# Find failing test results, and their owning testcase
	?testResult rdf:type oslc_qm:TestResult ;
		oslc_qm:status "com.ibm.rqm.execution.common.state.failed"^^xsd:string ;
		oslc_qm:reportsOnTestCase ?testcase .

	# Select just the testcases assigned to me
	# Change the name string to match the user name you want
	?testcase dcterms:contributor ?user.
	FILTER regex(str(?user), "tony")

	# Find the matching testcase titles
	?testcase dcterms:title ?title .
}

以下の例は、変更依頼に対する変更により影響を受ける成果物を 照会する方法を示しています。

「CR に対する変更によって影響を受ける成果物 (Artifacts impacted by change to CR)」

# Description: Find artifacts impacted by a change to a Change Request
# Follows links such as CR->tracks->REQ->[elaboratedBy->REQ | specifiedBy->REQ]->[verifiedBy->TC | elaboratedBy->ME]

# Prefixes used in this query
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX oslc_cm: <http://open-services.net/ns/cm#>
PREFIX oslc_rm: <http://open-services.net/ns/rm#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

SELECT ?cr ?type ?title ?owner
WHERE
{
	?cr a oslc_cm:ChangeRequest ;
		dcterms:identifier ?id ;
		(oslc_cm:tracksRequirement|oslc_rm:trackedBy|oslc_rm:elaboratedBy|oslc_rm:specifiedBy|oslc_rm:validatedBy)* ?uri .
	?uri dcterms:title ?title
	OPTIONAL
	{
		?uri rdf:type/rdfs:label ?type ;
	}
	OPTIONAL
	{
		# This part of the query picks up user names from either JTS user URIs or from DOORS FOAF entries,
		# and avoids getting the DOORS user URI as well as that FOAF entry
		{
			?uri dcterms:contributor/foaf:name ?owner
		}
		UNION
		{
			?uri dcterms:contributor ?owner
			FILTER NOT EXISTS { ?owner foaf:name ?x }
		}
	}
}

# Either provide one or more work item ID numbers here,
# or remove or comment out the entire VALUES section to look at all work items
VALUES ?id
{
	"626"^^xsd:string
	"627"^^xsd:string
}

次のタスク


フィードバック