r2 - 2021-04-01 - 13:20:10 - TimFeeneyYou are here: TWiki >  Deployment Web > DeploymentMonitoring > UsefulLQEQueries

Useful LQE SPARQL Queries todo.png

Authors: TimFeeney, IanBarnard, FabriceMendes
Build basis: 6.0.6.1 and above

This page contains some useful SPARQL queries to gather information from the LQE repository. These can be run from the query interface of the LQE administration UI. Be advised that complex and/or high volume queries can place load on the server so exercise caution and test these in a non-production environment first.

Count components per project

PREFIX oslc_config: <http://open-services.net/ns/config#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX dc: <http://purl.org/dc/terms/>
PREFIX process: <http://jazz.net/ns/process#>


SELECT ?project ?projectName ( COUNT ( ?fgc ) AS ?components )
WHERE {
   ?fgc rdf:type oslc_config:Component .
   ?fgc process:projectArea ?project .
   ?project dc:title ?projectName .
}
GROUP BY ?project ?projectName 

Total baselines and streams per component

If you remove or adapt the filter line for /rm/ these will work with gc and probably qm; it won't work with context root like /rm1.

PREFIX process: <http://jazz.net/ns/process#>
PREFIX ns_validity_: <http://jazz.net/ns/validity#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX merge: <http://jazz.net/ns/lqe/merge/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX oslc_config: <http://open-services.net/ns/config#>
PREFIX oslc: <http://open-services.net/ns/core#>


SELECT DISTINCT
    ?projectArea
    ?projectTitle
    ?component
    ?componentTitle 
    ?baselineCount
    ?streamCount
WHERE {
    ?projectArea rdf:type process:ProjectArea.
    ?projectArea <http://open-services.net/ns/core#archived> false .
    FILTER regex(str(?projectArea),"/rm/")
    OPTIONAL {
        ?projectArea dcterms:title ?projectTitle.
    }
    ?component rdf:type oslc_config:Component .
    ?component <http://jazz.net/ns/process#projectArea> ?projectArea .
    OPTIONAL {
        ?component dcterms:title ?componentTitle.
    }
    
    OPTIONAL
    {
        SELECT DISTINCT
            (COUNT(DISTINCT ?oslc_config_Baseline1) AS ?baselineCount)
            ?component
        WHERE{
            ?oslc_config_Baseline1_uri oslc_config:component ?component.
            ?oslc_config_Baseline1_uri rdf:type oslc_config:Baseline.
           OPTIONAL {?oslc_config_Baseline1_ver dcterms:isVersionOf ?oslc_config_Baseline1_uri; rdf:type oslc_config:VersionResource.}
           BIND( IF (bound(?oslc_config_Baseline1_ver), concat(str(?oslc_config_Baseline1_uri), "?oslc_config.context="), ?oslc_config_Baseline1_uri) as ?oslc_config_Baseline1)
        }  GROUP BY ?component
    }
    OPTIONAL
    {
        SELECT DISTINCT
            (COUNT(DISTINCT ?oslc_config_Stream1) AS ?streamCount)
            ?component
        WHERE{
            ?oslc_config_Stream1_uri oslc_config:component ?component.
            ?oslc_config_Stream1_uri rdf:type oslc_config:Stream.
           OPTIONAL {?oslc_config_Stream1_ver dcterms:isVersionOf ?oslc_config_Stream1_uri; rdf:type oslc_config:VersionResource.}
           BIND( IF (bound(?oslc_config_Stream1_ver), concat(str(?oslc_config_Stream1_uri), "?oslc_config.context="), ?oslc_config_Stream1_uri) as ?oslc_config_Stream1)
        } GROUP BY ?component
    }
}
ORDER BY ?projectTitle ?componentTitle 

List baseline names with their UUIDs

# Configuration
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX oslc: <http://open-services.net/ns/core#>
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX oslc_config: <http://open-services.net/ns/config#>
PREFIX oslc_core: <http://open-services.net/ns/core#>
PREFIX prov: <http://www.w3.org/ns/prov#>
PREFIX jazz_process: <http://jazz.net/ns/process#> 
PREFIX jazz_process2: <http://jazz.net/xmlns/prod/jazz/process/1.0/>

SELECT * WHERE {
   # Filter resource
   # Fetch properties possibly used in views
   
   OPTIONAL { ?resource dcterms:creator/foaf:mbox ?creator_mbox }
   OPTIONAL { ?resource rdf:type ?type }
   OPTIONAL { ?resource dcterms:title ?simpleTitle }
   OPTIONAL { ?resource dcterms:description ?description }   
   OPTIONAL { ?resource dcterms:modified ?modified }   
   OPTIONAL { ?resource dcterms:identifier ?identifier }
   OPTIONAL { ?resource oslc:shortId ?shortId }   
   BIND ( if (bound(?shortId), ?shortId, ?identifier) as ?id2 )
   BIND ( if (isNumeric(?id2), ?id2, xsd:integer(?id2)) as ?id )
   OPTIONAL { ?resource oslc_config:mutable ?mutable }
   FILTER  regex(str(?type),"#Baseline","i" ) 
   BIND ( IF (bound(?simpleTitle), str(?simpleTitle), str(?resource)) as ?title)
   BIND ( IF (bound(?shortId), str(?shortId), "") as ?shortIdStr)
   BIND ( IF (bound(?mutable) && ?mutable, concat("Stream ", ?shortIdStr), concat("Baseline ", ?shortIdStr)) as ?shortTitle )
   # order by (global/local), (stream/baseline) and then title
   BIND ( IF (bound(?mutable) && ?mutable, concat("_1_", ?title), concat("_2_", ?title)) as ?type_order )
   BIND ( IF (bound(?shortId), concat("1_", ?type_order), concat("2_", ?type_order)) as ?order )
}

Edit | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r2 < r1 | More topic actions
 
This site is powered by the TWiki collaboration platformCopyright © by IBM and non-IBM contributing authors. All material on this collaboration platform is the property of the contributing authors.
Contributions are governed by our Terms of Use. Please read the following disclaimer.
Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.