Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Wiki Markup
h4. Vocabulary

Resource = a record of a 

Vocabulary

...

"thing" in eagle-i. A resource is an instance of a class defined in the eagle-i ontology (e.g. "My nifty DNA Microarray" is an instance of the class "DNA MicroArray", which is a subclass of "Instrument")

...



h4. Organization Identifier

...



The organization to which biostats tools are attached in the eagle-i repository is:

...



[http://harvard.eagle-i.net/i/0000012e-5946-2efe-55da-381e80000000

...

]


The same URI can be used in the dev environment, by changing the hostname as in the config property below.

...

Configuration

No Format


h4. Configuration
{noformat}

# General
# What general type of resources we are dealing with

baseType=http://purl.obolibrary.org/obo/ERO_0000071

# What organization are the resources "attached" to (all resources in eagle-i need to belong to an organization)

organization=http://harvard.dev.eagle-i.net/i/0000012e-5946-2efe-55da-381e80000000

# What properties to show in the overview record
# Literal properties (i.e. properties whose value is a simple string)
# Website
lp1=http://purl.obolibrary.org/obo/ERO_0000480
# Object properties (i.e. properties whose value is a link to another resource or ontology term)
# Not used for Biostats
# op1=
# op2=

################
# Filters
################

# Properties for creating filters
# Each property corresponds to a filter group
# Direct filter properties
#has software purpose
fp1=http://purl.obolibrary.org/obo/ERO_0000078
#has related Study Design
fp2=http://eagle-i.org/ont/app/1.0/has_related_study_design
#Algorithm used
fp3=http://www.ebi.ac.uk/efo/swo/SWO_0000740

#Indirect filter properties (the property hangs off an embedded class) - need embedded property and indirect property
#has data input
ep1=http://purl.obolibrary.org/obo/ERO_0001719
op20000076
#data type
ip1=http://www.w3.org/1999/02/22-rdf-syntax-ns#type
#has data input
ep2=http://purl.obolibrary.org/obo/ERO_0000078

More advanced version with open-ended lists, potentially using yaml (but need to get the syntax right (wink)

No Format
0000076
#has measurement scale
ip2=http://eagle-i.org/ont/app/1.0/has_measurement_scale
{noformat}

More advanced version with open-ended lists, potentially using yaml (but need to get the syntax right ;-)
{noformat}
# What properties to show in the overview record
# Literal properties (i.e. properties whose value is a simple string)
literalProperties:
   propertyUri: http://purl.obolibrary.org/obo/ERO_0000480

# Object properties (i.e. properties whose value is a link to another resource or ontology term)
objectProperties:
  propertyUri: http://purl.obolibrary.org/obo/ERO_0001719
  propertyUri: http://purl.obolibrary.org/obo/ERO_0000078

# What properties to show on the left nav
# What properties to filter on
# => TBD with Richard

Queries

Query for base, unfiltered dataset:

Find all instances of baseType affiliated with virtualOrganization, returns a table with a column per query variable defined in property configuration above
Option 1 one query

No Format

{noformat}

h4. Queries


h5. Get base, unfiltered dataset

Find all instances of {{baseType}} affiliated with {{virtualOrganization}}, returns a table with a column per query variable defined in property configuration above

Need to split in two queries (one for Ontology labels, one for instances). Note that if desired props don't have preferred label we'll need to alter query 1

Query 1 => to be executed only once (labels don't change)

{noformat}
PREFIX eiapp: <http://eagle-i.org/ont/app/1.0/>
SELECT

?lp1Label
?op1Label
?op2Label

 WHERE {
     OPTIONAL {
          <${lp1}> eiapp:preferredLabel ?lp1Label .
          <${op1}> eiapp:preferredLabel ?op1Label .
          <${op2}> eiapp:preferredLabel ?op2Label .
     }
}
{noformat}

Query 2
Note that if a property is not defined in the config file (e.g. op1), the variable in the SELECT clause, as well as the entire triple pattern/pattern group in the WHERE clause (i.e. the corresponding line) needs to be omitted. So there needs to be some conditional logic in the query generation.
{noformat}
PREFIX ei: <http://purl.obolibrary.org/obo/>
PREFIX eiapp: <http://eagle-i.org/ont/app/1.0/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

SELECT
?resourceUri
?resourceLabel
?resourceDescription
?lp1Label
?lp1Value
?op1Label
?op1ValueLabel
?op1ValueUri
?op2Label
?op2ValueLabel
?op2ValueUri

 WHERE {
     ?resourceUri a <${baseType}> .
     ?resourceUri ei:ERO_0000070 <${virtualOrganization}> .
     ?resourceUri rdfs:label ?resourceLabel .
     OPTIONAL {
          ?resourceUri eiapp:resource_description ?resourceDescription .
          ?resourceUri <${lp1}> ?lp1Value . <${lp1}> eiapp:preferredLabel ?lp1Label .
          ?resourceUri <${op1}> ?op1ValueUri . ?op1ValueUri rdfs:label ?op1ValueLabel . <${op1}> eiapp:preferredLabel ?op1Label .
          ?resourceUri <${op2}> ?op2ValueUri . ?op2ValueUri rdfs:label ?op2ValueLabel .
  <${op2}> eiapp:preferredLabel ?op2Label .
     }
}

Option 2 split in two queries (one for Ontology labels, one for instances) = > this may be preferable
Note that if desired props don't have preferred label we'll need to alter query 1

Query 1 => to be executed only once (labels don't change)

No Format
 }
}
{noformat}



*Example with substituted values*
{noformat}
PREFIX ei: <http://purl.obolibrary.org/obo/>
PREFIX eiapp: <http://eagle-i.org/ont/app/1.0/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

SELECT
?resourceUri
?resourceLabel
?lp1LabelresourceDescription
?op1Labellp1Label
?op2Labellp1Value

 WHERE {
     ?resourceUri a <http://purl.obolibrary.org/obo/ERO_0000071> .
     ?resourceUri ei:ERO_0000070 <http://harvard.dev.eagle-i.net/i/0000012e-5946-2efe-55da-381e80000000> .
     ?resourceUri rdfs:label ?resourceLabel .
     OPTIONAL {
          <${lp1}>?resourceUri eiapp:preferredLabelresource_description ?lp1LabelresourceDescription .
          <${op1}> eiapp:preferredLabel ?op1Label?resourceUri <http://purl.obolibrary.org/obo/ERO_0000480> ?lp1Value .
     }
}


Queries to get a detailed view  <${op2}> eiapp:preferredLabel ?op2Label .
     }
}

Query 2

No Format

PREFIX ei: <http://purl.obolibrary.org/obo/>of a resource

For the main resource, simply do a GET of its URI; the results can be in a variety of formats - see:
[eagle-i repo API guide | https://open.med.harvard.edu/display/eaglei/Repository+Design+Specification+and+API+Manual#RepositoryDesignSpecificationandAPIManual-FormatIdentifiersandMIMETypes]

There is an additional parameter forceXML, which returns a format that may be the most useful (it's the XML from which the HTML version is generated) - pure RDF/XML is horrible

Example:
{noformat}
GET http://harvard.qa.eagle-i.net/i/0000012e-5480-32e6-55da-381e80000000?forceXML
{noformat}

Getting info about the embedded:
assume main resource has uri http://harvard.eagle-i.net/123

This query will return embedded resources:
{noformat}
PREFIX eiapp: <http://eagle-i.org/ont/app/1.0/>
SELECT 
?embeddedResourceUri
WHERE {
<http://harvard.eagle-i.net/123> ?anyProperty ?embeddedResourceUri .
?embeddedResourceUri a ?type .
?type eiapp:inClassGroup eiapp:ClassGroup_EmbeddedResourceType . 
}
{noformat}

Iterate over this list and do a GET as with the main resource.


Queries for filters


Queries to get actual annotation values that have been used in the dataset
Do this for each direct filter property, e.g. fp1

{noformat}
PREFIX ei: <http://purl.obolibrary.org/obo/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

SELECT
?resourceUrifilterValueUri
?resourceLabel
?resourceDescription
?lp1Value
?op1ValueLabel
?op1ValueUri
?op2ValueLabel
?op2ValueUri

 filterValueLabel

WHERE {
     ?resourceUri a <${baseType}> .
     ?resourceUri ei:ERO_0000070 <${virtualOrganization}> .
     ?resourceUriresource <${fp1}> ?filterValueUri .
     ?filterValueUri rdfs:label ?resourceLabelfilterValueLabel .
}
{noformat}

Do this for each indirect filter property, e.g. ep1 OPTIONALand ip1

{noformat
PREFIX ei: <http://purl.obolibrary.org/obo/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

SELECT
?filterValueUri
?filterValueLabel

WHERE {
     ?resourceUri eiapp:resource_description ?resourceDescriptiona <${baseType}> .
     ?resourceUri ei:ERO_0000070 <${virtualOrganization}> .
     ?resourceUriresource <${lp1ep1}> ?lp1ValueembeddedResource .
          ?resourceUriembeddedResource <${op1ip1}> ?op1ValueUrifilterValueUri .
     ?op1ValueUrifilterValueUri rdfs:label ?op1ValueLabelfilterValueLabel .
}
{noformat}
Query to get the filtered dataset
First part is identical to unfiltered query, then conditions are added as triple patterns;
Assume  ?resourceUri <${op2}> ?op2ValueUri . ?op2ValueUri rdfs:label ?op2ValueLabel .
     }
}

Example with substituted values (option 1)

No Format
filterValueUrix is the filter value selected by the user, for each filter property, e.g. filterValueUri1 for fp1
(if only one filter is selected, add only that triple pattern/triple pattern group)

{noformat}
PREFIX ei: <http://purl.obolibrary.org/obo/>
PREFIX eiapp: <http://eagle-i.org/ont/app/1.0/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

SELECT 
?resourceUri
?resourceLabel
?resourceDescription
?lp1Label
?lp1Value
?op1Label
?op1ValueLabel
?op1ValueUri
?op2Label
?op2ValueLabel
?op2ValueUri

 WHERE {
     ?resourceUri a <http://purl.obolibrary.org/obo/ERO_0000071><${baseType}> .
     ?resourceUri ei:ERO_0000070 <http://harvard.dev.eagle-i.net/i/0000012e-5946-2efe-55da-381e80000000><${virtualOrganization}> .
     ?resourceUri rdfs:label ?resourceLabel .
     OPTIONAL { 
          ?resourceUri eiapp:resource_description ?resourceDescription .
          ?resourceUri <http://purl.obolibrary.org/obo/ERO_0000480><${lp1}> ?lp1Value . <http://purl.obolibrary.org/obo/ERO_0000480> eiapp:preferredLabel ?lp1Label .
          ?resourceUri <${op1}> ?op1ValueUri . ?op1ValueUri rdfs:label ?op1ValueLabel . 
          ?resourceUri <http://purl.obolibrary.org/obo/ERO_0001719> ?op1ValueUri<${op2}> ?op2ValueUri . ?op1ValueUriop2ValueUri rdfs:label ?op1ValueLabelop2ValueLabel . <http://purl.obolibrary.org/obo/ERO_0001719> eiapp:preferredLabel ?op1Label 
     }

     ?resourceUri <${fp1}> <${filterValueUri1}> .
     ?resourceUri <${fp2}> <${filterValueUri2}> .

     ?resourceUri <http://purl.obolibrary.org/obo/ERO_0000078> ?op2ValueUri . ?op2ValueUri rdfs:label ?op2ValueLabel . <http://purl.obolibrary.org/obo/ERO_0000078> eiapp:preferredLabel ?op2Label .
     }
}
<${ep1}> ?embeddedResource1 .
     ?embeddedResource1 <${ip1}> <${filterValueUriIndirect1}> .
     
     ?resourceUri <${ep2}> ?embeddedResource2 .
     ?embeddedResource2 <${ip2}> <${filterValueUriIndirect2}> .
}
{noformat}