© Copyright IBM Corporation 2014
Getting started with Rational Engineering Lifecycle Manager queries
Andy Lapping – Technical sales and solutionsJoanne Scouler – Curriculum architect
2 © Copyright IBM Corporation 2014
Agenda• Linked data and Open Services for Lifecycle
Collaboration (OSLC)• The information model• Basic concepts and terminology
• Linked data• RDF• Triples• SPARQL
• Creating queries– live demo
3 © Copyright IBM Corporation 2014
Resources
OSLC resources:Introduction to Linked Data and OSLC by Amanda BrijpaulLinked Data by Ben WilliamsLinked Data Interfaces by Arthur Ryman
REST resources:DeveloperWorks REST resources – The BasicsLearn about rest web services
RDF, TRS, SPARQL, LQE- http://www.w3.org
4 © Copyright IBM Corporation 2014
Rational engineering lifecycle manager
Transition to a unified view on project, program & account info
It is about accessing related information
in job related tools across the information base to increase the
collective wisdom
Analysts Quality Professionals
Release EngineersDevelopers
Architects
Project Managers
5 © Copyright IBM Corporation 2014
Linked data in Rational engineering lifecycle manager
Electrical Design
Mechanical Design / PDM
EmbeddedSoftware Design
aboutaboutabout about
HTTP/REST
http://acme.com/TestCasehttp://acme.com/Requirement
Requirements
Test
Architecture
Change Products
The Web has proven to be the most scalable, open, and flexible integration technology
6 © Copyright IBM Corporation 2014
OSLC links
• Link directly between tools – no need to import or duplicate data
7 © Copyright IBM Corporation 2014
Demo linked data
8 © Copyright IBM Corporation 2014
Data is indexed in Rational engineering lifecycle managerAn index of tracked resources is created from domain tools that allows for cross-domain Lifecycle Queries
Lifecycle Query Engine (Index)
LQE
9 © Copyright IBM Corporation 2014
The information model
What information do you want to find with a query? Know your information model Know how your linkages are set up
What do you need to know before writing a query?
10 © Copyright IBM Corporation 2014
Learning the languageRDF – Resource Description Framework
A general purpose language for representing information in the web
SPARQL - SPARQL Protocol and RDF Query Language A query language for RDF
TRS – Tracked Resource Set TRS is an OSLC specification that allows server applications to
make their resources and changes available to client applications.LQE – The Lifecycle Query Engine
A TRS client application
11 © Copyright IBM Corporation 2014
Running queries Query results available in http format Pipes (XML) data to Rational Reporting for
Document Generation (RRDG) / Rational Publishing Engine (RPE)
12 © Copyright IBM Corporation 2014
Basic concept: triples
A triple defines a relationship between things: Subject
– A uniquely identified thing Predicate (also called property)
– Some attribute of the subject– Denotes a relationship
Object– The actual value
13 © Copyright IBM Corporation 2014
Triples
Examples:
subject
objectpredicate
subject
object
predicate
14 © Copyright IBM Corporation 2014
RDF triples
An RDF triple is sometimes called a statement Every piece of an RDF triple can have a URL Commonly referred to as a resource
http://men.com#William http://relations.com/isMarriedTo http://women.com#Catherine
S P O
15 © Copyright IBM Corporation 2014
RDF triples form graphs
A set of triples is called an RDF graph Graphs have nodes and edges An RDF database is sometimes called a triple store
Node
Edge
16 © Copyright IBM Corporation 2014
Types of node
Resource node A thing with a URL with links– Commonly represented as an oval
Blank node A resource with no URL with links
Literal node A value (strings, dates) - no URL and no links– Commonly represented as a rectangle
An edge can go from any Node to any other Node. Exception: An edge cannot go from a Literal
17 © Copyright IBM Corporation 2014
Triple patterns
A triple pattern is like an RDF triple – except that each of the S,P,O may be a variable (denoted by a preceding ? symbol)
?resource rdf:type oslc_qm:TestCase .
VariableVariables are like a wildcard – they match any node – resource or literal.
The period terminates the statement
We will discuss what rdf:type and oslc_qm:TestCase mean in a moment
18 © Copyright IBM Corporation 2014
RDF vocabularies
In order for ‘anything’ to connect to ‘anything else’ – there must be some common language.
An RDF Vocabulary is the set of URLs for the resources in the graph
?resource http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://open-services.net/ns/qm#TestCase
From the OSLC Quality Management Vocabulary
From the standard RDF vocabulary
19 © Copyright IBM Corporation 2014
Prefixes
Prefixes are used in SPARQL to allow queries to be shortened (instead of writing the full URL to the resource)
The following queries are equivalent
?uri http://open-services.net/ns/qm#testsChangeRequest ?tests_cr.
PREFIX oslc_qm: <http://open-services.net/ns/qm#>
?uri oslc_qm:testsChangeRequest ?tests_cr.
S P O
S P O
20 © Copyright IBM Corporation 2014
Anatomy of a query
PREFIX oslc_qm: <http://open-services.net/ns/qm#>PREFIX dcterms: <http://purl.org/dc/terms/> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT ?uri
WHERE { ?uri rdf:type oslc_qm:TestCase .} SELECT ?variable ?variable
Identifies the variables to appear in the results (this is called projection)Each projected variable will be a column in the results tableSELECT * will display all variables specified in the WHERE clause
WHERE { basic graph pattern
}Identifies the basic graph pattern to match against the data pattern
21 © Copyright IBM Corporation 2014
A simple query with resultsPREFIX oslc_qm: <http://open-services.net/ns/qm#>PREFIX dcterms: <http://purl.org/dc/terms/> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> SELECT ?uriWHERE { ?uri rdf:type oslc_qm:TestCase .}
Pattern matches
Projected ?uri variable
22 © Copyright IBM Corporation 2014
Queries
23 © Copyright IBM Corporation 2014
Creating a query
When a query is created some sample SPARQL is addedAlthough this can be executed the results will mean very little
24 © Copyright IBM Corporation 2014
Create queries demo
25 © Copyright IBM Corporation 2014
Appendix
26 © Copyright IBM Corporation 2014
Blank nodes in Rhapsody
Using this technique we can discover how to extract various resources in Rhapsody• Some may have multiple blank nodes to traverse