How to generate a report for getting all the configuration that contain a specific data?
What user is looking for is a method by which configurations related to a specific data to be retrieved. Let’s say given an artifact id / artifact type, they want to know which all configurations (streams and baselines) of a specific project has that data within.
A report that will have the following details
- Project area name / URL
- Component name / URL
- Configuration name / URL
- Specified Data
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX oslc: <http://open-services.net/ns/core#>
PREFIX oslc_config: <http://open-services.net/ns/config#>
PREFIX process: <http://jazz.net/ns/process#>
SELECT DISTINCT ?uri ?project ?component ?title
WHERE {
?uri rdf:type oslc:ResourceShape .
?uri merge:mergeShape ?mergedShapeUri.
FILTER(contains(str(?mergedShapeUri), "Requirement"))
?uri dcterms:title ?title.
?uri oslc_config:component ?component.
?uri oslc:serviceProvider ?provider.
?provider oslc:details ?projectUri .
?projectUri rdf:type process:ProjectArea.
?projectUri dcterms:title ?project.
}
ORDER BY ?project
-
2 answers
Look at the OSLC Configuration Management specification at https://tools.oasis-open.org/version-control/browse/wsvn/oslc-core/trunk/specs/config/oslc-config-mgt.html for the RDF you need to write the query.
To find all uses of some version of one or more resources, you would need SPARQL similar to that below. Note that the values for ?v need to be version resource URIs, not concept resource URIs, and that you need to run this query against the all data endpoint, not in the scope of any configuration. Configurations themselves are not in the scope of a configuration.
PREFIX oslc_config: <http://open-services.net/ns/config#> PREFIX dcterms: <http://purl.org/dc/terms/> SELECT DISTINCT ?artifactTitle ?componentTitle ?gstreamTitle WHERE { # Include this part to get the component and title for the version resource ?v dcterms:isVersionOf ?concept . graph ?v { ?concept oslc_config:component ?component ; dcterms:title ?artifactTitle . } ?component dcterms:title ?componentTitle . # Find all local streams that select one of the given version resources ?lc oslc_config:selections/oslc_config:selects ?v ; a oslc_config:Stream . # Find all global streams that have the above local streams as contributions (directly or indirectly) ?gc (oslc_config:contribution/oslc_config:configuration)* ?lc ; a oslc_config:Stream ; dcterms:title ?gstreamTitle . } VALUES ?v { # Put the version resource URIs of the things you are looking for here, e.g.: <https://server:port/rm/versionedResources/_hTz9YMNWEeeDsvM8pel38g> #... }
Nick.
Comments
Gayathri Vikraman
Oct 11 '18, 10:36 a.m.Can someone help here please?