Merge branch 'develop' of github.com:vivo-project/VIVO into develop

This commit is contained in:
Brian Caruso 2013-09-30 16:31:11 -04:00
commit b82429924e
61 changed files with 3021 additions and 4968 deletions

View file

@ -421,8 +421,8 @@ check_grants_to_exclude = Compruebe las subvenciones y proyectos que desea exclu
manage_affiliated_people = Gestione personas afiliadas manage_affiliated_people = Gestione personas afiliadas
check_people_to_exclude = Compruebe las personas que desea excluir de la página de perfil. check_people_to_exclude = Compruebe las personas que desea excluir de la página de perfil.
manage_grants = Gestione subvenciones para manage_publications = Gestione publicaciónes para
check_pubs_to_exclude = Compruebe las subvenciones que desea excluir de la página de perfil. check_pubs_to_exclude = Compruebe las publicaciónes que desea excluir de la página de perfil.
manage_web_pages = Gestionar páginas Web manage_web_pages = Gestionar páginas Web
has_no_webpages = Este individuo no tiene actualmente las páginas web específicas. Añadir una nueva página web haciendo clic en el botón de abajo. has_no_webpages = Este individuo no tiene actualmente las páginas web específicas. Añadir una nueva página web haciendo clic en el botón de abajo.
@ -821,4 +821,7 @@ enter_email_address = Por favor, introduzca un valor en el campo Dirección de C
full_name = Nombre y apellidos full_name = Nombre y apellidos
full_name_for = nombre y apellidos para full_name_for = nombre y apellidos para
first_name = Primer nombre first_name = Primer nombre
last_name = Apellido last_name = Apellido
title_not_found = Título que no se encuentra.
speeches_capitalized = Discursos
theses_capitalized = Tesis

File diff suppressed because one or more lines are too long

View file

@ -13,5 +13,6 @@ CONSTRUCT {
?person vivo:editorOf ?document ?person vivo:editorOf ?document
} UNION { } UNION {
?document vivo:editor ?person ?document vivo:editor ?person
FILTER NOT EXISTS { ?person vivo:editorOf ?document }
} }
} }

View file

@ -11,5 +11,7 @@ CONSTRUCT {
} WHERE { } WHERE {
{ ?person vivo:currentlyHeadOf ?org } { ?person vivo:currentlyHeadOf ?org }
UNION UNION
{ ?org vivo:currentlyHeadedBy ?person } { ?org vivo:currentlyHeadedBy ?person
FILTER NOT EXISTS { ?person vivo:currentlyHeadOf ?org }
}
} }

View file

@ -11,5 +11,7 @@ CONSTRUCT {
} WHERE { } WHERE {
{ ?person vivo:currentMemberOf ?org } { ?person vivo:currentMemberOf ?org }
UNION UNION
{ ?org vivo:hasCurrentMember ?person } { ?org vivo:hasCurrentMember ?person
FILTER NOT EXISTS { ?person vivo:currentMemberOf ?org }
}
} }

View file

@ -0,0 +1,17 @@
PREFIX vivo: <http://vivoweb.org/ontology/core#>
PREFIX owl: <http://www.w3.org/2002/07/owl#Thing>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
CONSTRUCT {
?person1 vivo:relatedBy _:relationship .
?person2 vivo:relatedBy _:relationship .
_:relationship vivo:relates ?person1 .
_:relationship vivo:relates ?person2 .
} WHERE {
{ ?person1 vivo:hasCollaborator ?person2
FILTER NOT EXISTS {
?person1 vivo:relatedBy ?relationship .
?relationship vivo:relates ?person2
}
}
}

View file

@ -0,0 +1,11 @@
PREFIX vivo: <http://vivoweb.org/ontology/core#>
PREFIX owl: <http://www.w3.org/2002/07/owl#Thing>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
CONSTRUCT {
?role vivo:relatedBy ?grant .
?grant vivo:relates ?role
} WHERE {
?role vivo:roleContributesTo ?grant .
?grant a vivo:Grant .
}

View file

@ -13,5 +13,7 @@ CONSTRUCT {
} WHERE { } WHERE {
{ ?agent vivo:administers ?grant } { ?agent vivo:administers ?grant }
UNION UNION
{ ?grant vivo:administeredBy ?agent } { ?grant vivo:administeredBy ?agent
FILTER NOT EXISTS { ?agent vivo:administers ?grant }
}
} }

View file

@ -0,0 +1,11 @@
PREFIX vivo: <http://vivoweb.org/ontology/core#>
PREFIX owl: <http://www.w3.org/2002/07/owl#Thing>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
CONSTRUCT {
?role vivo:roleContributesTo ?grant .
?grant vivo:contributingRole ?role .
} WHERE {
?role vivo:roleContributesTo ?grant .
?grant a vivo:Grant .
}

View file

@ -25,11 +25,14 @@
?dateTimeEnd ?dateTimeEnd
WHERE { WHERE {
?subject ?property ?advisory ?subject ?property ?advisory .
?advisory core:relates ?advisor .
?advisor &lt;http://purl.obolibrary.org/obo/RO_0000053&gt; ?advisorRole .
LET ( ?localName := afn:localname(?advisory) ) LET ( ?localName := afn:localname(?advisory) )
OPTIONAL { ?advisory rdfs:label ?advisoryLabel } OPTIONAL { ?advisory rdfs:label ?advisoryLabel }
OPTIONAL { ?advisory core:relates ?advisee . OPTIONAL { ?advisory core:relates ?advisee .
?advisee a foaf:Person . ?advisee a foaf:Person .
?advisee &lt;http://purl.obolibrary.org/obo/RO_0000053&gt; ?adviseeRole
OPTIONAL { ?advisee rdfs:label ?adviseeLabel } OPTIONAL { ?advisee rdfs:label ?adviseeLabel }
} }
OPTIONAL { ?advisory core:relates ?degree . OPTIONAL { ?advisory core:relates ?degree .
@ -74,7 +77,10 @@
?subject ?property ?advisory . ?subject ?property ?advisory .
?advisory a core:AdvisingRelationship . ?advisory a core:AdvisingRelationship .
?advisory ?advisoryProperty ?advisoryValue . ?advisory ?advisoryProperty ?advisoryValue .
?advisory rdfs:label ?advisoryLabel ?advisory rdfs:label ?advisoryLabel .
?advisory core:relates ?advisor .
?advisor &lt;http://purl.obolibrary.org/obo/RO_0000053&gt; ?advisorRole .
?advisorRole a core:AdvisorRole
} WHERE { } WHERE {
{ {
?subject ?property ?advisory . ?subject ?property ?advisory .
@ -88,10 +94,23 @@
?advisory a core:AdvisingRelationship . ?advisory a core:AdvisingRelationship .
?advisory ?advisoryProperty ?advisoryValue . ?advisory ?advisoryProperty ?advisoryValue .
?advisory rdfs:label ?advisoryLabel ?advisory rdfs:label ?advisoryLabel
} UNION {
?subject ?property ?advisory .
?advisory a core:AdvisingRelationship .
?advisory ?advisoryProperty ?advisoryValue .
?advisory core:relates ?advisor .
?advisor &lt;http://purl.obolibrary.org/obo/RO_0000053&gt; ?advisorRole .
?advisorRole a core:AdvisorRole
} }
} }
</query-construct> </query-construct>
OPTIONAL { ?advisory core:relates ?advisee .
?advisee a foaf:Person .
?advisee &lt;http://purl.obolibrary.org/obo/RO_0000053&gt; ?adviseeRole
<query-construct> <query-construct>
PREFIX bibo: &lt;http://purl.org/ontology/bibo/&gt; PREFIX bibo: &lt;http://purl.org/ontology/bibo/&gt;
PREFIX core: &lt;http://vivoweb.org/ontology/core#&gt; PREFIX core: &lt;http://vivoweb.org/ontology/core#&gt;
@ -104,6 +123,8 @@
?advisory core:relates ?advisee . ?advisory core:relates ?advisee .
?advisee a foaf:Person . ?advisee a foaf:Person .
?advisee rdfs:label ?adviseeLabel . ?advisee rdfs:label ?adviseeLabel .
?advisee &lt;http://purl.obolibrary.org/obo/RO_0000053&gt; ?adviseeRole .
?adviseeRole a core:AdviseeRole .
?advisory core:relates ?degree . ?advisory core:relates ?degree .
?degree a core:AcademicDegree . ?degree a core:AcademicDegree .
?degree rdfs:label ?degreeLabel . ?degree rdfs:label ?degreeLabel .
@ -117,11 +138,15 @@
?advisory a core:AdvisingRelationship . ?advisory a core:AdvisingRelationship .
?advisory core:relates ?advisee . ?advisory core:relates ?advisee .
?advisee a foaf:Person . ?advisee a foaf:Person .
?advisee &lt;http://purl.obolibrary.org/obo/RO_0000053&gt; ?adviseeRole .
?adviseeRole a core:AdviseeRole
} UNION { } UNION {
?subject ?property ?advisory . ?subject ?property ?advisory .
?advisory a core:AdvisingRelationship . ?advisory a core:AdvisingRelationship .
?advisory core:relates ?advisee . ?advisory core:relates ?advisee .
?advisee a foaf:Person . ?advisee a foaf:Person .
?advisee &lt;http://purl.obolibrary.org/obo/RO_0000053&gt; ?adviseeRole .
?adviseeRole a core:AdviseeRole .
?advisee rdfs:label ?adviseeLabel ?advisee rdfs:label ?adviseeLabel
} UNION { } UNION {
?subject ?property ?advisory . ?subject ?property ?advisory .

View file

@ -30,7 +30,7 @@
?subject ?property ?authorship . ?subject ?property ?authorship .
?authorship core:relates ?infoResource . ?authorship core:relates ?infoResource .
?infoResource a bibo:Document . ?infoResource a bibo:Document .
?infoResource rdfs:label ?infoResourceName ?infoResource rdfs:label ?infoResourceName .
OPTIONAL { ?infoResource bibo:volume ?volume } OPTIONAL { ?infoResource bibo:volume ?volume }
OPTIONAL { ?infoResource bibo:pageStart ?startPage } OPTIONAL { ?infoResource bibo:pageStart ?startPage }
@ -49,9 +49,7 @@
OPTIONAL { ?infoResource core:partOf ?partOfObj . OPTIONAL { ?infoResource core:partOf ?partOfObj .
?partOfObj rdfs:label ?partOf ?partOfObj rdfs:label ?partOf
} }
OPTIONAL { ?infoResource vitro:mostSpecificType ?subclass . OPTIONAL { ?infoResource vitro:mostSpecificType ?subclass }
?subclass rdfs:subClassOf core:InformationResource
}
OPTIONAL { ?infoResource core:hasPublicationVenue ?publishedIn . OPTIONAL { ?infoResource core:hasPublicationVenue ?publishedIn .
?publishedIn rdfs:label ?journal ?publishedIn rdfs:label ?journal
} }
@ -67,12 +65,14 @@
</query-select> </query-select>
<query-construct> <query-construct>
PREFIX core: &lt;http://vivoweb.org/ontology/core#&gt; PREFIX bibo: &lt;http://purl.org/ontology/bibo/&gt;
PREFIX rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt; PREFIX vitro: &lt;http://vitro.mannlib.cornell.edu/ns/vitro/0.7#&gt;
CONSTRUCT { CONSTRUCT {
?subclass rdfs:subClassOf core:InformationResource ?infoResource a bibo:Document .
?infoResource vitro:mostSpecificType ?subclass
} WHERE { } WHERE {
?subclass rdfs:subClassOf core:InformationResource ?infoResource a bibo:Document .
?infoResource vitro:mostSpecificType ?subclass
} }
</query-construct> </query-construct>

View file

@ -122,19 +122,19 @@ $(document).ready(function(){
// if there are no selected pubs, hide the manage link; same for grants // if there are no selected pubs, hide the manage link; same for grants
// and affiliated people on the org profile page // and affiliated people on the org profile page
if ( $('ul#authorInAuthorshipList').children('li').length < 1 && $('h3#authorInAuthorship').attr('class') != "hiddenPubs" ) { if ( $('ul#relatedBy-Authorship-List').children('li').length < 1 && $('h3#relatedBy-Authorship').attr('class') != "hiddenPubs" ) {
$('a#managePubLink').hide(); $('a#managePubLink').hide();
} }
if ( $('ul#hasResearcherRoleList').children('li').length < 1 && if ( $('ul#RO_0000053-ResearcherRole-List').children('li').length < 1 &&
$('ul#hasPrincipalInvestigatorRoleList').children('li').length < 1 && $('ul#RO_0000053-PrincipalInvestigatorRole-List').children('li').length < 1 &&
$('ul#hasCo-PrincipalInvestigatorRoleList').children('li').length < 1 && $('ul#RO_0000053-CoPrincipalInvestigatorRole-List').children('li').length < 1 &&
$('ul#hasInvestigatorRoleList').children('li').length < 1 && $('ul#RO_0000053-InvestigatorRole-List').children('li').length < 1 &&
$('h3#hasResearcherRole').attr('class') != "hiddenGrants" ) { $('h3#RO_0000053-ResearcherRole').attr('class') != "hiddenGrants" ) {
$('a#manageGrantLink').hide(); $('a#manageGrantLink').hide();
} }
if ( $('ul#organizationForPositionList').children('li').length < 1 && $('h3#organizationForPosition').attr('class') != "hiddenPeople" ) { if ( $('ul#relatedBy-Position-List').children('li').length < 1 && $('h3#relatedBy-Position').attr('class') != "hiddenPeople" ) {
$('a#managePeopleLink').hide(); $('a#managePeopleLink').hide();
} }

View file

@ -15,7 +15,7 @@
${affiliatedResearchAreas!} ${affiliatedResearchAreas!}
</section> <!-- #individual-info --> </section> <!-- #individual-info -->
</section> <!-- #individual-intro --> </section> <!-- #individual-intro -->
<!--postindiviudal overiew tfl--> <!--postindividual overiew ftl-->
</#assign> </#assign>
<#include "individual-vitro.ftl"> <#include "individual-vitro.ftl">

View file

@ -3,17 +3,17 @@
<#assign isPersonType = editConfiguration.pageData.isPersonType /> <#assign isPersonType = editConfiguration.pageData.isPersonType />
<form id="addLabelForm" name="addLabelForm" class="customForm" action="${submitUrl}"> <form id="addLabelForm" name="addLabelForm" class="customForm" action="${submitUrl}">
<h2>${i18n().add_label}</h2> <h2>${i18n().add_label}</h2>
<#if isPersonType = "true"> <#if isPersonType?has_content && isPersonType = "true">
<p> <p>
<label for="firstName">${i18n().first_name} ${requiredHint}</label> <label for="firstName">${i18n().first_name} ${requiredHint}</label>
<input size="30" type="text" id="firstName" name="firstName" value="${firstNameValue}" /> <input size="30" type="text" id="firstName" name="firstName" value="${firstNameValue}" />
</p> </p>
<#--TODO: With ISF changes, add middle name input--> <#--TODO: With ISF changes, add middle name input-->
<!--p--> <p>
<!--label for="middleName">${i18n().middle_name} ${requiredHint}</label> <label for="middleName">${i18n().middle_name} </label>
<input size="30" type="text" id="middleName" name="middleName" value="${middleNameValue}" /> <input size="30" type="text" id="middleName" name="middleName" value="${middleNameValue}" />
</p--> </p>
<p> <p>
<label for="lastName">${i18n().last_name} ${requiredHint}</label> <label for="lastName">${i18n().last_name} ${requiredHint}</label>

View file

@ -5,8 +5,7 @@
<#--Get existing value for specific data literals and uris, in case the form is returned because of an error--> <#--Get existing value for specific data literals and uris, in case the form is returned because of an error-->
<#assign firstNameValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "firstName")/> <#assign firstNameValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "firstName")/>
<#assign lastNameValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "lastName")/> <#assign lastNameValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "lastName")/>
<#--With ISF changes, we also have a niddle name value, also add error field below--> <#assign middleNameValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "middleName") />
<#--assign middleNameValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "middleName") /-->
<#assign labelValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "label")/> <#assign labelValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "label")/>
<#assign newLabelLanguageValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "newLabelLanguage")/> <#assign newLabelLanguageValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "newLabelLanguage")/>

View file

@ -3,12 +3,14 @@
<#-- Template for sparkline visualization on individual profile page --> <#-- Template for sparkline visualization on individual profile page -->
<#-- Determine whether this person is an author --> <#-- Determine whether this person is an author -->
<#assign isAuthor = p.hasStatements(propertyGroups, "${core}authorInAuthorship") /> <#assign isAuthor = p.hasVisualizationStatements(propertyGroups, "${core}relatedBy", "${core}Authorship") />
<#-- Determine whether this person is involved in any grants --> <#-- Determine whether this person is involved in any grants -->
<#assign isInvestigator = ( p.hasStatements(propertyGroups, "${core}hasInvestigatorRole") || <#assign obo_RO53 = "http://purl.obolibrary.org/obo/RO_0000053">
p.hasStatements(propertyGroups, "${core}hasPrincipalInvestigatorRole") ||
p.hasStatements(propertyGroups, "${core}hasCo-PrincipalInvestigatorRole") ) > <#assign isInvestigator = ( p.hasVisualizationStatements(propertyGroups, "${obo_RO53}", "${core}InvestigatorRole") ||
p.hasVisualizationStatements(propertyGroups, "${obo_RO53}", "${core}PrincipalInvestigatorRole") ||
p.hasVisualizationStatements(propertyGroups, "${obo_RO53}", "${core}CoPrincipalInvestigatorRole") ) >
<#if (isAuthor || isInvestigator)> <#if (isAuthor || isInvestigator)>
@ -70,4 +72,4 @@
<div class="collaboratorship-link"><a href="${coInvestigatorVisUrl}" title="${i18n().co_investigator_network}">${i18n().co_investigator_network_capitalized}</a></div> <div class="collaboratorship-link"><a href="${coInvestigatorVisUrl}" title="${i18n().co_investigator_network}">${i18n().co_investigator_network_capitalized}</a></div>
</div> </div>
</#if> </#if>
</#if> </#if>

View file

@ -18,8 +18,8 @@
<span class="hideThis">&nbsp;</span> <span class="hideThis">&nbsp;</span>
<script type="text/javascript" > <script type="text/javascript" >
$('span.hideThis').parent().parent().addClass("hideThis"); $('span.hideThis').parent().parent().addClass("hideThis");
if ( $('h3#authorInAuthorship').attr('class').length == 0 ) { if ( $('h3#relatedBy-Authorship').attr('class').length == 0 ) {
$('h3#authorInAuthorship').addClass('hiddenPubs'); $('h3#relatedBy-Authorship').addClass('hiddenPubs');
} }
$('span.hideThis').parent().remove(); $('span.hideThis').parent().remove();
</script> </script>
@ -111,6 +111,6 @@
</#if> </#if>
</#local> </#local>
${resourceTitle} ${citationDetails} <@dt.yearSpan "${statement.dateTime!}" /> ${resourceTitle} ${citationDetails} <@dt.yearSpan "${statement.dateTime!}" />
</#if> </#if>
</#macro> </#macro>

View file

@ -16,8 +16,8 @@
<span class="hideThis">&nbsp;</span> <span class="hideThis">&nbsp;</span>
<script type="text/javascript" > <script type="text/javascript" >
$('span.hideThis').parent().parent().addClass("hideThis"); $('span.hideThis').parent().parent().addClass("hideThis");
if ( $('h3#hasResearcherRole').attr('class').length == 0 ) { if ( $('h3#RO_0000053-ResearcherRole').attr('class').length == 0 ) {
$('h3#hasResearcherRole').addClass('hiddenGrants'); $('h3#RO_0000053-ResearcherRole').addClass('hiddenGrants');
} }
$('span.hideThis').parent().remove(); $('span.hideThis').parent().remove();
</script> </script>

View file

@ -25,7 +25,7 @@ ${i18n().check_grants_to_exclude}
<ul > <ul >
<#list grantList as grant> <#list grantList as grant>
<li> <li>
<input type="checkbox" class="grantCheckbox" <#if grant.hideThis??>checked</#if> />${grant.label!} <input type="checkbox" class="grantCheckbox" <#if grant.hideThis??>checked</#if> />${grant.label!grant.activity!}
</li> </li>
<script type="text/javascript"> <script type="text/javascript">
grantData.push({ grantData.push({

View file

@ -6,9 +6,9 @@
<#if subjectName?contains(",") > <#if subjectName?contains(",") >
<#assign lastName = subjectName?substring(0,subjectName?index_of(",")) /> <#assign lastName = subjectName?substring(0,subjectName?index_of(",")) />
<#assign firstName = subjectName?substring(subjectName?index_of(",") + 1) /> <#assign firstName = subjectName?substring(subjectName?index_of(",") + 1) />
<h2>${i18n().manage_publications} ${firstName} ${lastName}</h2> <h2>${i18n().manage_publications_for} ${firstName} ${lastName}</h2>
<#else> <#else>
<h2>${i18n().manage_publications} ${subjectName}</h2> <h2>${i18n().manage_publications_for} ${subjectName}</h2>
</#if> </#if>
<p style="margin-left:25px;margin-bottom:12px"> <p style="margin-left:25px;margin-bottom:12px">
${i18n().check_pubs_to_exclude} ${i18n().check_pubs_to_exclude}
@ -25,9 +25,9 @@ ${i18n().check_pubs_to_exclude}
<#if sub = "Software"> <#if sub = "Software">
${sub} ${sub}
<#elseif sub = "Thesis"> <#elseif sub = "Thesis">
Theses ${i18n().theses_capitalized}
<#elseif sub = "Speech"> <#elseif sub = "Speech">
Speeches ${i18n().speeches_capitalized}
<#else> <#else>
${sub}s ${sub}s
</#if> </#if>
@ -38,7 +38,7 @@ ${i18n().check_pubs_to_exclude}
<#list pubs as pub> <#list pubs as pub>
<li> <li>
<input type="checkbox" class="pubCheckbox" <#if pub.hideThis??>checked</#if> /> <input type="checkbox" class="pubCheckbox" <#if pub.hideThis??>checked</#if> />
<#if pub.title?has_content>${pub.title!}<#else>Title not found.</#if> <#if pub.title?has_content>${pub.title!}<#else>${i18n().title_not_found}</#if>
</li> </li>
<script type="text/javascript"> <script type="text/javascript">
publicationData.push({ publicationData.push({

View file

@ -11,6 +11,8 @@
<#--Get existing value for specific data literals and uris--> <#--Get existing value for specific data literals and uris-->
<#assign firstNameValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "firstName")/> <#assign firstNameValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "firstName")/>
<#assign lastNameValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "lastName")/> <#assign lastNameValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "lastName")/>
<#assign middleNameValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "middleName")/>
<#assign labelValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "label")/> <#assign labelValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "label")/>
<#--If edit submission exists, then retrieve validation errors if they exist--> <#--If edit submission exists, then retrieve validation errors if they exist-->
@ -51,6 +53,11 @@
<label for="firstName">${i18n().first_name} ${requiredHint}</label> <label for="firstName">${i18n().first_name} ${requiredHint}</label>
<input size="30" type="text" id="firstName" name="firstName" value="${firstNameValue}" /> <input size="30" type="text" id="firstName" name="firstName" value="${firstNameValue}" />
</p> </p>
<p>
<label for="lastName">${i18n().middle_name} </label>
<input size="30" type="text" id="middleName" name="middleName" value="${middleNameValue}" />
</p>
<p> <p>
<label for="lastName">${i18n().last_name} ${requiredHint}</label> <label for="lastName">${i18n().last_name} ${requiredHint}</label>

View file

@ -16,7 +16,7 @@
<h1 id="noPubsOrGrants-header">${organizationLabel}</h1> <h1 id="noPubsOrGrants-header">${organizationLabel}</h1>
<h3 id="alternative-vis-info">${textForCurrentEntityComparisonType?capitalize} ${i18n().temporal_graph_capitalized} <h3 id="alternative-vis-info">${textForCurrentEntityComparisonType?capitalize} ${i18n().temporal_graph_capitalized}
<span id="noPubsOrGrants-span">|&nbsp;<a href="${temporalGraphURL}" title="${i18n().view}">${i18n().view} ${textForOtherEntityComparisonType} ${i18n().temporal_graph}</a></span> <span id="noPubsOrGrants-span">|&nbsp;<a href="${temporalGraphURL}" title="${i18n().view}">${i18n().view}&nbsp${textForOtherEntityComparisonType}&nbsp;${i18n().temporal_graph}</a></span>
</h3> </h3>
<div id="error-body"> <div id="error-body">
<p>${i18n().entity_comp_error_text1} <p>${i18n().entity_comp_error_text1}

View file

@ -5,7 +5,7 @@
<h2>${i18n().visualization_tools}</h2> <h2>${i18n().visualization_tools}</h2>
<a href="${refreshCacheURL}">${i18n().refresh_cached_vis_model}</a> <a href="${refreshCacheURL}">${i18n().refresh_cached_vis_models}</a>
<section class="visualizationTools"> <section class="visualizationTools">
<h3>${i18n().why_needed}</h3> <h3>${i18n().why_needed}</h3>
<p>${i18n().vis_tools_note_one}</p> <p>${i18n().vis_tools_note_one}</p>

View file

@ -453,7 +453,7 @@ local:eventWithinConfig a :ObjectPropertyDisplayConfig ;
local:includesEventContext a :ConfigContext ; local:includesEventContext a :ConfigContext ;
:hasConfiguration local:includesEventConfig ; :hasConfiguration local:includesEventConfig ;
:configContextFor <http://purl.obolibrary.org/obo/BFO_0000050> ; :configContextFor <http://purl.obolibrary.org/obo/BFO_0000051> ;
:qualifiedByDomain <http://purl.org/NET/c4dm/event.owl#Event> ; :qualifiedByDomain <http://purl.org/NET/c4dm/event.owl#Event> ;
:qualifiedBy <http://purl.org/NET/c4dm/event.owl#Event> . :qualifiedBy <http://purl.org/NET/c4dm/event.owl#Event> .
@ -467,11 +467,11 @@ local:includesEventConfig a :ObjectPropertyDisplayConfig ;
local:inEventSeriesContext a :ConfigContext ; local:inEventSeriesContext a :ConfigContext ;
:hasConfiguration local:inEventSeriesConfig ; :hasConfiguration local:inEventSeriesConfig ;
:configContextFor <http://purl.obolibrary.org/obo/BFO_0000051> ; :configContextFor <http://purl.obolibrary.org/obo/BFO_0000050> ;
:qualifiedByDomain <http://purl.org/NET/c4dm/event.owl#Event> ; :qualifiedByDomain <http://purl.org/NET/c4dm/event.owl#Event> ;
:qualifiedBy <http://purl.org/NET/c4dm/event.owl#EventSeries> . :qualifiedBy <http://purl.org/NET/c4dm/event.owl#EventSeries> .
local:includesEventConfig a :ObjectPropertyDisplayConfig ; local:inEventSeriesConfig a :ObjectPropertyDisplayConfig ;
:listViewConfigFile "listViewConfig-default.xml"^^xsd:string ; :listViewConfigFile "listViewConfig-default.xml"^^xsd:string ;
:displayName "in event series" ; :displayName "in event series" ;
vitro:displayRankAnnot 3; vitro:displayRankAnnot 3;
@ -479,3 +479,16 @@ local:includesEventConfig a :ObjectPropertyDisplayConfig ;
vitro:prohibitedFromUpdateBelowRoleLevelAnnot role:public ; vitro:prohibitedFromUpdateBelowRoleLevelAnnot role:public ;
:propertyGroup <http://vivoweb.org/ontology#vitroPropertyGroupoverview> . :propertyGroup <http://vivoweb.org/ontology#vitroPropertyGroupoverview> .
local:awardAssignedByContext a :ConfigContext ;
:hasConfiguration local:awardAssignedByConfig ;
:configContextFor <http://vivoweb.org/ontology/core#assignedBy> ;
:qualifiedByDomain <http://vivoweb.org/ontology/core#Award> ;
:qualifiedBy <http://vivoweb.org/ontology/core#Award> .
local:awardAssignedByConfig a :ObjectPropertyDisplayConfig ;
:listViewConfigFile "listViewConfig-default.xml"^^xsd:string ;
:displayName "award conferred by" ;
vitro:displayRankAnnot 3;
vitro:hiddenFromDisplayBelowRoleLevelAnnot role:public ;
vitro:prohibitedFromUpdateBelowRoleLevelAnnot role:public ;
:propertyGroup <http://vivoweb.org/ontology#vitroPropertyGroupoverview> .

View file

@ -539,7 +539,6 @@
<owl:Class rdf:about="http://purl.org/spar/c4o/BibliographicInformationSource"> <owl:Class rdf:about="http://purl.org/spar/c4o/BibliographicInformationSource">
<rdfs:label xml:lang="en-us">Bibliographic Information Source</rdfs:label> <rdfs:label xml:lang="en-us">Bibliographic Information Source</rdfs:label>
<rdfs:subClassOf rdf:resource="http://isf/deprecated_class"/>
<vitro:descriptionAnnot rdf:datatype="http://www.w3.org/2001/XMLSchema#string">A source of information about bibliographic citations, such as Google Scholar, Web of Science or Scopus.</vitro:descriptionAnnot> <vitro:descriptionAnnot rdf:datatype="http://www.w3.org/2001/XMLSchema#string">A source of information about bibliographic citations, such as Google Scholar, Web of Science or Scopus.</vitro:descriptionAnnot>
</owl:Class> </owl:Class>
@ -792,7 +791,6 @@
<owl:Class rdf:about="http://vivoweb.org/ontology/core#EducationalProcess"> <owl:Class rdf:about="http://vivoweb.org/ontology/core#EducationalProcess">
<rdfs:label xml:lang="en-us">Educational Process</rdfs:label> <rdfs:label xml:lang="en-us">Educational Process</rdfs:label>
<rdfs:subClassOf rdf:resource="http://isf/deprecated_class"/>
<rdfs:subClassOf> <rdfs:subClassOf>
<owl:Restriction> <owl:Restriction>
<owl:onProperty rdf:resource="http://vivoweb.org/ontology/core#supplementalInformation"/> <owl:onProperty rdf:resource="http://vivoweb.org/ontology/core#supplementalInformation"/>
@ -805,8 +803,8 @@
<owl:allValuesFrom rdf:resource="http://vivoweb.org/ontology/core#DateTimeInterval"/> <owl:allValuesFrom rdf:resource="http://vivoweb.org/ontology/core#DateTimeInterval"/>
</owl:Restriction> </owl:Restriction>
</rdfs:subClassOf> </rdfs:subClassOf>
<vitro:exampleAnnot rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Currently any abstract name is given to individuals of this class. This could change in the future.</vitro:exampleAnnot> <obo:IAO_0000112 rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Currently any abstract name is given to individuals of this class. This could change in the future.</obo:IAO_0000112>
<vitro:shortDef rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Represents educational training that has been received.</vitro:shortDef> <obo:IAO_0000115 rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Represents educational training that has been received.</obo:IAO_0000115>
<vitro:descriptionAnnot rdf:datatype="http://www.w3.org/2001/XMLSchema#string">This connects person to their academic degree through this educational training, but can also be used when the training does not result in a degree.</vitro:descriptionAnnot> <vitro:descriptionAnnot rdf:datatype="http://www.w3.org/2001/XMLSchema#string">This connects person to their academic degree through this educational training, but can also be used when the training does not result in a degree.</vitro:descriptionAnnot>
</owl:Class> </owl:Class>
@ -915,7 +913,7 @@
<owl:allValuesFrom rdf:resource="http://vivoweb.org/ontology/core#DateTimeValue"/> <owl:allValuesFrom rdf:resource="http://vivoweb.org/ontology/core#DateTimeValue"/>
</owl:Restriction> </owl:Restriction>
</rdfs:subClassOf> </rdfs:subClassOf>
<vitro:shortDef rdf:datatype="http://www.w3.org/2001/XMLSchema#string">The most general classification of an information resource</vitro:shortDef> <obo:IAO_0000115 rdf:datatype="http://www.w3.org/2001/XMLSchema#string">The most general classification of an information resource</obo:IAO_0000115>
</owl:Class> </owl:Class>
@ -1044,8 +1042,8 @@
<owl:allValuesFrom rdf:resource="http://vivoweb.org/ontology/core#DateTimeInterval"/> <owl:allValuesFrom rdf:resource="http://vivoweb.org/ontology/core#DateTimeInterval"/>
</owl:Restriction> </owl:Restriction>
</rdfs:subClassOf> </rdfs:subClassOf>
<vitro:shortDef rdf:datatype="http://www.w3.org/2001/XMLSchema#string">A person&apos;s, group&apos;s or organization&apos;s role in an endeavor</vitro:shortDef> <obo:IAO_0000115 rdf:datatype="http://www.w3.org/2001/XMLSchema#string">A person&apos;s, group&apos;s or organization&apos;s role in an endeavor</obo:IAO_0000115>
<vitro:exampleAnnot rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Only use if no specific subclasses of core:Role describe the role.</vitro:exampleAnnot> <obo:IAO_0000112 rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Only use if no specific subclasses of core:Role describe the role.</obo:IAO_0000112>
<vitro:descriptionAnnot rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Only use this broad role class if no subclasses of role describe the item being classified.</vitro:descriptionAnnot> <vitro:descriptionAnnot rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Only use this broad role class if no subclasses of role describe the item being classified.</vitro:descriptionAnnot>
</owl:Class> </owl:Class>
@ -1056,7 +1054,6 @@
<owl:Class rdf:about="http://vivoweb.org/ontology/core#Software"> <owl:Class rdf:about="http://vivoweb.org/ontology/core#Software">
<rdfs:label xml:lang="en-us">Software</rdfs:label> <rdfs:label xml:lang="en-us">Software</rdfs:label>
<rdfs:subClassOf rdf:resource="http://isf/deprecated_class"/>
<rdfs:subClassOf rdf:resource="http://vivoweb.org/ontology/core#InformationResource"/> <rdfs:subClassOf rdf:resource="http://vivoweb.org/ontology/core#InformationResource"/>
<rdfs:subClassOf> <rdfs:subClassOf>
<owl:Restriction> <owl:Restriction>
@ -1064,7 +1061,7 @@
<owl:allValuesFrom rdf:resource="http://www.w3.org/2000/01/rdf-schema#Literal"/> <owl:allValuesFrom rdf:resource="http://www.w3.org/2000/01/rdf-schema#Literal"/>
</owl:Restriction> </owl:Restriction>
</rdfs:subClassOf> </rdfs:subClassOf>
<vitro:shortDef rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Computer program and its related documentation; directs the operation of a computer</vitro:shortDef> <obo:IAO_0000115 rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Computer program and its related documentation; directs the operation of a computer</obo:IAO_0000115>
</owl:Class> </owl:Class>

View file

@ -1532,6 +1532,7 @@ there is a measurement process p that has specified output m, a measurement datu
<owl:ObjectProperty rdf:about="http://vivoweb.org/ontology/core#geographicFocusOf"> <owl:ObjectProperty rdf:about="http://vivoweb.org/ontology/core#geographicFocusOf">
<rdfs:label xml:lang="en">geographic focus of</rdfs:label> <rdfs:label xml:lang="en">geographic focus of</rdfs:label>
<rdfs:domain rdf:resource="http://vivoweb.org/ontology/core#GeographicRegion"/> <rdfs:domain rdf:resource="http://vivoweb.org/ontology/core#GeographicRegion"/>
<owl:inverseOf rdf:resource="http://vivoweb.org/ontology/core#geographicFocus"/>
</owl:ObjectProperty> </owl:ObjectProperty>

File diff suppressed because it is too large Load diff

View file

@ -73,16 +73,6 @@
<rdfs:subClassOf rdf:resource="http://purl.obolibrary.org/obo/IAO_0000003"/> <rdfs:subClassOf rdf:resource="http://purl.obolibrary.org/obo/IAO_0000003"/>
</owl:Class> </owl:Class>
<!-- http://vivoweb.org/ontology/core#URLLink -->
<owl:Class rdf:about="http://vivoweb.org/ontology/core#URLLink">
<rdfs:label xml:lang="en">urllink</rdfs:label>
<obo:IAO_0000112 rdf:datatype="http://www.w3.org/2001/XMLSchema#string">The full URL.</obo:IAO_0000112>
<obo:IAO_0000115 rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Uniform Resource Locator (URL) specifies where an identified resource is available and the mechanism for retrieving it.</obo:IAO_0000115>
<obo:IAO_0000112 rdf:datatype="http://www.w3.org/2001/XMLSchema#string">http://info.slis.indiana.edu/~katy/</obo:IAO_0000112>
</owl:Class>

View file

@ -52,46 +52,46 @@ core:FacultyMember
rdfs:subClassOf foaf:Person , <http://isf/deprecated_class> ; rdfs:subClassOf foaf:Person , <http://isf/deprecated_class> ;
vitro:descriptionAnnot vitro:descriptionAnnot
"Definition from here: http://research.carleton.ca/htr/defs.php."^^xsd:string ; "Definition from here: http://research.carleton.ca/htr/defs.php."^^xsd:string ;
vitro:shortDef "A person with at least one academic appointment to a specific faculty of a university or institution of higher learning."^^xsd:string . obo:IAO_0000115 "A person with at least one academic appointment to a specific faculty of a university or institution of higher learning."^^xsd:string .
core:Postdoc core:Postdoc
a owl:Class ; a owl:Class ;
rdfs:label "Postdoc"@en-us ; rdfs:label "Postdoc"@en-us ;
rdfs:subClassOf <http://isf/deprecated_class> , core:NonFacultyAcademic ; rdfs:subClassOf <http://isf/deprecated_class> , core:NonFacultyAcademic ;
vitro:shortDef "A Person holding an academic employment appointment focused on research rather than teaching; temporary (or for some defined term)"^^xsd:string . obo:IAO_0000115 "A Person holding an academic employment appointment focused on research rather than teaching; temporary (or for some defined term)"^^xsd:string .
core:NonFacultyAcademic core:NonFacultyAcademic
a owl:Class ; a owl:Class ;
rdfs:label "Non-Faculty Academic"@en-us ; rdfs:label "Non-Faculty Academic"@en-us ;
rdfs:subClassOf foaf:Person , <http://isf/deprecated_class> ; rdfs:subClassOf foaf:Person , <http://isf/deprecated_class> ;
vitro:shortDef "A person not considered a faculty member but holding an academic appointment."^^xsd:string . obo:IAO_0000115 "A person not considered a faculty member but holding an academic appointment."^^xsd:string .
core:EmeritusLibrarian core:EmeritusLibrarian
a owl:Class ; a owl:Class ;
rdfs:label "Librarian Emeritus"@en-us ; rdfs:label "Librarian Emeritus"@en-us ;
rdfs:subClassOf foaf:Person , <http://isf/deprecated_class> ; rdfs:subClassOf foaf:Person , <http://isf/deprecated_class> ;
vitro:shortDef "A retired librarian who has retained their rank, title and privileges."^^xsd:string . obo:IAO_0000115 "A retired librarian who has retained their rank, title and privileges."^^xsd:string .
core:EmeritusFaculty core:EmeritusFaculty
a owl:Class ; a owl:Class ;
rdfs:label "Faculty Member Emeritus"@en-us ; rdfs:label "Faculty Member Emeritus"@en-us ;
rdfs:subClassOf foaf:Person , <http://isf/deprecated_class> ; rdfs:subClassOf foaf:Person , <http://isf/deprecated_class> ;
vitro:shortDef "A retired faculty member who has retained their rank, title and privileges."^^xsd:string . obo:IAO_0000115 "A retired faculty member who has retained their rank, title and privileges."^^xsd:string .
core:Librarian core:Librarian
a owl:Class ; a owl:Class ;
rdfs:label "Librarian"@en-us ; rdfs:label "Librarian"@en-us ;
rdfs:subClassOf foaf:Person , <http://isf/deprecated_class> ; rdfs:subClassOf foaf:Person , <http://isf/deprecated_class> ;
vitro:shortDef "A person working in a position of librarian or information professional, or academic or technical expert in support of providing information services or materials."^^xsd:string . obo:IAO_0000115 "A person working in a position of librarian or information professional, or academic or technical expert in support of providing information services or materials."^^xsd:string .
core:EmeritusProfessor core:EmeritusProfessor
a owl:Class ; a owl:Class ;
rdfs:label "Professor Emeritus"@en-us ; rdfs:label "Professor Emeritus"@en-us ;
rdfs:subClassOf core:EmeritusFaculty , foaf:Person , <http://isf/deprecated_class> ; rdfs:subClassOf core:EmeritusFaculty , foaf:Person , <http://isf/deprecated_class> ;
vitro:shortDef "A retired professor who has retained their rank, title and privileges."^^xsd:string . obo:IAO_0000115 "A retired professor who has retained their rank, title and privileges."^^xsd:string .
core:NonAcademic core:NonAcademic
a owl:Class ; a owl:Class ;
rdfs:label "Non-Academic"@en-us ; rdfs:label "Non-Academic"@en-us ;
rdfs:subClassOf foaf:Person , <http://isf/deprecated_class> ; rdfs:subClassOf foaf:Person , <http://isf/deprecated_class> ;
vitro:shortDef "A person holding a position that is not considered to be an academic appointment."^^xsd:string . obo:IAO_0000115 "A person holding a position that is not considered to be an academic appointment."^^xsd:string .

View file

@ -27,7 +27,6 @@
<owl:AnnotationProperty rdf:about="http://purl.obolibrary.org/obo/IAO_0000114"/> <owl:AnnotationProperty rdf:about="http://purl.obolibrary.org/obo/IAO_0000114"/>
<owl:AnnotationProperty rdf:about="http://purl.obolibrary.org/obo/IAO_0000119"/> <owl:AnnotationProperty rdf:about="http://purl.obolibrary.org/obo/IAO_0000119"/>
<owl:AnnotationProperty rdf:about="http://purl.obolibrary.org/obo/IAO_0000117"/> <owl:AnnotationProperty rdf:about="http://purl.obolibrary.org/obo/IAO_0000117"/>
<owl:AnnotationProperty rdf:about="http://vitro.mannlib.cornell.edu/ns/vitro/0.7#shortDef"/>
<owl:AnnotationProperty rdf:about="http://purl.obolibrary.org/obo/IAO_0000111"/> <owl:AnnotationProperty rdf:about="http://purl.obolibrary.org/obo/IAO_0000111"/>
<owl:AnnotationProperty rdf:about="http://purl.obolibrary.org/obo/IAO_0000112"/> <owl:AnnotationProperty rdf:about="http://purl.obolibrary.org/obo/IAO_0000112"/>
@ -864,7 +863,7 @@
<owl:Class rdf:about="http://purl.org/spar/fabio/ClinicalGuideline"> <owl:Class rdf:about="http://purl.org/spar/fabio/ClinicalGuideline">
<rdfs:label xml:lang="en">clinical guideline</rdfs:label> <rdfs:label xml:lang="en">clinical guideline</rdfs:label>
<rdfs:subClassOf rdf:resource="http://purl.org/ontology/bibo/Document"/> <rdfs:subClassOf rdf:resource="http://purl.org/ontology/bibo/Document"/>
<vitro:shortDef rdf:datatype="http://www.w3.org/2001/XMLSchema#string">A recommendation on the appropriate treatment and care of people with a specific disease or condition, based on the best available evidence, designed to help healthcare professionals in their work.</vitro:shortDef> <obo:IAO_0000115 rdf:datatype="http://www.w3.org/2001/XMLSchema#string">A recommendation on the appropriate treatment and care of people with a specific disease or condition, based on the best available evidence, designed to help healthcare professionals in their work.</obo:IAO_0000115>
<obo:IAO_0000115 rdf:datatype="http://www.w3.org/2001/XMLSchema#string">A recommendation on the appropriate treatment and care of people with a specific disease or condition, based on the best available evidence, designed to help healthcare professionals in their work.</obo:IAO_0000115> <obo:IAO_0000115 rdf:datatype="http://www.w3.org/2001/XMLSchema#string">A recommendation on the appropriate treatment and care of people with a specific disease or condition, based on the best available evidence, designed to help healthcare professionals in their work.</obo:IAO_0000115>
</owl:Class> </owl:Class>
@ -875,7 +874,7 @@
<owl:Class rdf:about="http://purl.org/spar/fabio/Comment"> <owl:Class rdf:about="http://purl.org/spar/fabio/Comment">
<rdfs:label xml:lang="en">comment</rdfs:label> <rdfs:label xml:lang="en">comment</rdfs:label>
<rdfs:subClassOf rdf:resource="http://purl.org/ontology/bibo/Document"/> <rdfs:subClassOf rdf:resource="http://purl.org/ontology/bibo/Document"/>
<vitro:shortDef rdf:datatype="http://www.w3.org/2001/XMLSchema#string">A verbal or written remark concerning some entity. In written form, a comment is often appended to that entity and termed an annotation. Within computer programs or ontologies, comments are added to enhance human understanding, and are usually prefaced by</vitro:shortDef> <obo:IAO_0000115 rdf:datatype="http://www.w3.org/2001/XMLSchema#string">A verbal or written remark concerning some entity. In written form, a comment is often appended to that entity and termed an annotation. Within computer programs or ontologies, comments are added to enhance human understanding, and are usually prefaced by</obo:IAO_0000115>
<obo:IAO_0000115 rdf:datatype="http://www.w3.org/2001/XMLSchema#string">A verbal or written remark concerning some entity. In written form, a comment is often appended to that entity and termed an annotation. Within computer programs or ontologies, comments are added to enhance human understanding, and are usually prefaced by a special syntactic symbol that ensures they are ignored during execution of the program. <obo:IAO_0000115 rdf:datatype="http://www.w3.org/2001/XMLSchema#string">A verbal or written remark concerning some entity. In written form, a comment is often appended to that entity and termed an annotation. Within computer programs or ontologies, comments are added to enhance human understanding, and are usually prefaced by a special syntactic symbol that ensures they are ignored during execution of the program.
has super-classes</obo:IAO_0000115> has super-classes</obo:IAO_0000115>
@ -888,7 +887,7 @@ has super-classes</obo:IAO_0000115>
<owl:Class rdf:about="http://purl.org/spar/fabio/Erratum"> <owl:Class rdf:about="http://purl.org/spar/fabio/Erratum">
<rdfs:label xml:lang="en">erratum</rdfs:label> <rdfs:label xml:lang="en">erratum</rdfs:label>
<rdfs:subClassOf rdf:resource="http://purl.org/ontology/bibo/Document"/> <rdfs:subClassOf rdf:resource="http://purl.org/ontology/bibo/Document"/>
<vitro:shortDef rdf:datatype="http://www.w3.org/2001/XMLSchema#string">A formal correction to an error introduced by the publisher into a previously published document.</vitro:shortDef> <obo:IAO_0000115 rdf:datatype="http://www.w3.org/2001/XMLSchema#string">A formal correction to an error introduced by the publisher into a previously published document.</obo:IAO_0000115>
<obo:IAO_0000115 rdf:datatype="http://www.w3.org/2001/XMLSchema#string">A formal correction to an error introduced by the publisher into a previously published document.</obo:IAO_0000115> <obo:IAO_0000115 rdf:datatype="http://www.w3.org/2001/XMLSchema#string">A formal correction to an error introduced by the publisher into a previously published document.</obo:IAO_0000115>
</owl:Class> </owl:Class>
@ -1142,12 +1141,6 @@ Contents
<!-- http://vivoweb.org/ontology/core#URLLink -->
<owl:Class rdf:about="http://vivoweb.org/ontology/core#URLLink"/>
<!-- http://vivoweb.org/ontology/core#Video --> <!-- http://vivoweb.org/ontology/core#Video -->
<owl:Class rdf:about="http://vivoweb.org/ontology/core#Video"> <owl:Class rdf:about="http://vivoweb.org/ontology/core#Video">

View file

@ -25,7 +25,6 @@
<owl:AnnotationProperty rdf:about="http://purl.obolibrary.org/obo/IAO_0000119"/> <owl:AnnotationProperty rdf:about="http://purl.obolibrary.org/obo/IAO_0000119"/>
<owl:AnnotationProperty rdf:about="http://purl.obolibrary.org/obo/IAO_0000117"/> <owl:AnnotationProperty rdf:about="http://purl.obolibrary.org/obo/IAO_0000117"/>
<owl:AnnotationProperty rdf:about="http://purl.obolibrary.org/obo/IAO_0000118"/> <owl:AnnotationProperty rdf:about="http://purl.obolibrary.org/obo/IAO_0000118"/>
<owl:AnnotationProperty rdf:about="http://vitro.mannlib.cornell.edu/ns/vitro/0.7#shortDef"/>
<owl:AnnotationProperty rdf:about="http://purl.obolibrary.org/obo/IAO_0000111"/> <owl:AnnotationProperty rdf:about="http://purl.obolibrary.org/obo/IAO_0000111"/>
<owl:AnnotationProperty rdf:about="http://purl.obolibrary.org/obo/IAO_0000112"/> <owl:AnnotationProperty rdf:about="http://purl.obolibrary.org/obo/IAO_0000112"/>
@ -93,7 +92,7 @@
<owl:Class rdf:about="http://vivoweb.org/ontology/scientific-research#Phase0ClinicalTrial"> <owl:Class rdf:about="http://vivoweb.org/ontology/scientific-research#Phase0ClinicalTrial">
<rdfs:label xml:lang="en">phase 0 clinical trial</rdfs:label> <rdfs:label xml:lang="en">phase 0 clinical trial</rdfs:label>
<rdfs:subClassOf rdf:resource="http://purl.obolibrary.org/obo/ERO_0000016"/> <rdfs:subClassOf rdf:resource="http://purl.obolibrary.org/obo/ERO_0000016"/>
<vitro:shortDef rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Phase 0 Clinical Trial</vitro:shortDef> <obo:IAO_0000115 rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Phase 0 Clinical Trial</obo:IAO_0000115>
<obo:IAO_0000115 rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Phase 0 is a recent designation for exploratory, first-in-human trials conducted in accordance with the United States Food and Drug Administration&apos;s (FDA) 2006 Guidance on Exploratory Investigational New Drug (IND) Studies. Phase 0 trials are also known as human microdosing studies and are designed to speed up the development of promising drugs or imaging agents by establishing very early on whether the drug or agent behaves in human subjects as was expected from preclinical studies.</obo:IAO_0000115> <obo:IAO_0000115 rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Phase 0 is a recent designation for exploratory, first-in-human trials conducted in accordance with the United States Food and Drug Administration&apos;s (FDA) 2006 Guidance on Exploratory Investigational New Drug (IND) Studies. Phase 0 trials are also known as human microdosing studies and are designed to speed up the development of promising drugs or imaging agents by establishing very early on whether the drug or agent behaves in human subjects as was expected from preclinical studies.</obo:IAO_0000115>
</owl:Class> </owl:Class>
@ -105,7 +104,7 @@
<rdfs:label xml:lang="en">phase 1 clinical trial</rdfs:label> <rdfs:label xml:lang="en">phase 1 clinical trial</rdfs:label>
<rdfs:subClassOf rdf:resource="http://purl.obolibrary.org/obo/ERO_0000016"/> <rdfs:subClassOf rdf:resource="http://purl.obolibrary.org/obo/ERO_0000016"/>
<obo:IAO_0000115 rdf:datatype="http://www.w3.org/2001/XMLSchema#string">In Phase I trials, researchers test an experimental drug or treatment in a small group of people (20-80) for the first time to evaluate its safety, determine a safe dosage range, and identify side effects</obo:IAO_0000115> <obo:IAO_0000115 rdf:datatype="http://www.w3.org/2001/XMLSchema#string">In Phase I trials, researchers test an experimental drug or treatment in a small group of people (20-80) for the first time to evaluate its safety, determine a safe dosage range, and identify side effects</obo:IAO_0000115>
<vitro:shortDef rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Phase 1 Clinical Trial</vitro:shortDef> <obo:IAO_0000115 rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Phase 1 Clinical Trial</obo:IAO_0000115>
</owl:Class> </owl:Class>
@ -116,7 +115,7 @@
<rdfs:label xml:lang="en">phase 2 clinical trial</rdfs:label> <rdfs:label xml:lang="en">phase 2 clinical trial</rdfs:label>
<rdfs:subClassOf rdf:resource="http://purl.obolibrary.org/obo/ERO_0000016"/> <rdfs:subClassOf rdf:resource="http://purl.obolibrary.org/obo/ERO_0000016"/>
<obo:IAO_0000115 rdf:datatype="http://www.w3.org/2001/XMLSchema#string">In Phase 2 trials, an experimental study drug or treatment is given to a larger group of people (100-300) to see if it is effective and to further evaluate its safety.</obo:IAO_0000115> <obo:IAO_0000115 rdf:datatype="http://www.w3.org/2001/XMLSchema#string">In Phase 2 trials, an experimental study drug or treatment is given to a larger group of people (100-300) to see if it is effective and to further evaluate its safety.</obo:IAO_0000115>
<vitro:shortDef rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Phase 2 Clinical Trial</vitro:shortDef> <obo:IAO_0000115 rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Phase 2 Clinical Trial</obo:IAO_0000115>
</owl:Class> </owl:Class>
@ -128,7 +127,7 @@
<rdfs:subClassOf rdf:resource="http://purl.obolibrary.org/obo/ERO_0000016"/> <rdfs:subClassOf rdf:resource="http://purl.obolibrary.org/obo/ERO_0000016"/>
<obo:IAO_0000115 rdf:datatype="http://www.w3.org/2001/XMLSchema#string">In Phase 3 trials, an experimental study drug or treatment is given to large groups of people (1,000-3,000) to confirm its effectiveness, monitor side effects, compare it to commonly used treatments, and collect information that will allow the experimental drug or treatment to be used safely. <obo:IAO_0000115 rdf:datatype="http://www.w3.org/2001/XMLSchema#string">In Phase 3 trials, an experimental study drug or treatment is given to large groups of people (1,000-3,000) to confirm its effectiveness, monitor side effects, compare it to commonly used treatments, and collect information that will allow the experimental drug or treatment to be used safely.
</obo:IAO_0000115> </obo:IAO_0000115>
<vitro:shortDef rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Phase 3 Clinical Trial</vitro:shortDef> <obo:IAO_0000115 rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Phase 3 Clinical Trial</obo:IAO_0000115>
</owl:Class> </owl:Class>
@ -139,7 +138,7 @@
<rdfs:label xml:lang="en">phase 4 clinical trial</rdfs:label> <rdfs:label xml:lang="en">phase 4 clinical trial</rdfs:label>
<rdfs:subClassOf rdf:resource="http://purl.obolibrary.org/obo/ERO_0000016"/> <rdfs:subClassOf rdf:resource="http://purl.obolibrary.org/obo/ERO_0000016"/>
<obo:IAO_0000115 rdf:datatype="http://www.w3.org/2001/XMLSchema#string">In Phase 4 trials, post marketing studies delineate additional information including the drug&apos;s or treatment&apos;s risks, benefits, and optimal use.</obo:IAO_0000115> <obo:IAO_0000115 rdf:datatype="http://www.w3.org/2001/XMLSchema#string">In Phase 4 trials, post marketing studies delineate additional information including the drug&apos;s or treatment&apos;s risks, benefits, and optimal use.</obo:IAO_0000115>
<vitro:shortDef rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Phase 4 Clinical Trial</vitro:shortDef> <obo:IAO_0000115 rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Phase 4 Clinical Trial</obo:IAO_0000115>
</owl:Class> </owl:Class>
</rdf:RDF> </rdf:RDF>

View file

@ -67,13 +67,13 @@ public class ManageGrantsForIndividualController extends FreemarkerHttpServlet {
+ "PREFIX afn: <http://jena.hpl.hp.com/ARQ/function#> \n" + "PREFIX afn: <http://jena.hpl.hp.com/ARQ/function#> \n"
+ "SELECT DISTINCT ?subclass ?role (str(?label2) as ?label) ?activity ?hideThis WHERE { \n" + "SELECT DISTINCT ?subclass ?role (str(?label2) as ?label) ?activity ?hideThis WHERE { \n"
+ " ?subject ?roleProp ?role . \n" + " ?subject ?roleProp ?role . \n"
+ " ?roleProp rdfs:subPropertyOf core:hasResearcherRole . \n" + " ?role a core:ResearcherRole . \n"
+ " ?role vitro:mostSpecificType ?subclass \n" + " ?role vitro:mostSpecificType ?subclass \n"
+ " OPTIONAL { ?role core:roleRealizedIn ?activity . \n" + " OPTIONAL { ?role core:relatedBy ?activity . \n"
+ " ?activity rdfs:label ?label2 \n" + " OPTIONAL {?activity rdfs:label ?label2} \n"
+ " } \n" + " } \n"
+ " OPTIONAL { ?role core:roleContributesTo ?activity . \n" + " OPTIONAL { ?role <http://purl.obolibrary.org/obo/BFO_0000054> ?activity . \n"
+ " ?activity rdfs:label ?label2 \n" + " OPTIONAL {?activity rdfs:label ?label2} \n"
+ " } \n" + " } \n"
+ " OPTIONAL { ?role core:hideFromDisplay ?hideThis } \n" + " OPTIONAL { ?role core:hideFromDisplay ?hideThis } \n"
+ "} ORDER BY ?subclass ?label2"; + "} ORDER BY ?subclass ?label2";

View file

@ -65,12 +65,14 @@ public class ManagePeopleForOrganizationController extends FreemarkerHttpServlet
+ "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> \n" + "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> \n"
+ "PREFIX vitro: <http://vitro.mannlib.cornell.edu/ns/vitro/0.7#> \n" + "PREFIX vitro: <http://vitro.mannlib.cornell.edu/ns/vitro/0.7#> \n"
+ "PREFIX afn: <http://jena.hpl.hp.com/ARQ/function#> \n" + "PREFIX afn: <http://jena.hpl.hp.com/ARQ/function#> \n"
+ "PREFIX foaf: <http://xmlns.com/foaf/0.1/> \n"
+ "SELECT DISTINCT ?subclass ?position (str(?label) as ?name) ?person ?hideThis WHERE { \n" + "SELECT DISTINCT ?subclass ?position (str(?label) as ?name) ?person ?hideThis WHERE { \n"
+ " ?subject core:organizationForPosition ?position . \n" + " ?subject core:relatedBy ?position . \n"
+ " OPTIONAL { ?position core:positionForPerson ?person . " + " ?position a core:Position . \n"
+ " OPTIONAL { ?position core:relates ?person . "
+ " ?person a foaf:Person . \n"
+ " ?person rdfs:label ?label } \n" + " ?person rdfs:label ?label } \n"
+ " OPTIONAL { ?position vitro:mostSpecificType ?subclass . \n" + " OPTIONAL { ?position vitro:mostSpecificType ?subclass } \n"
+ " ?subclass rdfs:subClassOf core:Position } \n"
+ " OPTIONAL { ?position core:hideFromDisplay ?hideThis } \n " + " OPTIONAL { ?position core:hideFromDisplay ?hideThis } \n "
+ "} ORDER BY ?subclass ?name"; + "} ORDER BY ?subclass ?name";

View file

@ -66,11 +66,12 @@ public class ManagePublicationsForIndividualController extends FreemarkerHttpSer
+ "PREFIX vitro: <http://vitro.mannlib.cornell.edu/ns/vitro/0.7#> \n" + "PREFIX vitro: <http://vitro.mannlib.cornell.edu/ns/vitro/0.7#> \n"
+ "PREFIX afn: <http://jena.hpl.hp.com/ARQ/function#> \n" + "PREFIX afn: <http://jena.hpl.hp.com/ARQ/function#> \n"
+ "SELECT DISTINCT ?subclass ?authorship (str(?label) as ?title) ?pub ?hideThis WHERE { \n" + "SELECT DISTINCT ?subclass ?authorship (str(?label) as ?title) ?pub ?hideThis WHERE { \n"
+ " ?subject core:authorInAuthorship ?authorship . \n" + " ?subject core:relatedBy ?authorship . \n"
+ " OPTIONAL { ?authorship core:linkedInformationResource ?pub . " + " ?authorship a core:Authorship . \n"
+ " OPTIONAL { ?authorship core:relates ?pub . "
+ " ?pub a <http://purl.org/ontology/bibo/Document> . \n"
+ " ?pub rdfs:label ?label \n" + " ?pub rdfs:label ?label \n"
+ " OPTIONAL { ?pub vitro:mostSpecificType ?subclass . \n" + " OPTIONAL { ?pub vitro:mostSpecificType ?subclass } \n"
+ " ?subclass rdfs:subClassOf core:InformationResource } \n"
+ " } \n" + " } \n"
+ " OPTIONAL { ?authorship core:hideFromDisplay ?hideThis } \n" + " OPTIONAL { ?authorship core:hideFromDisplay ?hideThis } \n"
+ "} ORDER BY ?subclass ?title"; + "} ORDER BY ?subclass ?title";

View file

@ -54,6 +54,7 @@ import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationVTw
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.FieldVTwo; import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.FieldVTwo;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.preprocessors.FoafNameToRdfsLabelPreprocessor; import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.preprocessors.FoafNameToRdfsLabelPreprocessor;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.preprocessors.ManageLabelsForIndividualPreprocessor; import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.preprocessors.ManageLabelsForIndividualPreprocessor;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.preprocessors.ManageLabelsForPersonPreprocessor;
import edu.cornell.mannlib.vitro.webapp.i18n.selection.LocaleSelectionDataGetter; import edu.cornell.mannlib.vitro.webapp.i18n.selection.LocaleSelectionDataGetter;
import edu.cornell.mannlib.vitro.webapp.i18n.selection.LocaleSelectorUtilities; import edu.cornell.mannlib.vitro.webapp.i18n.selection.LocaleSelectorUtilities;
import edu.cornell.mannlib.vitro.webapp.i18n.selection.SelectedLocale; import edu.cornell.mannlib.vitro.webapp.i18n.selection.SelectedLocale;
@ -69,12 +70,7 @@ public class ManageLabelsForPersonGenerator extends BaseEditConfigurationGenerat
private static String template = "manageLabelsForPerson.ftl"; private static String template = "manageLabelsForPerson.ftl";
private HashMap<String, List<LabelInformation>> labelsSortedByLanguage = null; private HashMap<String, List<LabelInformation>> labelsSortedByLanguage = null;
private List<Literal> existingLabelLiterals = null; private List<Literal> existingLabelLiterals = null;
//list of language names sorted alphabetically
private List<String> existingSortedLanguageNameList = null;
//This would be for the full list and can be used for the existing labels list as well
private HashMap<String, String> fullLanguageNameToCodeMap = null;
private static String predicateUri = RDFS.label.getURI();
@Override @Override
public EditConfigurationVTwo getEditConfiguration(VitroRequest vreq, HttpSession session) { public EditConfigurationVTwo getEditConfiguration(VitroRequest vreq, HttpSession session) {
@ -115,7 +111,7 @@ public class ManageLabelsForPersonGenerator extends BaseEditConfigurationGenerat
addFormSpecificData(config, vreq); addFormSpecificData(config, vreq);
//This preprocessor handles getting the correct label language and putting the attribute on the label //This preprocessor handles getting the correct label language and putting the attribute on the label
config.addEditSubmissionPreprocessor( config.addEditSubmissionPreprocessor(
new ManageLabelsForIndividualPreprocessor(config)); new ManageLabelsForPersonPreprocessor(config));
//This will handle generating the label from the first name, middle, and last names and also make sure to associate //This will handle generating the label from the first name, middle, and last names and also make sure to associate
//a language with that label //a language with that label
config.addModelChangePreprocessor(new FoafNameToRdfsLabelPreprocessor()); config.addModelChangePreprocessor(new FoafNameToRdfsLabelPreprocessor());
@ -150,22 +146,20 @@ public class ManageLabelsForPersonGenerator extends BaseEditConfigurationGenerat
private List<String> generateN3Optional(VitroRequest vreq) { private List<String> generateN3Optional(VitroRequest vreq) {
List<String> n3Optional = new ArrayList<String>(); List<String> n3Optional = new ArrayList<String>();
String predicateUri = EditConfigurationUtils.getPredicateUri(vreq);
String n3 = "?subject <" + predicateUri + "> ?label "; String personFullNameN3 = this.N3_PREFIX +
//n3 used if the subject is a person
//String personN3 = this.N3_PREFIX + "?subject foaf:firstName ?firstName ; foaf:lastName ?lastName .";
//This n3 will be different with the ISF changes
String personN3 = this.N3_PREFIX +
"?subject <http://purl.obolibrary.org/obo/ARG_2000028> ?individualVcard . \n" + "?subject <http://purl.obolibrary.org/obo/ARG_2000028> ?individualVcard . \n" +
"?individualVcard a <http://www.w3.org/2006/vcard/ns#Individual> . \n" + "?individualVcard a <http://www.w3.org/2006/vcard/ns#Individual> . \n" +
"?individualVcard <http://purl.obolibrary.org/obo/ARG_2000029> ?subject . \n" + "?individualVcard <http://purl.obolibrary.org/obo/ARG_2000029> ?subject . \n" +
"?individualVcard <http://www.w3.org/2006/vcard/ns#hasName> ?fullName . \n" + "?individualVcard <http://www.w3.org/2006/vcard/ns#hasName> ?fullName . \n" +
"?fullName a <http://www.w3.org/2006/vcard/ns#Name> . \n" + "?fullName a <http://www.w3.org/2006/vcard/ns#Name> .";
"?fullName <http://www.w3.org/2006/vcard/ns#givenName> ?firstName . \n" + String personFirstNameN3 =
"?fullName <http://www.w3.org/2006/vcard/ns#givenName> ?firstName . ";
String personLastNameN3 =
"?fullName <http://www.w3.org/2006/vcard/ns#familyName> ?lastName ."; "?fullName <http://www.w3.org/2006/vcard/ns#familyName> ?lastName .";
String personMiddleNameN3 = "?fullName <http://www.w3.org/2006/vcard/ns#middleName> ?middleName .";
n3Optional.add(n3); n3Optional.add(personFullNameN3 + "\n " + personFirstNameN3 + "\n " + personLastNameN3);
n3Optional.add(personN3); n3Optional.add(personMiddleNameN3);
return n3Optional; return n3Optional;
} }
@ -174,9 +168,7 @@ public class ManageLabelsForPersonGenerator extends BaseEditConfigurationGenerat
private void setFields(EditConfigurationVTwo editConfiguration, VitroRequest vreq, String predicateUri) { private void setFields(EditConfigurationVTwo editConfiguration, VitroRequest vreq, String predicateUri) {
Map<String, FieldVTwo> fields = new HashMap<String, FieldVTwo>(); Map<String, FieldVTwo> fields = new HashMap<String, FieldVTwo>();
editConfiguration.setFields(fields); editConfiguration.setFields(fields);
editConfiguration.addField(new FieldVTwo().
setName("label").
setValidators(getLabelValidators(vreq, editConfiguration)));
editConfiguration.addField(new FieldVTwo( editConfiguration.addField(new FieldVTwo(
).setName("newLabelLanguage")); ).setName("newLabelLanguage"));
//no validators since all of this is optional //no validators since all of this is optional
@ -186,7 +178,7 @@ public class ManageLabelsForPersonGenerator extends BaseEditConfigurationGenerat
setValidators(getFirstNameValidators(vreq, editConfiguration))); setValidators(getFirstNameValidators(vreq, editConfiguration)));
editConfiguration.addField(new FieldVTwo(). editConfiguration.addField(new FieldVTwo().
setName("middleName"). setName("middleName").
setValidators(getLastNameValidators(vreq, editConfiguration))); setValidators(getMiddleNameValidators(vreq, editConfiguration)));
editConfiguration.addField(new FieldVTwo(). editConfiguration.addField(new FieldVTwo().
setName("lastName"). setName("lastName").
@ -199,39 +191,36 @@ public class ManageLabelsForPersonGenerator extends BaseEditConfigurationGenerat
//first and last name have validators if is person is true //first and last name have validators if is person is true
private List<String> getFirstNameValidators(VitroRequest vreq, EditConfigurationVTwo config) { private List<String> getFirstNameValidators(VitroRequest vreq, EditConfigurationVTwo config) {
List<String> validators = new ArrayList<String>(); List<String> validators = new ArrayList<String>();
if(isPersonType(vreq, config)) {
validators.add("nonempty"); validators.add("nonempty");
}
return validators;
}
private List<String> getMiddleNameValidators(VitroRequest vreq, EditConfigurationVTwo config) {
List<String> validators = new ArrayList<String>();
return validators; return validators;
} }
private List<String> getLastNameValidators(VitroRequest vreq, EditConfigurationVTwo config) { private List<String> getLastNameValidators(VitroRequest vreq, EditConfigurationVTwo config) {
List<String> validators = new ArrayList<String>(); List<String> validators = new ArrayList<String>();
if(isPersonType(vreq, config)) {
validators.add("nonempty"); validators.add("nonempty");
}
return validators; return validators;
} }
//validate label if person is not true
private List<String> getLabelValidators(VitroRequest vreq, EditConfigurationVTwo config) {
List<String> validators = new ArrayList<String>();
if(!isPersonType(vreq, config)) {
validators.add("nonempty");
}
return validators;
}
private void setUrisAndLiteralsOnForm(EditConfigurationVTwo config, private void setUrisAndLiteralsOnForm(EditConfigurationVTwo config,
VitroRequest vreq) { VitroRequest vreq) {
List<String> literalsOnForm = new ArrayList<String>(); List<String> literalsOnForm = new ArrayList<String>();
literalsOnForm.add("label");
literalsOnForm.add("newLabelLanguage"); literalsOnForm.add("newLabelLanguage");
//optional for person //optional for person
literalsOnForm.add("firstName"); literalsOnForm.add("firstName");
literalsOnForm.add("lastName"); literalsOnForm.add("lastName");
literalsOnForm.add("middleName");
config.setLiteralsOnForm(literalsOnForm); config.setLiteralsOnForm(literalsOnForm);
} }
@ -253,17 +242,6 @@ public class ManageLabelsForPersonGenerator extends BaseEditConfigurationGenerat
private void initExistingLabels(EditConfigurationVTwo config, private void initExistingLabels(EditConfigurationVTwo config,
VitroRequest vreq) { VitroRequest vreq) {
this.existingLabelLiterals = this.getExistingLabels(config.getSubjectUri(), vreq); this.existingLabelLiterals = this.getExistingLabels(config.getSubjectUri(), vreq);
// this.labelsSortedByLanguage = this.getLabelsSortedByLanguage(config,vreq);
//language names sorted for the existing languages
// this.existingSortedLanguageNameList = getExistingSortedLanguageNamesList();
//Generate a label to language code hash map
//TODO:
//HashMap<String, String> labelToLanguageCode = new HashMap<String, String>();
//this.labels = getExistingLabels(config.getSubjectUri(), vreq);
//this.labelsSortedByLanguage = getLabelsSortedByLanguage(config.getSubjectUri(), vreq);
} }
@ -318,15 +296,7 @@ public class ManageLabelsForPersonGenerator extends BaseEditConfigurationGenerat
config.addFormSpecificData("subjectName", null); config.addFormSpecificData("subjectName", null);
} }
//Put in whether or not person type config.addFormSpecificData("isPersonType", "true");
if(isPersonType(vreq, config)) {
//Doing this b/c unsure how freemarker will handle boolean value from JAVA
config.addFormSpecificData("isPersonType", "true");
} else {
config.addFormSpecificData("isPersonType", "false");
}
//Include whether or not editable to enable edit/remove links and add to show up //Include whether or not editable to enable edit/remove links and add to show up
config.addFormSpecificData("editable", isEditable(vreq, config)); config.addFormSpecificData("editable", isEditable(vreq, config));
} }
@ -376,7 +346,6 @@ public class ManageLabelsForPersonGenerator extends BaseEditConfigurationGenerat
//Copied from NewIndividualFormGenerator //Copied from NewIndividualFormGenerator
//TODO: Refactor so common code can be used by both generators
public String getFOAFPersonClassURI() { public String getFOAFPersonClassURI() {
return "http://xmlns.com/foaf/0.1/Person"; return "http://xmlns.com/foaf/0.1/Person";
} }

View file

@ -41,6 +41,7 @@ public class NewIndividualFormGenerator extends BaseEditConfigurationGenerator i
)); ));
//Optional because user may have selected either person or individual of another kind //Optional because user may have selected either person or individual of another kind
//Person uses first name and last name whereas individual of other class would use label //Person uses first name and last name whereas individual of other class would use label
//middle name is also optional
config.setN3Optional(list( config.setN3Optional(list(
N3_PREFIX + "@prefix vcard:<http://www.w3.org/2006/vcard/ns#> .\n" N3_PREFIX + "@prefix vcard:<http://www.w3.org/2006/vcard/ns#> .\n"
+ " ?newInd <http://purl.obolibrary.org/obo/ARG_2000028> ?newVcardInd . \n" + " ?newInd <http://purl.obolibrary.org/obo/ARG_2000028> ?newVcardInd . \n"
@ -50,6 +51,7 @@ public class NewIndividualFormGenerator extends BaseEditConfigurationGenerator i
+ " ?newVcardName a <http://www.w3.org/2006/vcard/ns#Name> . \n" + " ?newVcardName a <http://www.w3.org/2006/vcard/ns#Name> . \n"
+ " ?newVcardName vcard:givenName ?firstName . \n" + " ?newVcardName vcard:givenName ?firstName . \n"
+ " ?newVcardName vcard:familyName ?lastName .", + " ?newVcardName vcard:familyName ?lastName .",
"?newVcardName <http://www.w3.org/2006/vcard/ns#middleName> ?middleName .",
N3_PREFIX + " ?newInd <" + RDFS.label.getURI() + "> ?label ." N3_PREFIX + " ?newInd <" + RDFS.label.getURI() + "> ?label ."
)); ));
@ -58,7 +60,7 @@ public class NewIndividualFormGenerator extends BaseEditConfigurationGenerator i
config.addNewResource("newVcardName", vreq.getWebappDaoFactory().getDefaultNamespace()); config.addNewResource("newVcardName", vreq.getWebappDaoFactory().getDefaultNamespace());
config.setUrisOnform(list ()); config.setUrisOnform(list ());
config.setLiteralsOnForm( list( "label", "firstName", "lastName" )); config.setLiteralsOnForm( list( "label", "firstName", "lastName", "middleName" ));
setUrisAndLiteralsInScope(config); setUrisAndLiteralsInScope(config);
//No SPARQL queries for existing since this is only used to create new, never for edit //No SPARQL queries for existing since this is only used to create new, never for edit
@ -67,6 +69,11 @@ public class NewIndividualFormGenerator extends BaseEditConfigurationGenerator i
setRangeDatatypeUri(XSD.xstring.getURI()). setRangeDatatypeUri(XSD.xstring.getURI()).
setValidators(getFirstNameValidators(vreq))); setValidators(getFirstNameValidators(vreq)));
config.addField(new FieldVTwo().
setName("middleName").
setRangeDatatypeUri(XSD.xstring.getURI()).
setValidators(getMiddleNameValidators(vreq)));
config.addField(new FieldVTwo(). config.addField(new FieldVTwo().
setName("lastName"). setName("lastName").
setRangeDatatypeUri(XSD.xstring.getURI()). setRangeDatatypeUri(XSD.xstring.getURI()).
@ -96,7 +103,12 @@ public class NewIndividualFormGenerator extends BaseEditConfigurationGenerator i
return config; return config;
} }
//first and last name have validators if is person is true private List<String> getMiddleNameValidators(VitroRequest vreq) {
List<String> validators = new ArrayList<String>();
return validators;
}
//first and last name have validators if is person is true
private List<String> getFirstNameValidators(VitroRequest vreq) { private List<String> getFirstNameValidators(VitroRequest vreq) {
List<String> validators = new ArrayList<String>(); List<String> validators = new ArrayList<String>();
if(isPersonType(vreq)) { if(isPersonType(vreq)) {

View file

@ -209,25 +209,25 @@ public class PersonHasAwardOrHonorGenerator extends VivoBaseGenerator implements
"?awardReceipt <"+ descriptionPred +"> ?description ."; "?awardReceipt <"+ descriptionPred +"> ?description .";
final static String n3ForExistingOrgNewAwardAssertion = final static String n3ForExistingOrgNewAwardAssertion =
"?award <" + awardConferredByPred +"> ?existingOrg . \n" + "?awardReceipt <" + awardConferredByPred +"> ?existingOrg . \n" +
"?existingOrg <" + awardConferredPred + "> ?award . \n" + "?existingOrg <" + awardConferredPred + "> ?awardReceipt . \n" +
"?award <"+ label + "> ?awardLabel ."; "?award <"+ label + "> ?awardLabel .";
final static String n3ForExistingOrgExistingAwardAssertion = final static String n3ForExistingOrgExistingAwardAssertion =
"?existingAward <" + awardConferredByPred +"> ?existingOrg . \n" + "?awardReceipt <" + awardConferredByPred +"> ?existingOrg . \n" +
"?existingOrg <" + awardConferredPred + "> ?existingAward . "; "?existingOrg <" + awardConferredPred + "> ?awardReceipt . ";
final static String n3ForNewOrgNewAwardAssertion = final static String n3ForNewOrgNewAwardAssertion =
"?newOrg a <" + orgClass + "> . \n" + "?newOrg a <" + orgClass + "> . \n" +
"?award <" + awardConferredByPred +"> ?newOrg . \n" + "?awardReceipt <" + awardConferredByPred +"> ?newOrg . \n" +
"?newOrg <" + awardConferredPred + "> ?award . \n" + "?newOrg <" + awardConferredPred + "> ?awardReceipt . \n" +
"?award <"+ label + "> ?awardLabel . \n" + "?award <"+ label + "> ?awardLabel . \n" +
"?newOrg <"+ label + "> ?orgLabel ."; "?newOrg <"+ label + "> ?orgLabel .";
final static String n3ForNewOrgExistingAwardAssertion = final static String n3ForNewOrgExistingAwardAssertion =
"?newOrg a <" + orgClass + "> . \n" + "?newOrg a <" + orgClass + "> . \n" +
"?existingAward <" + awardConferredByPred +"> ?newOrg . \n" + "?awardReceipt <" + awardConferredByPred +"> ?newOrg . \n" +
"?newOrg <" + awardConferredPred + "> ?existingAward . \n" + "?newOrg <" + awardConferredPred + "> ?awardReceipt . \n" +
"?newOrg <"+ label + "> ?orgLabel ."; "?newOrg <"+ label + "> ?orgLabel .";
final static String n3ForYearAwarded = final static String n3ForYearAwarded =

View file

@ -240,6 +240,8 @@ public class PersonHasEducationalTraining extends VivoBaseGenerator implements
"?newOrg <http://vivoweb.org/ontology/core#assigns> ?newAwardedDegree . \n" + "?newOrg <http://vivoweb.org/ontology/core#assigns> ?newAwardedDegree . \n" +
"?newOrg a ?orgType . \n" + "?newOrg a ?orgType . \n" +
"?newOrg <"+ label +"> ?orgLabel . \n" + "?newOrg <"+ label +"> ?orgLabel . \n" +
"?edTraining <http://purl.obolibrary.org/obo/RO_0000057> ?newOrg . \n" +
"?newOrg <http://purl.obolibrary.org/obo/RO_0000056> ?edTraining . \n" +
"?newAwardedDegree <http://vivoweb.org/ontology/core#relates> ?degreeType .\n"+ "?newAwardedDegree <http://vivoweb.org/ontology/core#relates> ?degreeType .\n"+
"?degreeType <http://vivoweb.org/ontology/core#relatedBy> ?newAwardedDegree . \n"+ "?degreeType <http://vivoweb.org/ontology/core#relatedBy> ?newAwardedDegree . \n"+
"?newAwardedDegree a core:AwardedDegree ."; "?newAwardedDegree a core:AwardedDegree .";
@ -254,6 +256,8 @@ public class PersonHasEducationalTraining extends VivoBaseGenerator implements
"?existingOrg <http://vivoweb.org/ontology/core#assigns> ?newAwardedDegree . \n" + "?existingOrg <http://vivoweb.org/ontology/core#assigns> ?newAwardedDegree . \n" +
"?newAwardedDegree <http://vivoweb.org/ontology/core#assignedBy> ?existingOrg . \n" + "?newAwardedDegree <http://vivoweb.org/ontology/core#assignedBy> ?existingOrg . \n" +
"?newAwardedDegree <http://vivoweb.org/ontology/core#relates> ?degreeType .\n"+ "?newAwardedDegree <http://vivoweb.org/ontology/core#relates> ?degreeType .\n"+
"?edTraining <http://purl.obolibrary.org/obo/RO_0000057> ?existingOrg . \n" +
"?existingOrg <http://purl.obolibrary.org/obo/RO_0000056> ?edTraining . \n" +
"?degreeType <http://vivoweb.org/ontology/core#relatedBy> ?newAwardedDegree . \n"+ "?degreeType <http://vivoweb.org/ontology/core#relatedBy> ?newAwardedDegree . \n"+
"?newAwardedDegree a core:AwardedDegree ."; "?newAwardedDegree a core:AwardedDegree .";

View file

@ -0,0 +1,105 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.preprocessors;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import com.hp.hpl.jena.ontology.OntModel;
import com.hp.hpl.jena.rdf.model.Literal;
import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.Property;
import com.hp.hpl.jena.rdf.model.ResIterator;
import com.hp.hpl.jena.rdf.model.Resource;
import com.hp.hpl.jena.rdf.model.Statement;
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
/*
* This preprocessor is used to set the language attribute on the label based on the user selection
* on the manage labels page when adding a new label.
*/
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.BaseEditSubmissionPreprocessorVTwo;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationVTwo;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.MultiValueEditSubmission;
public class ManageLabelsForPersonPreprocessor extends ManageLabelsForIndividualPreprocessor {
public ManageLabelsForPersonPreprocessor(EditConfigurationVTwo editConfig) {
super(editConfig);
}
@Override
public void preprocess(MultiValueEditSubmission inputSubmission, VitroRequest vreq) {
//Use the ManageLabelsForIndividualPreprocessor in addition to this code specific for person
super.preprocess(inputSubmission, vreq);
//First name and last name would also have a language selected so make sure those literals are also
//correctly typed
//Middle name is optional
if(inputSubmission.hasLiteralValue("firstName") && inputSubmission.hasLiteralValue("lastName") && inputSubmission.hasLiteralValue("newLabelLanguage")) {
Map<String, List<Literal>> literalsFromForm = inputSubmission.getLiteralsFromForm();
List<Literal> newLabelLanguages = literalsFromForm.get("newLabelLanguage");
List<Literal> firstNames = literalsFromForm.get("firstName");
List<Literal> lastNames = literalsFromForm.get("lastName");
List<Literal> middleNames = new ArrayList<Literal>();
if(inputSubmission.hasLiteralValue("middleName")) {
middleNames = literalsFromForm.get("middleName");
}
//Expecting only one language
if(firstNames.size() > 0 && lastNames.size() > 0 && newLabelLanguages.size() > 0) {
Literal newLabelLanguage = newLabelLanguages.get(0);
Literal firstNameLiteral = firstNames.get(0);
Literal lastNameLiteral = lastNames.get(0);
//Get the string
String lang = this.getLanguage(newLabelLanguage.getString());
String firstNameValue = firstNameLiteral.getString();
String lastNameValue = lastNameLiteral.getString();
//Now add the language category to the literal
Literal firstNameWithLanguage = inputSubmission.createLiteral(firstNameValue,
null,
lang);
Literal lastNameWithLanguage = inputSubmission.createLiteral(lastNameValue,
null,
lang);
firstNames = new ArrayList<Literal>();
lastNames = new ArrayList<Literal>();
firstNames.add(firstNameWithLanguage);
lastNames.add(lastNameWithLanguage);
//replace the label with one with language, again assuming only one label being returned
literalsFromForm.put("firstName", firstNames);
literalsFromForm.put("lastName", lastNames);
//Middle name handling
if(middleNames.size() > 0) {
Literal middleNameLiteral = middleNames.get(0);
String middleNameValue = middleNameLiteral.getString();
Literal middleNameWithLanguage = inputSubmission.createLiteral(middleNameValue,
null,
lang);
middleNames = new ArrayList<Literal>();
middleNames.add(middleNameWithLanguage);
literalsFromForm.put("middleName", middleNames);
}
//Set literals
inputSubmission.setLiteralsFromForm(literalsFromForm);
}
}
}
}

View file

@ -1,442 +1,445 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */ /* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webapp.visualization.coauthorship; package edu.cornell.mannlib.vitro.webapp.visualization.coauthorship;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import com.hp.hpl.jena.iri.IRI; import com.hp.hpl.jena.iri.IRI;
import com.hp.hpl.jena.iri.IRIFactory; import com.hp.hpl.jena.iri.IRIFactory;
import com.hp.hpl.jena.iri.Violation; import com.hp.hpl.jena.iri.Violation;
import com.hp.hpl.jena.query.Dataset; import com.hp.hpl.jena.query.Dataset;
import com.hp.hpl.jena.query.Query; import com.hp.hpl.jena.query.Query;
import com.hp.hpl.jena.query.QueryExecution; import com.hp.hpl.jena.query.QueryExecution;
import com.hp.hpl.jena.query.QueryExecutionFactory; import com.hp.hpl.jena.query.QueryExecutionFactory;
import com.hp.hpl.jena.query.QueryFactory; import com.hp.hpl.jena.query.QueryFactory;
import com.hp.hpl.jena.query.QuerySolution; import com.hp.hpl.jena.query.QuerySolution;
import com.hp.hpl.jena.query.ResultSet; import com.hp.hpl.jena.query.ResultSet;
import com.hp.hpl.jena.query.Syntax; import com.hp.hpl.jena.query.Syntax;
import com.hp.hpl.jena.rdf.model.RDFNode; import com.hp.hpl.jena.rdf.model.RDFNode;
import edu.cornell.mannlib.vitro.webapp.visualization.collaborationutils.CoAuthorshipData; import edu.cornell.mannlib.vitro.webapp.visualization.collaborationutils.CoAuthorshipData;
import edu.cornell.mannlib.vitro.webapp.visualization.collaborationutils.CollaborationData; import edu.cornell.mannlib.vitro.webapp.visualization.collaborationutils.CollaborationData;
import edu.cornell.mannlib.vitro.webapp.visualization.collaborationutils.CollaboratorComparator; import edu.cornell.mannlib.vitro.webapp.visualization.collaborationutils.CollaboratorComparator;
import edu.cornell.mannlib.vitro.webapp.visualization.constants.QueryConstants; import edu.cornell.mannlib.vitro.webapp.visualization.constants.QueryConstants;
import edu.cornell.mannlib.vitro.webapp.visualization.constants.QueryFieldLabels; import edu.cornell.mannlib.vitro.webapp.visualization.constants.QueryFieldLabels;
import edu.cornell.mannlib.vitro.webapp.visualization.exceptions.MalformedQueryParametersException; import edu.cornell.mannlib.vitro.webapp.visualization.exceptions.MalformedQueryParametersException;
import edu.cornell.mannlib.vitro.webapp.visualization.valueobjects.Activity; import edu.cornell.mannlib.vitro.webapp.visualization.valueobjects.Activity;
import edu.cornell.mannlib.vitro.webapp.visualization.valueobjects.Collaboration; import edu.cornell.mannlib.vitro.webapp.visualization.valueobjects.Collaboration;
import edu.cornell.mannlib.vitro.webapp.visualization.valueobjects.Collaborator; import edu.cornell.mannlib.vitro.webapp.visualization.valueobjects.Collaborator;
import edu.cornell.mannlib.vitro.webapp.visualization.visutils.QueryRunner; import edu.cornell.mannlib.vitro.webapp.visualization.visutils.QueryRunner;
import edu.cornell.mannlib.vitro.webapp.visualization.visutils.UniqueIDGenerator; import edu.cornell.mannlib.vitro.webapp.visualization.visutils.UniqueIDGenerator;
/** /**
* This query runner is used to execute a sparql query to get all the publications * This query runner is used to execute a sparql query to get all the publications
* for a particular individual. It will also fetch all the authors that worked * for a particular individual. It will also fetch all the authors that worked
* on that particular publication. * on that particular publication.
* *
* @author cdtank * @author cdtank
*/ */
public class CoAuthorshipQueryRunner implements QueryRunner<CollaborationData> { public class CoAuthorshipQueryRunner implements QueryRunner<CollaborationData> {
private static final int MAX_AUTHORS_PER_PAPER_ALLOWED = 100; private static final int MAX_AUTHORS_PER_PAPER_ALLOWED = 100;
protected static final Syntax SYNTAX = Syntax.syntaxARQ; protected static final Syntax SYNTAX = Syntax.syntaxARQ;
private String egoURI; private String egoURI;
private Dataset dataset; private Dataset dataset;
private Log log; private Log log;
private UniqueIDGenerator nodeIDGenerator; private UniqueIDGenerator nodeIDGenerator;
private UniqueIDGenerator edgeIDGenerator; private UniqueIDGenerator edgeIDGenerator;
public CoAuthorshipQueryRunner(String egoURI, public CoAuthorshipQueryRunner(String egoURI,
Dataset dataset, Log log) { Dataset dataset, Log log) {
this.egoURI = egoURI; this.egoURI = egoURI;
this.dataset = dataset; this.dataset = dataset;
this.log = log; this.log = log;
this.nodeIDGenerator = new UniqueIDGenerator(); this.nodeIDGenerator = new UniqueIDGenerator();
this.edgeIDGenerator = new UniqueIDGenerator(); this.edgeIDGenerator = new UniqueIDGenerator();
} }
private CollaborationData createQueryResult(ResultSet resultSet) { private CollaborationData createQueryResult(ResultSet resultSet) {
Set<Collaborator> nodes = new HashSet<Collaborator>(); Set<Collaborator> nodes = new HashSet<Collaborator>();
Map<String, Activity> biboDocumentURLToVO = new HashMap<String, Activity>(); Map<String, Activity> biboDocumentURLToVO = new HashMap<String, Activity>();
Map<String, Set<Collaborator>> biboDocumentURLToCoAuthors = Map<String, Set<Collaborator>> biboDocumentURLToCoAuthors =
new HashMap<String, Set<Collaborator>>(); new HashMap<String, Set<Collaborator>>();
Map<String, Collaborator> nodeURLToVO = new HashMap<String, Collaborator>(); Map<String, Collaborator> nodeURLToVO = new HashMap<String, Collaborator>();
Map<String, Collaboration> edgeUniqueIdentifierToVO = new HashMap<String, Collaboration>(); Map<String, Collaboration> edgeUniqueIdentifierToVO = new HashMap<String, Collaboration>();
Collaborator egoNode = null; Collaborator egoNode = null;
Set<Collaboration> edges = new HashSet<Collaboration>(); Set<Collaboration> edges = new HashSet<Collaboration>();
while (resultSet.hasNext()) { while (resultSet.hasNext()) {
QuerySolution solution = resultSet.nextSolution(); QuerySolution solution = resultSet.nextSolution();
/* /*
* We only want to create only ONE ego node. * We only want to create only ONE ego node.
* */ * */
RDFNode egoAuthorURLNode = solution.get(QueryFieldLabels.AUTHOR_URL); RDFNode egoAuthorURLNode = solution.get(QueryFieldLabels.AUTHOR_URL);
if (nodeURLToVO.containsKey(egoAuthorURLNode.toString())) { if (nodeURLToVO.containsKey(egoAuthorURLNode.toString())) {
egoNode = nodeURLToVO.get(egoAuthorURLNode.toString()); egoNode = nodeURLToVO.get(egoAuthorURLNode.toString());
} else { } else {
egoNode = new Collaborator(egoAuthorURLNode.toString(), nodeIDGenerator); egoNode = new Collaborator(egoAuthorURLNode.toString(), nodeIDGenerator);
nodes.add(egoNode); nodes.add(egoNode);
nodeURLToVO.put(egoAuthorURLNode.toString(), egoNode); nodeURLToVO.put(egoAuthorURLNode.toString(), egoNode);
RDFNode authorLabelNode = solution.get(QueryFieldLabels.AUTHOR_LABEL); RDFNode authorLabelNode = solution.get(QueryFieldLabels.AUTHOR_LABEL);
if (authorLabelNode != null) { if (authorLabelNode != null) {
egoNode.setCollaboratorName(authorLabelNode.toString()); egoNode.setCollaboratorName(authorLabelNode.toString());
} }
} }
RDFNode documentNode = solution.get(QueryFieldLabels.DOCUMENT_URL); RDFNode documentNode = solution.get(QueryFieldLabels.DOCUMENT_URL);
Activity biboDocument; Activity biboDocument;
if (biboDocumentURLToVO.containsKey(documentNode.toString())) { if (biboDocumentURLToVO.containsKey(documentNode.toString())) {
biboDocument = biboDocumentURLToVO.get(documentNode.toString()); biboDocument = biboDocumentURLToVO.get(documentNode.toString());
} else { } else {
biboDocument = createDocumentVO(solution, documentNode.toString()); biboDocument = createDocumentVO(solution, documentNode.toString());
biboDocumentURLToVO.put(documentNode.toString(), biboDocument); biboDocumentURLToVO.put(documentNode.toString(), biboDocument);
} }
egoNode.addActivity(biboDocument); egoNode.addActivity(biboDocument);
/* /*
* After some discussion we concluded that for the purpose of this visualization * After some discussion we concluded that for the purpose of this visualization
* we do not want a co-author node or Collaboration if the publication has only one * we do not want a co-author node or Collaboration if the publication has only one
* author and that happens to be the ego. * author and that happens to be the ego.
* */ * */
if (solution.get(QueryFieldLabels.AUTHOR_URL).toString().equalsIgnoreCase( if (solution.get(QueryFieldLabels.AUTHOR_URL).toString().equalsIgnoreCase(
solution.get(QueryFieldLabels.CO_AUTHOR_URL).toString())) { solution.get(QueryFieldLabels.CO_AUTHOR_URL).toString())) {
continue; continue;
} }
Collaborator coAuthorNode; Collaborator coAuthorNode;
RDFNode coAuthorURLNode = solution.get(QueryFieldLabels.CO_AUTHOR_URL); RDFNode coAuthorURLNode = solution.get(QueryFieldLabels.CO_AUTHOR_URL);
if (nodeURLToVO.containsKey(coAuthorURLNode.toString())) { if (nodeURLToVO.containsKey(coAuthorURLNode.toString())) {
coAuthorNode = nodeURLToVO.get(coAuthorURLNode.toString()); coAuthorNode = nodeURLToVO.get(coAuthorURLNode.toString());
} else { } else {
coAuthorNode = new Collaborator(coAuthorURLNode.toString(), nodeIDGenerator); coAuthorNode = new Collaborator(coAuthorURLNode.toString(), nodeIDGenerator);
nodes.add(coAuthorNode); nodes.add(coAuthorNode);
nodeURLToVO.put(coAuthorURLNode.toString(), coAuthorNode); nodeURLToVO.put(coAuthorURLNode.toString(), coAuthorNode);
RDFNode coAuthorLabelNode = solution.get(QueryFieldLabels.CO_AUTHOR_LABEL); RDFNode coAuthorLabelNode = solution.get(QueryFieldLabels.CO_AUTHOR_LABEL);
if (coAuthorLabelNode != null) { if (coAuthorLabelNode != null) {
coAuthorNode.setCollaboratorName(coAuthorLabelNode.toString()); coAuthorNode.setCollaboratorName(coAuthorLabelNode.toString());
} }
} }
coAuthorNode.addActivity(biboDocument); coAuthorNode.addActivity(biboDocument);
Set<Collaborator> coAuthorsForCurrentBiboDocument; Set<Collaborator> coAuthorsForCurrentBiboDocument;
if (biboDocumentURLToCoAuthors.containsKey(biboDocument.getActivityURI())) { if (biboDocumentURLToCoAuthors.containsKey(biboDocument.getActivityURI())) {
coAuthorsForCurrentBiboDocument = biboDocumentURLToCoAuthors coAuthorsForCurrentBiboDocument = biboDocumentURLToCoAuthors
.get(biboDocument.getActivityURI()); .get(biboDocument.getActivityURI());
} else { } else {
coAuthorsForCurrentBiboDocument = new HashSet<Collaborator>(); coAuthorsForCurrentBiboDocument = new HashSet<Collaborator>();
biboDocumentURLToCoAuthors.put(biboDocument.getActivityURI(), biboDocumentURLToCoAuthors.put(biboDocument.getActivityURI(),
coAuthorsForCurrentBiboDocument); coAuthorsForCurrentBiboDocument);
} }
coAuthorsForCurrentBiboDocument.add(coAuthorNode); coAuthorsForCurrentBiboDocument.add(coAuthorNode);
Collaboration egoCoAuthorEdge = Collaboration egoCoAuthorEdge =
getExistingEdge(egoNode, coAuthorNode, edgeUniqueIdentifierToVO); getExistingEdge(egoNode, coAuthorNode, edgeUniqueIdentifierToVO);
/* /*
* If "egoCoAuthorEdge" is null it means that no Collaboration exists in between the * If "egoCoAuthorEdge" is null it means that no Collaboration exists in between the
* egoNode & current coAuthorNode. Else create a new Collaboration, add it to the edges * egoNode & current coAuthorNode. Else create a new Collaboration, add it to the edges
* set & add the collaborator document to it. * set & add the collaborator document to it.
* */ * */
if (egoCoAuthorEdge != null) { if (egoCoAuthorEdge != null) {
egoCoAuthorEdge.addActivity(biboDocument); egoCoAuthorEdge.addActivity(biboDocument);
} else { } else {
egoCoAuthorEdge = egoCoAuthorEdge =
new Collaboration(egoNode, coAuthorNode, biboDocument, edgeIDGenerator); new Collaboration(egoNode, coAuthorNode, biboDocument, edgeIDGenerator);
edges.add(egoCoAuthorEdge); edges.add(egoCoAuthorEdge);
edgeUniqueIdentifierToVO.put( edgeUniqueIdentifierToVO.put(
getEdgeUniqueIdentifier(egoNode.getCollaboratorID(), getEdgeUniqueIdentifier(egoNode.getCollaboratorID(),
coAuthorNode.getCollaboratorID()), coAuthorNode.getCollaboratorID()),
egoCoAuthorEdge); egoCoAuthorEdge);
} }
} }
/* /*
* This method takes out all the authors & edges between authors that belong to documents * This method takes out all the authors & edges between authors that belong to documents
* that have more than 100 authors. We conjecture that these papers do not provide much * that have more than 100 authors. We conjecture that these papers do not provide much
* insight. However, we have left the documents be. * insight. However, we have left the documents be.
* *
* This method side-effects "nodes" & "edges". * This method side-effects "nodes" & "edges".
* */ * */
removeLowQualityNodesAndEdges(nodes, removeLowQualityNodesAndEdges(nodes,
biboDocumentURLToVO, biboDocumentURLToVO,
biboDocumentURLToCoAuthors, biboDocumentURLToCoAuthors,
edges); edges);
/* /*
* We need to create edges between 2 co-authors. E.g. On a paper there were 3 authors * We need to create edges between 2 co-authors. E.g. On a paper there were 3 authors
* ego, A & B then we have already created edges like, * ego, A & B then we have already created edges like,
* ego - A * ego - A
* ego - B * ego - B
* The below sub-routine will take care of, * The below sub-routine will take care of,
* A - B * A - B
* *
* We are side-effecting "edges" here. The only reason to do this is because we are adding * We are side-effecting "edges" here. The only reason to do this is because we are adding
* edges en masse for all the co-authors on all the publications considered so far. The * edges en masse for all the co-authors on all the publications considered so far. The
* other reason being we dont want to compare against 2 sets of edges (edges created before * other reason being we dont want to compare against 2 sets of edges (edges created before
* & co-author edges created during the course of this method) when we are creating a new * & co-author edges created during the course of this method) when we are creating a new
* Collaboration. * Collaboration.
* */ * */
createCoAuthorEdges(biboDocumentURLToVO, createCoAuthorEdges(biboDocumentURLToVO,
biboDocumentURLToCoAuthors, biboDocumentURLToCoAuthors,
edges, edges,
edgeUniqueIdentifierToVO); edgeUniqueIdentifierToVO);
return new CoAuthorshipData(egoNode, nodes, edges); return new CoAuthorshipData(egoNode, nodes, edges);
} }
private void removeLowQualityNodesAndEdges( private void removeLowQualityNodesAndEdges(
Set<Collaborator> nodes, Set<Collaborator> nodes,
Map<String, Activity> biboDocumentURLToVO, Map<String, Activity> biboDocumentURLToVO,
Map<String, Set<Collaborator>> biboDocumentURLToCoAuthors, Map<String, Set<Collaborator>> biboDocumentURLToCoAuthors,
Set<Collaboration> edges) { Set<Collaboration> edges) {
Set<Collaborator> nodesToBeRemoved = new HashSet<Collaborator>(); Set<Collaborator> nodesToBeRemoved = new HashSet<Collaborator>();
for (Map.Entry<String, Set<Collaborator>> currentBiboDocumentEntry for (Map.Entry<String, Set<Collaborator>> currentBiboDocumentEntry
: biboDocumentURLToCoAuthors.entrySet()) { : biboDocumentURLToCoAuthors.entrySet()) {
if (currentBiboDocumentEntry.getValue().size() > MAX_AUTHORS_PER_PAPER_ALLOWED) { if (currentBiboDocumentEntry.getValue().size() > MAX_AUTHORS_PER_PAPER_ALLOWED) {
Activity currentBiboDocument = biboDocumentURLToVO Activity currentBiboDocument = biboDocumentURLToVO
.get(currentBiboDocumentEntry.getKey()); .get(currentBiboDocumentEntry.getKey());
Set<Collaboration> edgesToBeRemoved = new HashSet<Collaboration>(); Set<Collaboration> edgesToBeRemoved = new HashSet<Collaboration>();
for (Collaboration currentEdge : edges) { for (Collaboration currentEdge : edges) {
Set<Activity> currentCollaboratorDocuments = Set<Activity> currentCollaboratorDocuments =
currentEdge.getCollaborationActivities(); currentEdge.getCollaborationActivities();
if (currentCollaboratorDocuments.contains(currentBiboDocument)) { if (currentCollaboratorDocuments.contains(currentBiboDocument)) {
currentCollaboratorDocuments.remove(currentBiboDocument); currentCollaboratorDocuments.remove(currentBiboDocument);
if (currentCollaboratorDocuments.isEmpty()) { if (currentCollaboratorDocuments.isEmpty()) {
edgesToBeRemoved.add(currentEdge); edgesToBeRemoved.add(currentEdge);
} }
} }
} }
edges.removeAll(edgesToBeRemoved); edges.removeAll(edgesToBeRemoved);
for (Collaborator currentCoAuthor : currentBiboDocumentEntry.getValue()) { for (Collaborator currentCoAuthor : currentBiboDocumentEntry.getValue()) {
currentCoAuthor.getCollaboratorActivities().remove(currentBiboDocument); currentCoAuthor.getCollaboratorActivities().remove(currentBiboDocument);
if (currentCoAuthor.getCollaboratorActivities().isEmpty()) { if (currentCoAuthor.getCollaboratorActivities().isEmpty()) {
nodesToBeRemoved.add(currentCoAuthor); nodesToBeRemoved.add(currentCoAuthor);
} }
} }
} }
} }
nodes.removeAll(nodesToBeRemoved); nodes.removeAll(nodesToBeRemoved);
} }
private void createCoAuthorEdges( private void createCoAuthorEdges(
Map<String, Activity> biboDocumentURLToVO, Map<String, Activity> biboDocumentURLToVO,
Map<String, Set<Collaborator>> biboDocumentURLToCoAuthors, Set<Collaboration> edges, Map<String, Set<Collaborator>> biboDocumentURLToCoAuthors, Set<Collaboration> edges,
Map<String, Collaboration> edgeUniqueIdentifierToVO) { Map<String, Collaboration> edgeUniqueIdentifierToVO) {
for (Map.Entry<String, Set<Collaborator>> currentBiboDocumentEntry for (Map.Entry<String, Set<Collaborator>> currentBiboDocumentEntry
: biboDocumentURLToCoAuthors.entrySet()) { : biboDocumentURLToCoAuthors.entrySet()) {
/* /*
* If there was only one co-author (other than ego) then we dont have to create any * If there was only one co-author (other than ego) then we dont have to create any
* edges. so the below condition will take care of that. * edges. so the below condition will take care of that.
* *
* We are restricting edges between co-author if a particular document has more than * We are restricting edges between co-author if a particular document has more than
* 100 co-authors. Our conjecture is that such edges do not provide any good insight * 100 co-authors. Our conjecture is that such edges do not provide any good insight
* & causes unnecessary computations causing the server to time-out. * & causes unnecessary computations causing the server to time-out.
* */ * */
if (currentBiboDocumentEntry.getValue().size() > 1 if (currentBiboDocumentEntry.getValue().size() > 1
&& currentBiboDocumentEntry.getValue().size() && currentBiboDocumentEntry.getValue().size()
<= MAX_AUTHORS_PER_PAPER_ALLOWED) { <= MAX_AUTHORS_PER_PAPER_ALLOWED) {
Set<Collaboration> newlyAddedEdges = new HashSet<Collaboration>(); Set<Collaboration> newlyAddedEdges = new HashSet<Collaboration>();
/* /*
* In order to leverage the nested "for loop" for making edges between all the * In order to leverage the nested "for loop" for making edges between all the
* co-authors we need to create a list out of the set first. * co-authors we need to create a list out of the set first.
* */ * */
List<Collaborator> coAuthorNodes = List<Collaborator> coAuthorNodes =
new ArrayList<Collaborator>(currentBiboDocumentEntry.getValue()); new ArrayList<Collaborator>(currentBiboDocumentEntry.getValue());
Collections.sort(coAuthorNodes, new CollaboratorComparator()); Collections.sort(coAuthorNodes, new CollaboratorComparator());
int numOfCoAuthors = coAuthorNodes.size(); int numOfCoAuthors = coAuthorNodes.size();
for (int ii = 0; ii < numOfCoAuthors - 1; ii++) { for (int ii = 0; ii < numOfCoAuthors - 1; ii++) {
for (int jj = ii + 1; jj < numOfCoAuthors; jj++) { for (int jj = ii + 1; jj < numOfCoAuthors; jj++) {
Collaborator coAuthor1 = coAuthorNodes.get(ii); Collaborator coAuthor1 = coAuthorNodes.get(ii);
Collaborator coAuthor2 = coAuthorNodes.get(jj); Collaborator coAuthor2 = coAuthorNodes.get(jj);
Collaboration coAuthor1_2Edge = getExistingEdge(coAuthor1, Collaboration coAuthor1_2Edge = getExistingEdge(coAuthor1,
coAuthor2, coAuthor2,
edgeUniqueIdentifierToVO); edgeUniqueIdentifierToVO);
Activity currentBiboDocument = biboDocumentURLToVO Activity currentBiboDocument = biboDocumentURLToVO
.get(currentBiboDocumentEntry .get(currentBiboDocumentEntry
.getKey()); .getKey());
if (coAuthor1_2Edge != null) { if (coAuthor1_2Edge != null) {
coAuthor1_2Edge.addActivity(currentBiboDocument); coAuthor1_2Edge.addActivity(currentBiboDocument);
} else { } else {
coAuthor1_2Edge = new Collaboration(coAuthor1, coAuthor1_2Edge = new Collaboration(coAuthor1,
coAuthor2, coAuthor2,
currentBiboDocument, currentBiboDocument,
edgeIDGenerator); edgeIDGenerator);
newlyAddedEdges.add(coAuthor1_2Edge); newlyAddedEdges.add(coAuthor1_2Edge);
edgeUniqueIdentifierToVO.put( edgeUniqueIdentifierToVO.put(
getEdgeUniqueIdentifier(coAuthor1.getCollaboratorID(), getEdgeUniqueIdentifier(coAuthor1.getCollaboratorID(),
coAuthor2.getCollaboratorID()), coAuthor2.getCollaboratorID()),
coAuthor1_2Edge); coAuthor1_2Edge);
} }
} }
} }
edges.addAll(newlyAddedEdges); edges.addAll(newlyAddedEdges);
} }
} }
} }
private Collaboration getExistingEdge( private Collaboration getExistingEdge(
Collaborator collaboratingNode1, Collaborator collaboratingNode1,
Collaborator collaboratingNode2, Collaborator collaboratingNode2,
Map<String, Collaboration> edgeUniqueIdentifierToVO) { Map<String, Collaboration> edgeUniqueIdentifierToVO) {
String edgeUniqueIdentifier = getEdgeUniqueIdentifier( String edgeUniqueIdentifier = getEdgeUniqueIdentifier(
collaboratingNode1.getCollaboratorID(), collaboratingNode1.getCollaboratorID(),
collaboratingNode2.getCollaboratorID()); collaboratingNode2.getCollaboratorID());
return edgeUniqueIdentifierToVO.get(edgeUniqueIdentifier); return edgeUniqueIdentifierToVO.get(edgeUniqueIdentifier);
} }
private String getEdgeUniqueIdentifier(int nodeID1, int nodeID2) { private String getEdgeUniqueIdentifier(int nodeID1, int nodeID2) {
String separator = "*"; String separator = "*";
if (nodeID1 < nodeID2) { if (nodeID1 < nodeID2) {
return nodeID1 + separator + nodeID2; return nodeID1 + separator + nodeID2;
} else { } else {
return nodeID2 + separator + nodeID1; return nodeID2 + separator + nodeID1;
} }
} }
private Activity createDocumentVO(QuerySolution solution, String documentURL) { private Activity createDocumentVO(QuerySolution solution, String documentURL) {
Activity biboDocument = new Activity(documentURL); Activity biboDocument = new Activity(documentURL);
RDFNode publicationDateNode = solution.get(QueryFieldLabels.DOCUMENT_PUBLICATION_DATE); RDFNode publicationDateNode = solution.get(QueryFieldLabels.DOCUMENT_PUBLICATION_DATE);
if (publicationDateNode != null) { if (publicationDateNode != null) {
biboDocument.setActivityDate(publicationDateNode.toString()); biboDocument.setActivityDate(publicationDateNode.toString());
} }
return biboDocument; return biboDocument;
} }
private ResultSet executeQuery(String queryText, private ResultSet executeQuery(String queryText,
Dataset dataset) { Dataset dataset) {
QueryExecution queryExecution = null; QueryExecution queryExecution = null;
Query query = QueryFactory.create(queryText, SYNTAX); Query query = QueryFactory.create(queryText, SYNTAX);
queryExecution = QueryExecutionFactory.create(query, dataset); queryExecution = QueryExecutionFactory.create(query, dataset);
return queryExecution.execSelect(); return queryExecution.execSelect();
} }
private String generateEgoCoAuthorshipSparqlQuery(String queryURI) { private String generateEgoCoAuthorshipSparqlQuery(String queryURI) {
String sparqlQuery = QueryConstants.getSparqlPrefixQuery() String sparqlQuery = QueryConstants.getSparqlPrefixQuery()
+ "SELECT \n" + "SELECT \n"
+ " (str(<" + queryURI + ">) as ?" + QueryFieldLabels.AUTHOR_URL + ") \n" + " (str(<" + queryURI + ">) as ?" + QueryFieldLabels.AUTHOR_URL + ") \n"
+ " (str(?authorLabel) as ?" + QueryFieldLabels.AUTHOR_LABEL + ") \n" + " (str(?authorLabel) as ?" + QueryFieldLabels.AUTHOR_LABEL + ") \n"
+ " (str(?coAuthorPerson) as ?" + QueryFieldLabels.CO_AUTHOR_URL + ") \n" + " (str(?coAuthorPerson) as ?" + QueryFieldLabels.CO_AUTHOR_URL + ") \n"
+ " (str(?coAuthorPersonLabel) as ?" + QueryFieldLabels.CO_AUTHOR_LABEL + ") \n" + " (str(?coAuthorPersonLabel) as ?" + QueryFieldLabels.CO_AUTHOR_LABEL + ") \n"
+ " (str(?document) as ?" + QueryFieldLabels.DOCUMENT_URL + ") \n" + " (str(?document) as ?" + QueryFieldLabels.DOCUMENT_URL + ") \n"
+ " (str(?publicationDate) as ?" + " (str(?publicationDate) as ?"
+ QueryFieldLabels.DOCUMENT_PUBLICATION_DATE + ") \n" + QueryFieldLabels.DOCUMENT_PUBLICATION_DATE + ") \n"
+ "WHERE { \n" + "WHERE { \n"
+ "<" + queryURI + "> rdf:type foaf:Person ;" + "<" + queryURI + "> rdf:type foaf:Person ;"
+ " rdfs:label ?authorLabel ;" + " rdfs:label ?authorLabel ;"
+ " core:authorInAuthorship ?authorshipNode . \n" + " core:relatedBy ?authorshipNode . \n"
+ "?authorshipNode rdf:type core:Authorship ;" + "?authorshipNode rdf:type core:Authorship ;"
+ " core:linkedInformationResource ?document . \n" + " core:relates ?document . \n"
+ "?document core:informationResourceInAuthorship ?coAuthorshipNode . \n" + "?document rdf:type bibo:Document . \n"
+ "?coAuthorshipNode core:linkedAuthor ?coAuthorPerson . \n" + "?document core:relatedBy ?coAuthorshipNode . \n"
+ "?coAuthorPerson rdfs:label ?coAuthorPersonLabel . \n" + "?coAuthorshipNode rdf:type core:Authorship . \n"
+ "OPTIONAL { ?document core:dateTimeValue ?dateTimeValue . \n" + "?coAuthorshipNode core:relates ?coAuthorPerson . \n"
+ " ?dateTimeValue core:dateTime ?publicationDate } .\n" + "?coAuthorPerson rdf:type foaf:Person . \n"
+ "} \n" + "?coAuthorPerson rdfs:label ?coAuthorPersonLabel . \n"
+ "ORDER BY ?document ?coAuthorPerson\n"; + "OPTIONAL { ?document core:dateTimeValue ?dateTimeValue . \n"
+ " ?dateTimeValue core:dateTime ?publicationDate } .\n"
log.debug("COAUTHORSHIP QUERY - " + sparqlQuery); + "} \n"
+ "ORDER BY ?document ?coAuthorPerson\n";
return sparqlQuery;
} log.debug("COAUTHORSHIP QUERY - " + sparqlQuery);
return sparqlQuery;
public CollaborationData getQueryResult() }
throws MalformedQueryParametersException {
if (StringUtils.isNotBlank(this.egoURI)) { public CollaborationData getQueryResult()
/* throws MalformedQueryParametersException {
* To test for the validity of the URI submitted.
* */ if (StringUtils.isNotBlank(this.egoURI)) {
IRIFactory iRIFactory = IRIFactory.jenaImplementation(); /*
IRI iri = iRIFactory.create(this.egoURI); * To test for the validity of the URI submitted.
if (iri.hasViolation(false)) { * */
String errorMsg = ((Violation) iri.violations(false).next()).getShortMessage(); IRIFactory iRIFactory = IRIFactory.jenaImplementation();
log.error("Ego Co-Authorship Vis Query " + errorMsg); IRI iri = iRIFactory.create(this.egoURI);
throw new MalformedQueryParametersException( if (iri.hasViolation(false)) {
"URI provided for an individual is malformed."); String errorMsg = ((Violation) iri.violations(false).next()).getShortMessage();
} log.error("Ego Co-Authorship Vis Query " + errorMsg);
} else { throw new MalformedQueryParametersException(
throw new MalformedQueryParametersException("URI parameter is either null or empty."); "URI provided for an individual is malformed.");
} }
} else {
ResultSet resultSet = executeQuery(generateEgoCoAuthorshipSparqlQuery(this.egoURI), throw new MalformedQueryParametersException("URI parameter is either null or empty.");
this.dataset); }
return createQueryResult(resultSet);
} ResultSet resultSet = executeQuery(generateEgoCoAuthorshipSparqlQuery(this.egoURI),
this.dataset);
} return createQueryResult(resultSet);
}
}

View file

@ -38,9 +38,9 @@ public class CoPIGrantCountConstructQueryRunner implements ModelConstructor {
.getLog(CoPIGrantCountConstructQueryRunner.class.getName()); .getLog(CoPIGrantCountConstructQueryRunner.class.getName());
private static final String SPARQL_QUERY_COMMON_CONSTRUCT_AND_WHERE_STRING = private static final String SPARQL_QUERY_COMMON_CONSTRUCT_AND_WHERE_STRING =
"?Role core:roleContributesTo ?Grant . " "?Role core:relatedBy ?Grant . "
// + "?Grant rdfs:label ?GrantLabel . " + "?Grant rdf:type core:Grant ."
+ "?Grant core:contributingRole ?RelatedRole . "; + "?Grant core:relates ?RelatedRole . ";
public CoPIGrantCountConstructQueryRunner(String egoURI, Dataset dataset, public CoPIGrantCountConstructQueryRunner(String egoURI, Dataset dataset,
Log log) { Log log) {
@ -59,23 +59,31 @@ public class CoPIGrantCountConstructQueryRunner implements ModelConstructor {
} }
private String generateConstructQueryForInvestigatorRoleOfProperty( private String generateConstructQueryForInvestigatorRoleOfProperty(
String queryURI, String preboundProperty) { String queryURI, String preboundProperty, String preboundRoleType) {
String sparqlQuery = "CONSTRUCT { " + "<" + queryURI + ">" String sparqlQuery = "CONSTRUCT { " + "<" + queryURI + ">"
+ preboundProperty + " ?Role . " + preboundProperty + " ?Role . "
+ "?Role rdf:type " + preboundRoleType + " . "
+ SPARQL_QUERY_COMMON_CONSTRUCT_AND_WHERE_STRING + SPARQL_QUERY_COMMON_CONSTRUCT_AND_WHERE_STRING
+ "?RelatedRole core:investigatorRoleOf ?coInvestigator ." + "?RelatedRole rdf:type core:InvestigatorRole ."
+ "?RelatedRole <http://purl.obolibrary.org/obo/RO_0000052> ?coInvestigator ."
+ "?coInvestigator rdf:type foaf:Person ."
+ "?coInvestigator rdfs:label ?coInvestigatorLabel . " + "}" + "?coInvestigator rdfs:label ?coInvestigatorLabel . " + "}"
+ "WHERE { " + "<" + queryURI + ">" + preboundProperty + "WHERE { " + "<" + queryURI + ">" + preboundProperty + " ?Role . "
+ " ?Role . " + SPARQL_QUERY_COMMON_CONSTRUCT_AND_WHERE_STRING + "?Role rdf:type " + preboundRoleType + " . "
+ "?RelatedRole core:investigatorRoleOf ?coInvestigator ." + SPARQL_QUERY_COMMON_CONSTRUCT_AND_WHERE_STRING
+ "?coInvestigator rdfs:label ?coInvestigatorLabel . " + "}"; + "?RelatedRole rdf:type core:InvestigatorRole ."
+ "?RelatedRole vitro:mostSpecificType ?subclass ."
+ "?RelatedRole <http://purl.obolibrary.org/obo/RO_0000052> ?coInvestigator ."
+ "?coInvestigator rdf:type foaf:Person ."
+ "?coInvestigator rdfs:label ?coInvestigatorLabel . "
+ "FILTER (?subclass != core:PrincipalInvestigatorRole && ?subclass != core:CoPrincipalInvestigatorRole)}";
return sparqlQuery; return sparqlQuery;
} }
private String generateConstructQueryForPrincipalInvestigatorRoleOfProperty( private String generateConstructQueryForPrincipalInvestigatorRoleOfProperty(
String queryURI, String preboundProperty) { String queryURI, String preboundProperty, String preboundRoleType) {
String sparqlQuery = "CONSTRUCT { " String sparqlQuery = "CONSTRUCT { "
+ "<" + "<"
@ -83,8 +91,11 @@ public class CoPIGrantCountConstructQueryRunner implements ModelConstructor {
+ ">" + ">"
+ preboundProperty + preboundProperty
+ " ?Role . " + " ?Role . "
+ "?Role rdf:type " + preboundRoleType + " . "
+ SPARQL_QUERY_COMMON_CONSTRUCT_AND_WHERE_STRING + SPARQL_QUERY_COMMON_CONSTRUCT_AND_WHERE_STRING
+ "?RelatedRole core:principalInvestigatorRoleOf ?coInvestigator ." + "?RelatedRole rdf:type core:PrincipalInvestigatorRole ."
+ "?RelatedRole <http://purl.obolibrary.org/obo/RO_0000052> ?coInvestigator ."
+ "?coInvestigator rdf:type foaf:Person ."
+ "?coInvestigator rdfs:label ?coInvestigatorLabel . " + "?coInvestigator rdfs:label ?coInvestigatorLabel . "
+ "}" + "}"
+ "WHERE { " + "WHERE { "
@ -93,15 +104,18 @@ public class CoPIGrantCountConstructQueryRunner implements ModelConstructor {
+ ">" + ">"
+ preboundProperty + preboundProperty
+ " ?Role . " + " ?Role . "
+ "?Role rdf:type " + preboundRoleType + " . "
+ SPARQL_QUERY_COMMON_CONSTRUCT_AND_WHERE_STRING + SPARQL_QUERY_COMMON_CONSTRUCT_AND_WHERE_STRING
+ "?RelatedRole core:principalInvestigatorRoleOf ?coInvestigator ." + "?RelatedRole rdf:type core:PrincipalInvestigatorRole ."
+ "?RelatedRole <http://purl.obolibrary.org/obo/RO_0000052> ?coInvestigator ."
+ "?coInvestigator rdf:type foaf:Person ."
+ "?coInvestigator rdfs:label ?coInvestigatorLabel . " + "}"; + "?coInvestigator rdfs:label ?coInvestigatorLabel . " + "}";
return sparqlQuery; return sparqlQuery;
} }
private String generateConstructQueryForCoPrincipalInvestigatorRoleOfProperty( private String generateConstructQueryForCoPrincipalInvestigatorRoleOfProperty(
String queryURI, String preboundProperty) { String queryURI, String preboundProperty, String preboundRoleType) {
String sparqlQuery = "CONSTRUCT { " String sparqlQuery = "CONSTRUCT { "
+ "<" + "<"
@ -109,8 +123,11 @@ public class CoPIGrantCountConstructQueryRunner implements ModelConstructor {
+ ">" + ">"
+ preboundProperty + preboundProperty
+ " ?Role . " + " ?Role . "
+ "?Role rdf:type " + preboundRoleType + " . "
+ SPARQL_QUERY_COMMON_CONSTRUCT_AND_WHERE_STRING + SPARQL_QUERY_COMMON_CONSTRUCT_AND_WHERE_STRING
+ "?RelatedRole core:co-PrincipalInvestigatorRoleOf ?coInvestigator ." + "?RelatedRole rdf:type core:CoPrincipalInvestigatorRole ."
+ "?RelatedRole <http://purl.obolibrary.org/obo/RO_0000052> ?coInvestigator ."
+ "?coInvestigator rdf:type foaf:Person ."
+ "?coInvestigator rdfs:label ?coInvestigatorLabel . " + "?coInvestigator rdfs:label ?coInvestigatorLabel . "
+ "}" + "}"
+ "WHERE { " + "WHERE { "
@ -119,18 +136,22 @@ public class CoPIGrantCountConstructQueryRunner implements ModelConstructor {
+ ">" + ">"
+ preboundProperty + preboundProperty
+ " ?Role . " + " ?Role . "
+ "?Role rdf:type " + preboundRoleType + " . "
+ SPARQL_QUERY_COMMON_CONSTRUCT_AND_WHERE_STRING + SPARQL_QUERY_COMMON_CONSTRUCT_AND_WHERE_STRING
+ "?RelatedRole core:co-PrincipalInvestigatorRoleOf ?coInvestigator ." + "?RelatedRole rdf:type core:CoPrincipalInvestigatorRole ."
+ "?RelatedRole <http://purl.obolibrary.org/obo/RO_0000052> ?coInvestigator ."
+ "?coInvestigator rdf:type foaf:Person ."
+ "?coInvestigator rdfs:label ?coInvestigatorLabel . " + "}"; + "?coInvestigator rdfs:label ?coInvestigatorLabel . " + "}";
return sparqlQuery; return sparqlQuery;
} }
private String generateConstructQueryForDateTimeValueofRole( private String generateConstructQueryForDateTimeValueofRole(
String queryURI, String preboundProperty) { String queryURI, String preboundProperty, String preboundRoleType) {
String sparqlQuery = "CONSTRUCT { " + "<" + queryURI + ">" String sparqlQuery = "CONSTRUCT { " + "<" + queryURI + ">"
+ preboundProperty + " ?Role . " + preboundProperty + " ?Role . "
+ "?Role rdf:type " + preboundRoleType + " . "
+ "?Role core:dateTimeInterval ?dateTimeIntervalValue . " + "?Role core:dateTimeInterval ?dateTimeIntervalValue . "
+ "?dateTimeIntervalValue core:start ?startDate . " + "?dateTimeIntervalValue core:start ?startDate . "
+ "?startDate core:dateTime ?startDateTimeValue . " + "?startDate core:dateTime ?startDateTimeValue . "
@ -139,6 +160,7 @@ public class CoPIGrantCountConstructQueryRunner implements ModelConstructor {
+ "}" + "}"
+ "WHERE { " + "{" + "<" + queryURI + ">" + preboundProperty + "WHERE { " + "{" + "<" + queryURI + ">" + preboundProperty
+ " ?Role . " + " ?Role . "
+ "?Role rdf:type " + preboundRoleType + " . "
+ "?Role core:dateTimeInterval ?dateTimeIntervalValue . " + "?Role core:dateTimeInterval ?dateTimeIntervalValue . "
+ "?dateTimeIntervalValue core:start ?startDate . " + "?dateTimeIntervalValue core:start ?startDate . "
+ "?startDate core:dateTime ?startDateTimeValue . " + "?startDate core:dateTime ?startDateTimeValue . "
@ -153,14 +175,16 @@ public class CoPIGrantCountConstructQueryRunner implements ModelConstructor {
} }
private String generateConstructQueryForDateTimeValueofGrant( private String generateConstructQueryForDateTimeValueofGrant(
String queryURI, String preboundProperty) { String queryURI, String preboundProperty, String preboundRoleType) {
String sparqlQuery = "CONSTRUCT { " + "<" String sparqlQuery = "CONSTRUCT { " + "<"
+ queryURI + queryURI
+ ">" + ">"
+ preboundProperty + preboundProperty
+ " ?Role . " + " ?Role . "
+ "?Role core:roleContributesTo ?Grant ." + "?Role rdf:type " + preboundRoleType + " . "
+ "?Role core:relatedBy ?Grant ."
+ "?Grant rdf:type core:Grant ."
+ "?Grant core:dateTimeInterval ?dateTimeIntervalValueForGrant . " + "?Grant core:dateTimeInterval ?dateTimeIntervalValueForGrant . "
+ "?dateTimeIntervalValueForGrant core:start ?startDateForGrant . " + "?dateTimeIntervalValueForGrant core:start ?startDateForGrant . "
+ "?startDateForGrant core:dateTime ?startDateTimeValueForGrant . " + "?startDateForGrant core:dateTime ?startDateTimeValueForGrant . "
@ -174,7 +198,9 @@ public class CoPIGrantCountConstructQueryRunner implements ModelConstructor {
+ ">" + ">"
+ preboundProperty + preboundProperty
+ " ?Role . " + " ?Role . "
+ "?Role core:roleContributesTo ?Grant ." + "?Role rdf:type " + preboundRoleType + " . "
+ "?Role core:relatedBy ?Grant ."
+ "?Grant rdf:type core:Grant ."
+ "?Grant core:dateTimeInterval ?dateTimeIntervalValueForGrant . " + "?Grant core:dateTimeInterval ?dateTimeIntervalValueForGrant . "
+ "?dateTimeIntervalValueForGrant core:start ?startDateForGrant . " + "?dateTimeIntervalValueForGrant core:start ?startDateForGrant . "
+ "?startDateForGrant core:dateTime ?startDateTimeValueForGrant . " + "?startDateForGrant core:dateTime ?startDateTimeValueForGrant . "
@ -268,45 +294,45 @@ public class CoPIGrantCountConstructQueryRunner implements ModelConstructor {
.add(generateConstructQueryForInvestigatorLabel(this.egoURI)); .add(generateConstructQueryForInvestigatorLabel(this.egoURI));
constructQueries constructQueries
.add(generateConstructQueryForInvestigatorRoleOfProperty( .add(generateConstructQueryForInvestigatorRoleOfProperty(
this.egoURI, "core:hasInvestigatorRole")); this.egoURI, "<http://purl.obolibrary.org/obo/RO_0000053>", "core:InvestigatorRole"));
constructQueries constructQueries
.add(generateConstructQueryForCoPrincipalInvestigatorRoleOfProperty( .add(generateConstructQueryForCoPrincipalInvestigatorRoleOfProperty(
this.egoURI, "core:hasInvestigatorRole")); this.egoURI, "<http://purl.obolibrary.org/obo/RO_0000053>", "core:InvestigatorRole"));
constructQueries constructQueries
.add(generateConstructQueryForPrincipalInvestigatorRoleOfProperty( .add(generateConstructQueryForPrincipalInvestigatorRoleOfProperty(
this.egoURI, "core:hasInvestigatorRole")); this.egoURI, "<http://purl.obolibrary.org/obo/RO_0000053>", "core:InvestigatorRole"));
constructQueries.add(generateConstructQueryForDateTimeValueofRole( constructQueries.add(generateConstructQueryForDateTimeValueofRole(
this.egoURI, "core:hasInvestigatorRole")); this.egoURI, "<http://purl.obolibrary.org/obo/RO_0000053>", "core:InvestigatorRole"));
constructQueries.add(generateConstructQueryForDateTimeValueofGrant( constructQueries.add(generateConstructQueryForDateTimeValueofGrant(
this.egoURI, "core:hasInvestigatorRole")); this.egoURI, "<http://purl.obolibrary.org/obo/RO_0000053>", "core:InvestigatorRole"));
constructQueries constructQueries
.add(generateConstructQueryForInvestigatorRoleOfProperty( .add(generateConstructQueryForInvestigatorRoleOfProperty(
this.egoURI, "core:hasPrincipalInvestigatorRole")); this.egoURI, "<http://purl.obolibrary.org/obo/RO_0000053>", "core:PrincipalInvestigatorRole"));
constructQueries constructQueries
.add(generateConstructQueryForCoPrincipalInvestigatorRoleOfProperty( .add(generateConstructQueryForCoPrincipalInvestigatorRoleOfProperty(
this.egoURI, "core:hasPrincipalInvestigatorRole")); this.egoURI, "<http://purl.obolibrary.org/obo/RO_0000053>", "core:PrincipalInvestigatorRole"));
constructQueries constructQueries
.add(generateConstructQueryForPrincipalInvestigatorRoleOfProperty( .add(generateConstructQueryForPrincipalInvestigatorRoleOfProperty(
this.egoURI, "core:hasPrincipalInvestigatorRole")); this.egoURI, "<http://purl.obolibrary.org/obo/RO_0000053>", "core:PrincipalInvestigatorRole"));
constructQueries.add(generateConstructQueryForDateTimeValueofRole( constructQueries.add(generateConstructQueryForDateTimeValueofRole(
this.egoURI, "core:hasPrincipalInvestigatorRole")); this.egoURI, "<http://purl.obolibrary.org/obo/RO_0000053>", "core:PrincipalInvestigatorRole"));
constructQueries.add(generateConstructQueryForDateTimeValueofGrant( constructQueries.add(generateConstructQueryForDateTimeValueofGrant(
this.egoURI, "core:hasPrincipalInvestigatorRole")); this.egoURI, "<http://purl.obolibrary.org/obo/RO_0000053>", "core:PrincipalInvestigatorRole"));
constructQueries constructQueries
.add(generateConstructQueryForInvestigatorRoleOfProperty( .add(generateConstructQueryForInvestigatorRoleOfProperty(
this.egoURI, "core:hasCo-PrincipalInvestigatorRole")); this.egoURI, "<http://purl.obolibrary.org/obo/RO_0000053>", "core:CoPrincipalInvestigatorRole"));
constructQueries constructQueries
.add(generateConstructQueryForCoPrincipalInvestigatorRoleOfProperty( .add(generateConstructQueryForCoPrincipalInvestigatorRoleOfProperty(
this.egoURI, "core:hasCo-PrincipalInvestigatorRole")); this.egoURI, "<http://purl.obolibrary.org/obo/RO_0000053>", "core:CoPrincipalInvestigatorRole"));
constructQueries constructQueries
.add(generateConstructQueryForPrincipalInvestigatorRoleOfProperty( .add(generateConstructQueryForPrincipalInvestigatorRoleOfProperty(
this.egoURI, "core:hasCo-PrincipalInvestigatorRole")); this.egoURI, "<http://purl.obolibrary.org/obo/RO_0000053>", "core:CoPrincipalInvestigatorRole"));
constructQueries.add(generateConstructQueryForDateTimeValueofRole( constructQueries.add(generateConstructQueryForDateTimeValueofRole(
this.egoURI, "core:hasCo-PrincipalInvestigatorRole")); this.egoURI, "<http://purl.obolibrary.org/obo/RO_0000053>", "core:CoPrincipalInvestigatorRole"));
constructQueries.add(generateConstructQueryForDateTimeValueofGrant( constructQueries.add(generateConstructQueryForDateTimeValueofGrant(
this.egoURI, "core:hasCo-PrincipalInvestigatorRole")); this.egoURI, "<http://purl.obolibrary.org/obo/RO_0000053>", "core:CoPrincipalInvestigatorRole"));
} }
} }

View file

@ -113,13 +113,21 @@ public class CoPIGrantCountQueryRunner implements QueryRunner<CollaborationData>
+ "<" + queryURI + "> rdfs:label ?PILabel . " + "<" + queryURI + "> rdfs:label ?PILabel . "
+ "{ " + "{ "
+ "<" + queryURI + "> core:hasCo-PrincipalInvestigatorRole ?Role . " + "<" + queryURI + "> <http://purl.obolibrary.org/obo/RO_0000053> ?Role . "
+ "?Role core:roleContributesTo ?Grant . " + "?Role rdf:type core:CoPrincipalInvestigatorRole . "
+ "?Grant core:contributingRole ?RelatedRole . " + "?Role core:relatedBy ?Grant . "
+ "?RelatedRole core:principalInvestigatorRoleOf ?CoPI . " + "?Grant rdf:type core:Grant . "
+ "?Grant core:relates ?RelatedRole . "
+ "?RelatedRole rdf:type core:PrincipalInvestigatorRole . "
+ "?RelatedRole <http://purl.obolibrary.org/obo/RO_0000052> ?CoPI . "
+ "?CoPI rdf:type foaf:Person . "
+ "?CoPI rdfs:label ?CoPILabel . " + "?CoPI rdfs:label ?CoPILabel . "
@ -133,13 +141,21 @@ public class CoPIGrantCountQueryRunner implements QueryRunner<CollaborationData>
+ "{ " + "{ "
+ "<" + queryURI + "> core:hasCo-PrincipalInvestigatorRole ?Role . " + "<" + queryURI + "> <http://purl.obolibrary.org/obo/RO_0000053> ?Role . "
+ "?Role core:roleContributesTo ?Grant . " + "?Role rdf:type core:CoPrincipalInvestigatorRole . "
+ "?Grant core:contributingRole ?RelatedRole . " + "?Role core:relatedBy ?Grant . "
+ "?RelatedRole core:investigatorRoleOf ?CoPI . " + "?Grant rdf:type core:Grant . "
+ "?Grant core:relates ?RelatedRole . "
+ "?RelatedRole rdf:type core:InvestigatorRole . "
+ "?RelatedRole <http://purl.obolibrary.org/obo/RO_0000052> ?CoPI . "
+ "?CoPI rdf:type foaf:Person . "
+ "?CoPI rdfs:label ?CoPILabel . " + "?CoPI rdfs:label ?CoPILabel . "
@ -154,13 +170,21 @@ public class CoPIGrantCountQueryRunner implements QueryRunner<CollaborationData>
+ "{ " + "{ "
+ "<" + queryURI + "> core:hasCo-PrincipalInvestigatorRole ?Role . " + "<" + queryURI + "> <http://purl.obolibrary.org/obo/RO_0000053> ?Role . "
+ "?Role core:roleContributesTo ?Grant . " + "?Role rdf:type core:CoPrincipalInvestigatorRole . "
+ "?Grant core:contributingRole ?RelatedRole . " + "?Role core:relatedBy ?Grant . "
+ "?RelatedRole core:co-PrincipalInvestigatorRoleOf ?CoPI . " + "?Grant rdf:type core:Grant . "
+ "?Grant core:relates ?RelatedRole . "
+ "?RelatedRole rdf:type core:CoPrincipalInvestigatorRole . "
+ "?RelatedRole <http://purl.obolibrary.org/obo/RO_0000052> ?CoPI . "
+ "?CoPI rdf:type foaf:Person . "
+ "?CoPI rdfs:label ?CoPILabel . " + "?CoPI rdfs:label ?CoPILabel . "
@ -176,13 +200,21 @@ public class CoPIGrantCountQueryRunner implements QueryRunner<CollaborationData>
+ "{ " + "{ "
+ "<" + queryURI + "> core:hasPrincipalInvestigatorRole ?Role . " + "<" + queryURI + "> <http://purl.obolibrary.org/obo/RO_0000053> ?Role . "
+ "?Role core:roleContributesTo ?Grant . " + "?Role rdf:type core:PrincipalInvestigatorRole . "
+ "?Grant core:contributingRole ?RelatedRole . " + "?Role core:relatedBy ?Grant . "
+ "?RelatedRole core:principalInvestigatorRoleOf ?CoPI . " + "?Grant rdf:type core:Grant . "
+ "?Grant core:relates ?RelatedRole . "
+ "?RelatedRole rdf:type core:PrincipalInvestigatorRole . "
+ "?RelatedRole <http://purl.obolibrary.org/obo/RO_0000052> ?CoPI . "
+ "?CoPI rdf:type foaf:Person . "
+ "?CoPI rdfs:label ?CoPILabel . " + "?CoPI rdfs:label ?CoPILabel . "
@ -197,13 +229,21 @@ public class CoPIGrantCountQueryRunner implements QueryRunner<CollaborationData>
+ "{ " + "{ "
+ "<" + queryURI + "> core:hasPrincipalInvestigatorRole ?Role . " + "<" + queryURI + "> <http://purl.obolibrary.org/obo/RO_0000053> ?Role . "
+ "?Role core:roleContributesTo ?Grant . " + "?Role rdf:type core:PrincipalInvestigatorRole . "
+ "?Grant core:contributingRole ?RelatedRole . " + "?Role core:relatedBy ?Grant . "
+ "?RelatedRole core:investigatorRoleOf ?CoPI . " + "?Grant rdf:type core:Grant . "
+ "?Grant core:relates ?RelatedRole . "
+ "?RelatedRole rdf:type core:InvestigatorRole . "
+ "?RelatedRole <http://purl.obolibrary.org/obo/RO_0000052> ?CoPI . "
+ "?CoPI rdf:type foaf:Person . "
+ "?CoPI rdfs:label ?CoPILabel . " + "?CoPI rdfs:label ?CoPILabel . "
@ -218,13 +258,21 @@ public class CoPIGrantCountQueryRunner implements QueryRunner<CollaborationData>
+ "{ " + "{ "
+ "<" + queryURI + "> core:hasPrincipalInvestigatorRole ?Role . " + "<" + queryURI + "> <http://purl.obolibrary.org/obo/RO_0000053> ?Role . "
+ "?Role core:roleContributesTo ?Grant . " + "?Role rdf:type core:PrincipalInvestigatorRole . "
+ "?Grant core:contributingRole ?RelatedRole . " + "?Role core:relatedBy ?Grant . "
+ "?RelatedRole core:co-PrincipalInvestigatorRoleOf ?CoPI . " + "?Grant rdf:type core:Grant . "
+ "?Grant core:relates ?RelatedRole . "
+ "?RelatedRole rdf:type core:CoPrincipalInvestigatorRole . "
+ "?RelatedRole <http://purl.obolibrary.org/obo/RO_0000052> ?CoPI . "
+ "?CoPI rdf:type foaf:Person . "
+ "?CoPI rdfs:label ?CoPILabel . " + "?CoPI rdfs:label ?CoPILabel . "
@ -239,13 +287,21 @@ public class CoPIGrantCountQueryRunner implements QueryRunner<CollaborationData>
+ "{ " + "{ "
+ "<" + queryURI + "> core:hasInvestigatorRole ?Role . " + "<" + queryURI + "> <http://purl.obolibrary.org/obo/RO_0000053> ?Role . "
+ "?Role core:roleContributesTo ?Grant . " + "?Role rdf:type core:InvestigatorRole . "
+ "?Grant core:contributingRole ?RelatedRole . " + "?Role core:relatedBy ?Grant . "
+ "?RelatedRole core:investigatorRoleOf ?CoPI . " + "?Grant rdf:type core:Grant . "
+ "?Grant core:relates ?RelatedRole . "
+ "?RelatedRole rdf:type core:InvestigatorRole . "
+ "?RelatedRole <http://purl.obolibrary.org/obo/RO_0000052> ?CoPI . "
+ "?CoPI rdf:type foaf:Person . "
+ "?CoPI rdfs:label ?CoPILabel . " + "?CoPI rdfs:label ?CoPILabel . "
@ -260,13 +316,21 @@ public class CoPIGrantCountQueryRunner implements QueryRunner<CollaborationData>
+ "{ " + "{ "
+ "<" + queryURI + "> core:hasInvestigatorRole ?Role . " + "<" + queryURI + "> <http://purl.obolibrary.org/obo/RO_0000053> ?Role . "
+ "?Role core:roleContributesTo ?Grant . " + "?Role rdf:type core:InvestigatorRole . "
+ "?Grant core:contributingRole ?RelatedRole . " + "?Role core:relatedBy ?Grant . "
+ "?RelatedRole core:co-PrincipalInvestigatorRoleOf ?CoPI . " + "?Grant rdf:type core:Grant . "
+ "?Grant core:relates ?RelatedRole . "
+ "?RelatedRole rdf:type core:CoPrincipalInvestigatorRole . "
+ "?RelatedRole <http://purl.obolibrary.org/obo/RO_0000052> ?CoPI . "
+ "?CoPI rdf:type foaf:Person . "
+ "?CoPI rdfs:label ?CoPILabel . " + "?CoPI rdfs:label ?CoPILabel . "
@ -281,13 +345,21 @@ public class CoPIGrantCountQueryRunner implements QueryRunner<CollaborationData>
+ "{ " + "{ "
+ "<" + queryURI + "> core:hasInvestigatorRole ?Role . " + "<" + queryURI + "> <http://purl.obolibrary.org/obo/RO_0000053> ?Role . "
+ "?Role core:roleContributesTo ?Grant . " + "?Role rdf:type core:InvestigatorRole . "
+ "?Grant core:contributingRole ?RelatedRole . " + "?Role core:relatedBy ?Grant . "
+ "?RelatedRole core:principalInvestigatorRoleOf ?CoPI . " + "?Grant rdf:type core:Grant . "
+ "?Grant core:relates ?RelatedRole . "
+ "?RelatedRole rdf:type core:PrincipalInvestigatorRole . "
+ "?RelatedRole <http://purl.obolibrary.org/obo/RO_0000052> ?CoPI . "
+ "?CoPI rdf:type foaf:Person . "
+ "?CoPI rdfs:label ?CoPILabel . " + "?CoPI rdfs:label ?CoPILabel . "

View file

@ -53,8 +53,9 @@ public class OrganizationAssociatedPeopleModelWithTypesConstructor implements Mo
+ " <" + organizationURI + "> rdf:type foaf:Organization . " + " <" + organizationURI + "> rdf:type foaf:Organization . "
+ " <" + organizationURI + "> rdfs:label ?organizationLabel . " + " <" + organizationURI + "> rdfs:label ?organizationLabel . "
+ " OPTIONAL { " + " OPTIONAL { "
+ " <" + organizationURI + "> core:organizationForPosition ?Position . " + " <" + organizationURI + "> core:relatedBy ?Position . "
+ " ?Position core:positionForPerson ?Person . " + " ?Position rdf:type core:Position . "
+ " ?Position core:relates ?Person . "
+ " ?Person rdfs:label ?personLabel. " + " ?Person rdfs:label ?personLabel. "
+ " ?Person rdf:type ?personType . " + " ?Person rdf:type ?personType . "
+ " ?personType rdfs:label ?personTypeLabel . " + " ?personType rdfs:label ?personTypeLabel . "

View file

@ -50,7 +50,8 @@ public class OrganizationModelWithTypesConstructor implements ModelConstructor {
+ " CONSTRUCT { " + " CONSTRUCT { "
+ " ?organization rdf:type foaf:Organization . " + " ?organization rdf:type foaf:Organization . "
+ " ?organization rdfs:label ?organizationLabel . " + " ?organization rdfs:label ?organizationLabel . "
+ " ?organization core:hasSubOrganization ?subOrganization . " + " ?organization <http://purl.obolibrary.org/obo/BFO_0000051> ?subOrganization . "
+ " ?subOrganization rdf:type foaf:Organization . "
+ " ?subOrganization rdfs:label ?subOrganizationLabel . " + " ?subOrganization rdfs:label ?subOrganizationLabel . "
+ " ?subOrganization rdf:type ?subOrganizationType . " + " ?subOrganization rdf:type ?subOrganizationType . "
+ " ?subOrganizationType rdfs:label ?subOrganizationTypeLabel . " + " ?subOrganizationType rdfs:label ?subOrganizationTypeLabel . "
@ -60,7 +61,8 @@ public class OrganizationModelWithTypesConstructor implements ModelConstructor {
+ " ?organization rdfs:label ?organizationLabel . " + " ?organization rdfs:label ?organizationLabel . "
+ " " + " "
+ " OPTIONAL { " + " OPTIONAL { "
+ " ?organization core:hasSubOrganization ?subOrganization . " + " ?organization <http://purl.obolibrary.org/obo/BFO_0000051> ?subOrganization . "
+ " ?subOrganization rdf:type foaf:Organization . "
+ " ?subOrganization rdfs:label ?subOrganizationLabel . " + " ?subOrganization rdfs:label ?subOrganizationLabel . "
+ " ?subOrganization rdf:type ?subOrganizationType . " + " ?subOrganization rdf:type ?subOrganizationType . "
+ " ?subOrganizationType rdfs:label ?subOrganizationTypeLabel . " + " ?subOrganizationType rdfs:label ?subOrganizationTypeLabel . "

View file

@ -1,189 +1,204 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */ /* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webapp.visualization.modelconstructor; package edu.cornell.mannlib.vitro.webapp.visualization.modelconstructor;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import com.hp.hpl.jena.query.Dataset; import com.hp.hpl.jena.query.Dataset;
import com.hp.hpl.jena.query.Query; import com.hp.hpl.jena.query.Query;
import com.hp.hpl.jena.query.QueryExecution; import com.hp.hpl.jena.query.QueryExecution;
import com.hp.hpl.jena.query.QueryExecutionFactory; import com.hp.hpl.jena.query.QueryExecutionFactory;
import com.hp.hpl.jena.query.QueryFactory; import com.hp.hpl.jena.query.QueryFactory;
import com.hp.hpl.jena.query.Syntax; import com.hp.hpl.jena.query.Syntax;
import com.hp.hpl.jena.rdf.model.Model; import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.ModelFactory; import com.hp.hpl.jena.rdf.model.ModelFactory;
import edu.cornell.mannlib.vitro.webapp.visualization.constants.QueryConstants; import edu.cornell.mannlib.vitro.webapp.visualization.constants.QueryConstants;
import edu.cornell.mannlib.vitro.webapp.visualization.exceptions.MalformedQueryParametersException; import edu.cornell.mannlib.vitro.webapp.visualization.exceptions.MalformedQueryParametersException;
import edu.cornell.mannlib.vitro.webapp.visualization.visutils.ModelConstructor; import edu.cornell.mannlib.vitro.webapp.visualization.visutils.ModelConstructor;
public class OrganizationToGrantsForSubOrganizationsModelConstructor implements ModelConstructor { public class OrganizationToGrantsForSubOrganizationsModelConstructor implements ModelConstructor {
protected static final Syntax SYNTAX = Syntax.syntaxARQ; protected static final Syntax SYNTAX = Syntax.syntaxARQ;
private Dataset dataset; private Dataset dataset;
public static final String MODEL_TYPE = "ORGANIZATION_TO_GRANTS_FOR_SUBORGANIZATIONS"; public static final String MODEL_TYPE = "ORGANIZATION_TO_GRANTS_FOR_SUBORGANIZATIONS";
public static final String MODEL_TYPE_HUMAN_READABLE = "Grants for specific organization via all descendants"; public static final String MODEL_TYPE_HUMAN_READABLE = "Grants for specific organization via all descendants";
private String organizationURI; private String organizationURI;
private Log log = LogFactory.getLog(OrganizationToGrantsForSubOrganizationsModelConstructor.class.getName()); private Log log = LogFactory.getLog(OrganizationToGrantsForSubOrganizationsModelConstructor.class.getName());
private long before, after; private long before, after;
public OrganizationToGrantsForSubOrganizationsModelConstructor(String organizationURI, Dataset dataset) { public OrganizationToGrantsForSubOrganizationsModelConstructor(String organizationURI, Dataset dataset) {
this.organizationURI = organizationURI; this.organizationURI = organizationURI;
this.dataset = dataset; this.dataset = dataset;
} }
private Set<String> constructOrganizationGrantsQueryTemplate(String constructProperty, String roleTypeProperty) { private Set<String> constructOrganizationGrantsQueryTemplate(String constructProperty, String roleType) {
Set<String> differentPerspectiveQueries = new HashSet<String>(); Set<String> differentPerspectiveQueries = new HashSet<String>();
String justGrantsQuery = "" String justGrantsQuery = ""
+ " CONSTRUCT { " + " CONSTRUCT { "
+ " <" + organizationURI + "> rdfs:label ?organizationLabel . " + " <" + organizationURI + "> rdfs:label ?organizationLabel . "
+ " <" + organizationURI + "> vivosocnet:lastCachedAt ?now . " + " <" + organizationURI + "> vivosocnet:lastCachedAt ?now . "
+ " <" + organizationURI + "> vivosocnet:" + constructProperty + " ?Grant . " + " <" + organizationURI + "> vivosocnet:" + constructProperty + " ?Grant . "
+ " " + " "
+ " ?Grant rdf:type core:Grant . " + " ?Grant rdf:type core:Grant . "
+ " ?Grant rdfs:label ?grantLabel . " + " ?Grant rdfs:label ?grantLabel . "
+ " " + " "
+ " } " + " } "
+ " WHERE { " + " WHERE { "
+ " <" + organizationURI + "> rdfs:label ?organizationLabel . " + " <" + organizationURI + "> rdfs:label ?organizationLabel . "
+ " <" + organizationURI + "> core:hasSubOrganization* ?subOrganization . " + " <" + organizationURI + "> <http://purl.obolibrary.org/obo/BFO_0000051>* ?subOrganization . "
+ " ?subOrganization core:organizationForPosition ?Position . " + " ?subOrganization rdf:type foaf:Organization . "
+ " ?Position core:positionForPerson ?Person . " + " ?subOrganization core:relatedBy ?Position . "
+ " ?Person core:" + roleTypeProperty + " ?Role . " + " ?Position rdf:type core:Position . "
+ " ?Role core:roleContributesTo ?Grant . " + " ?Position core:relates ?Person . "
+ " ?Grant rdfs:label ?grantLabel . " + " ?Person rdf:type foaf:Person . "
+ " " + " ?Person <http://purl.obolibrary.org/obo/RO_0000053> ?Role . "
+ " LET(?now := afn:now()) " + " ?Role rdf:type core:" + roleType + " . "
+ " } "; + " ?Role core:relatedBy ?Grant . "
+ " ?Grant rdf:type core:Grant . "
String justDateTimeOnGrantsQuery = "" + " ?Grant rdfs:label ?grantLabel . "
+ " CONSTRUCT { " + " "
+ " <" + organizationURI + "> rdfs:label ?organizationLabel . " + " LET(?now := afn:now()) "
+ " <" + organizationURI + "> vivosocnet:lastCachedAt ?now . " + " } ";
+ " "
+ " ?Grant vivosocnet:startDateTimeOnGrant ?startDateTimeValueForGrant . " String justDateTimeOnGrantsQuery = ""
// + " ?Grant vivosocnet:endDateTimeOnGrant ?endDateTimeValueForGrant . " + " CONSTRUCT { "
+ " " + " <" + organizationURI + "> rdfs:label ?organizationLabel . "
+ " } " + " <" + organizationURI + "> vivosocnet:lastCachedAt ?now . "
+ " WHERE { " + " "
+ " <" + organizationURI + "> rdfs:label ?organizationLabel . " + " ?Grant vivosocnet:startDateTimeOnGrant ?startDateTimeValueForGrant . "
+ " <" + organizationURI + "> core:hasSubOrganization* ?subOrganization . " // + " ?Grant vivosocnet:endDateTimeOnGrant ?endDateTimeValueForGrant . "
+ " ?subOrganization core:organizationForPosition ?Position . " + " "
+ " ?Position core:positionForPerson ?Person . " + " } "
+ " ?Person core:" + roleTypeProperty + " ?Role . " + " WHERE { "
+ " ?Role core:roleContributesTo ?Grant . " + " <" + organizationURI + "> rdfs:label ?organizationLabel . "
+ " " + " <" + organizationURI + "> <http://purl.obolibrary.org/obo/BFO_0000051>* ?subOrganization . "
+ " ?Grant core:dateTimeInterval ?dateTimeIntervalValueForGrant . " + " ?subOrganization rdf:type foaf:Organization . "
// + " OPTIONAL { " + " ?subOrganization core:relatedBy ?Position . "
+ " ?dateTimeIntervalValueForGrant core:start ?startDateForGrant . " + " ?Position rdf:type core:Position . "
+ " ?startDateForGrant core:dateTime ?startDateTimeValueForGrant . " + " ?Position core:relates ?Person . "
// + " } " + " ?Person rdf:type foaf:Person . "
// + " OPTIONAL { " + " ?Person <http://purl.obolibrary.org/obo/RO_0000053> ?Role . "
// + " ?dateTimeIntervalValueForGrant core:end ?endDateForGrant . " + " ?Role rdf:type core:" + roleType + " . "
// + " ?endDateForGrant core:dateTime ?endDateTimeValueForGrant " + " ?Role core:relatedBy ?Grant . "
// + " } " + " ?Grant rdf:type core:Grant . "
+ " " + " "
+ " LET(?now := afn:now()) " + " ?Grant core:dateTimeInterval ?dateTimeIntervalValueForGrant . "
+ " } "; // + " OPTIONAL { "
+ " ?dateTimeIntervalValueForGrant core:start ?startDateForGrant . "
String justDateTimeOnRolesQuery = "" + " ?startDateForGrant core:dateTime ?startDateTimeValueForGrant . "
+ " CONSTRUCT { " // + " } "
+ " <" + organizationURI + "> rdfs:label ?organizationLabel . " // + " OPTIONAL { "
+ " <" + organizationURI + "> vivosocnet:lastCachedAt ?now . " // + " ?dateTimeIntervalValueForGrant core:end ?endDateForGrant . "
+ " " // + " ?endDateForGrant core:dateTime ?endDateTimeValueForGrant "
+ " ?Grant vivosocnet:startDateTimeOnRole ?startDateTimeValue . " // + " } "
// + " ?Grant vivosocnet:endDateTimeOnRole ?endDateTimeValue . " + " "
+ " } " + " LET(?now := afn:now()) "
+ " WHERE { " + " } ";
+ " <" + organizationURI + "> rdfs:label ?organizationLabel . "
+ " <" + organizationURI + "> core:hasSubOrganization* ?subOrganization . " String justDateTimeOnRolesQuery = ""
+ " ?subOrganization core:organizationForPosition ?Position . " + " CONSTRUCT { "
+ " ?Position core:positionForPerson ?Person . " + " <" + organizationURI + "> rdfs:label ?organizationLabel . "
+ " ?Person core:" + roleTypeProperty + " ?Role . " + " <" + organizationURI + "> vivosocnet:lastCachedAt ?now . "
+ " ?Role core:roleContributesTo ?Grant . " + " "
+ " " + " ?Grant vivosocnet:startDateTimeOnRole ?startDateTimeValue . "
+ " ?Role core:dateTimeInterval ?dateTimeIntervalValue . " // + " ?Grant vivosocnet:endDateTimeOnRole ?endDateTimeValue . "
// + " OPTIONAL { " + " } "
+ " ?dateTimeIntervalValue core:start ?startDate . " + " WHERE { "
+ " ?startDate core:dateTime ?startDateTimeValue . " + " <" + organizationURI + "> rdfs:label ?organizationLabel . "
// + " } " + " <" + organizationURI + "> <http://purl.obolibrary.org/obo/BFO_0000051>* ?subOrganization . "
// + " " + " ?subOrganization rdf:type foaf:Organization . "
// + " OPTIONAL { " + " ?subOrganization core:relatedBy ?Position . "
// + " ?dateTimeIntervalValue core:end ?endDate . " + " ?Position rdf:type core:Position . "
// + " ?endDate core:dateTime ?endDateTimeValue . " + " ?Position core:relates ?Person . "
// + " } " + " ?Person rdf:type foaf:Person . "
+ " " + " ?Person <http://purl.obolibrary.org/obo/RO_0000053> ?Role . "
+ " LET(?now := afn:now()) " + " ?Role rdf:type core:" + roleType + " . "
+ " } "; + " ?Role core:relatedBy ?Grant . "
+ " ?Grant rdf:type core:Grant . "
differentPerspectiveQueries.add(justGrantsQuery); + " "
differentPerspectiveQueries.add(justDateTimeOnGrantsQuery); + " ?Role core:dateTimeInterval ?dateTimeIntervalValue . "
differentPerspectiveQueries.add(justDateTimeOnRolesQuery); // + " OPTIONAL { "
+ " ?dateTimeIntervalValue core:start ?startDate . "
return differentPerspectiveQueries; + " ?startDate core:dateTime ?startDateTimeValue . "
} // + " } "
// + " "
private Set<String> constructOrganizationToGrantsQuery() { // + " OPTIONAL { "
// + " ?dateTimeIntervalValue core:end ?endDate . "
Set<String> differentInvestigatorTypeQueries = new HashSet<String>(); // + " ?endDate core:dateTime ?endDateTimeValue . "
// + " } "
Set<String> investigatorRoleQuery = constructOrganizationGrantsQueryTemplate("hasInvestigatorWithGrant", "hasInvestigatorRole"); + " "
Set<String> piRoleQuery = constructOrganizationGrantsQueryTemplate("hasPIWithGrant", "hasPrincipalInvestigatorRole"); + " LET(?now := afn:now()) "
Set<String> coPIRoleQuery = constructOrganizationGrantsQueryTemplate("hascoPIWithGrant", "hasCo-PrincipalInvestigatorRole"); + " } ";
differentInvestigatorTypeQueries.addAll(investigatorRoleQuery); differentPerspectiveQueries.add(justGrantsQuery);
differentInvestigatorTypeQueries.addAll(piRoleQuery); differentPerspectiveQueries.add(justDateTimeOnGrantsQuery);
differentInvestigatorTypeQueries.addAll(coPIRoleQuery); differentPerspectiveQueries.add(justDateTimeOnRolesQuery);
return differentInvestigatorTypeQueries; return differentPerspectiveQueries;
} }
private Model executeQuery(Set<String> constructQueries) { private Set<String> constructOrganizationToGrantsQuery() {
Model constructedModel = ModelFactory.createDefaultModel(); Set<String> differentInvestigatorTypeQueries = new HashSet<String>();
before = System.currentTimeMillis(); Set<String> investigatorRoleQuery = constructOrganizationGrantsQueryTemplate("hasInvestigatorWithGrant", "InvestigatorRole");
log.debug("CONSTRUCT query string : " + constructQueries); Set<String> piRoleQuery = constructOrganizationGrantsQueryTemplate("hasPIWithGrant", "PrincipalInvestigatorRole");
Set<String> coPIRoleQuery = constructOrganizationGrantsQueryTemplate("hascoPIWithGrant", "CoPrincipalInvestigatorRole");
for (String currentQuery : constructQueries) {
differentInvestigatorTypeQueries.addAll(investigatorRoleQuery);
Query query = null; differentInvestigatorTypeQueries.addAll(piRoleQuery);
differentInvestigatorTypeQueries.addAll(coPIRoleQuery);
try {
query = QueryFactory.create(QueryConstants.getSparqlPrefixQuery() + currentQuery, SYNTAX); return differentInvestigatorTypeQueries;
} catch (Throwable th) { }
log.error("Could not create CONSTRUCT SPARQL query for query "
+ "string. " + th.getMessage()); private Model executeQuery(Set<String> constructQueries) {
log.error(currentQuery);
} Model constructedModel = ModelFactory.createDefaultModel();
QueryExecution qe = QueryExecutionFactory.create(query, dataset); before = System.currentTimeMillis();
log.debug("CONSTRUCT query string : " + constructQueries);
try {
qe.execConstruct(constructedModel); for (String currentQuery : constructQueries) {
} finally {
qe.close(); Query query = null;
}
} try {
query = QueryFactory.create(QueryConstants.getSparqlPrefixQuery() + currentQuery, SYNTAX);
after = System.currentTimeMillis(); } catch (Throwable th) {
log.debug("Time taken to execute the CONSTRUCT queries is in milliseconds: " log.error("Could not create CONSTRUCT SPARQL query for query "
+ (after - before)); + "string. " + th.getMessage());
log.error(currentQuery);
return constructedModel; }
}
QueryExecution qe = QueryExecutionFactory.create(query, dataset);
public Model getConstructedModel() throws MalformedQueryParametersException {
return executeQuery(constructOrganizationToGrantsQuery()); try {
} qe.execConstruct(constructedModel);
} } finally {
qe.close();
}
}
after = System.currentTimeMillis();
log.debug("Time taken to execute the CONSTRUCT queries is in milliseconds: "
+ (after - before));
return constructedModel;
}
public Model getConstructedModel() throws MalformedQueryParametersException {
return executeQuery(constructOrganizationToGrantsQuery());
}
}

View file

@ -53,11 +53,16 @@ public class OrganizationToPublicationsForSubOrganizationsModelConstructor imple
+ " } " + " } "
+ " WHERE { " + " WHERE { "
+ " <" + organizationURI + "> rdfs:label ?organizationLabel . " + " <" + organizationURI + "> rdfs:label ?organizationLabel . "
+ " <" + organizationURI + "> core:hasSubOrganization* ?subOrganization . " + " <" + organizationURI + "> <http://purl.obolibrary.org/obo/BFO_0000051>* ?subOrganization . "
+ " ?subOrganization core:organizationForPosition ?Position . " + " ?subOrganization rdf:type foaf:Organization . "
+ " ?Position core:positionForPerson ?Person . " + " ?subOrganization core:relatedBy ?Position . "
+ " ?Person core:authorInAuthorship ?Resource . " + " ?Position rdf:type core:Position . "
+ " ?Resource core:linkedInformationResource ?Document . " + " ?Position core:relates ?Person . "
+ " ?Person rdf:type foaf:Person . "
+ " ?Person core:relatedBy ?Resource . "
+ " ?Resource rdf:type core:Authorship . "
+ " ?Resource core:relates ?Document . "
+ " ?Document rdf:type bibo:Document . "
+ " ?Document rdfs:label ?DocumentLabel . " + " ?Document rdfs:label ?DocumentLabel . "
+ " " + " "
+ " OPTIONAL { " + " OPTIONAL { "

View file

@ -1,171 +1,177 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */ /* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webapp.visualization.modelconstructor; package edu.cornell.mannlib.vitro.webapp.visualization.modelconstructor;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import com.hp.hpl.jena.query.Dataset; import com.hp.hpl.jena.query.Dataset;
import com.hp.hpl.jena.query.Query; import com.hp.hpl.jena.query.Query;
import com.hp.hpl.jena.query.QueryExecution; import com.hp.hpl.jena.query.QueryExecution;
import com.hp.hpl.jena.query.QueryExecutionFactory; import com.hp.hpl.jena.query.QueryExecutionFactory;
import com.hp.hpl.jena.query.QueryFactory; import com.hp.hpl.jena.query.QueryFactory;
import com.hp.hpl.jena.query.Syntax; import com.hp.hpl.jena.query.Syntax;
import com.hp.hpl.jena.rdf.model.Model; import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.ModelFactory; import com.hp.hpl.jena.rdf.model.ModelFactory;
import edu.cornell.mannlib.vitro.webapp.visualization.constants.QueryConstants; import edu.cornell.mannlib.vitro.webapp.visualization.constants.QueryConstants;
import edu.cornell.mannlib.vitro.webapp.visualization.exceptions.MalformedQueryParametersException; import edu.cornell.mannlib.vitro.webapp.visualization.exceptions.MalformedQueryParametersException;
import edu.cornell.mannlib.vitro.webapp.visualization.visutils.ModelConstructor; import edu.cornell.mannlib.vitro.webapp.visualization.visutils.ModelConstructor;
public class PeopleToGrantsModelConstructor implements ModelConstructor { public class PeopleToGrantsModelConstructor implements ModelConstructor {
protected static final Syntax SYNTAX = Syntax.syntaxARQ; protected static final Syntax SYNTAX = Syntax.syntaxARQ;
private Dataset dataset; private Dataset dataset;
public static final String MODEL_TYPE = "PEOPLE_TO_GRANTS"; public static final String MODEL_TYPE = "PEOPLE_TO_GRANTS";
public static final String MODEL_TYPE_HUMAN_READABLE = "Grants for all people via all roles"; public static final String MODEL_TYPE_HUMAN_READABLE = "Grants for all people via all roles";
private Log log = LogFactory.getLog(PeopleToGrantsModelConstructor.class.getName()); private Log log = LogFactory.getLog(PeopleToGrantsModelConstructor.class.getName());
private long before, after; private long before, after;
public PeopleToGrantsModelConstructor(Dataset dataset) { public PeopleToGrantsModelConstructor(Dataset dataset) {
this.dataset = dataset; this.dataset = dataset;
} }
private Set<String> constructPersonGrantsQueryTemplate(String constructProperty, String roleTypeProperty) { private Set<String> constructPersonGrantsQueryTemplate(String constructProperty, String roleType) {
Set<String> differentPerspectiveQueries = new HashSet<String>(); Set<String> differentPerspectiveQueries = new HashSet<String>();
String justGrantsQuery = "" String justGrantsQuery = ""
+ " CONSTRUCT { " + " CONSTRUCT { "
+ " ?person vivosocnet:lastCachedAt ?now . " + " ?Person vivosocnet:lastCachedAt ?now . "
+ " ?person vivosocnet:" + constructProperty + " ?Grant . " + " ?Person vivosocnet:" + constructProperty + " ?Grant . "
+ " " + " "
+ " ?Grant rdf:type core:Grant . " + " ?Grant rdf:type core:Grant . "
+ " ?Grant rdfs:label ?grantLabel . " + " ?Grant rdfs:label ?grantLabel . "
+ " " + " "
+ " } " + " } "
+ " WHERE { " + " WHERE { "
+ " ?person core:" + roleTypeProperty + " ?Role . " + " ?Person <http://purl.obolibrary.org/obo/RO_0000053> ?Role . "
+ " ?Role core:roleContributesTo ?Grant . " + " ?Role rdf:type core:" + roleType + " . "
+ " ?Grant rdfs:label ?grantLabel . " + " ?Role core:relatedBy ?Grant . "
+ " " + " ?Grant rdf:type core:Grant . "
+ " LET(?now := afn:now()) " + " ?Grant rdfs:label ?grantLabel . "
+ " } "; + " "
+ " LET(?now := afn:now()) "
String justDateTimeOnGrantsQuery = "" + " } ";
+ " CONSTRUCT { "
+ " ?person vivosocnet:lastCachedAt ?now . " String justDateTimeOnGrantsQuery = ""
+ " ?Grant vivosocnet:startDateTimeOnGrant ?startDateTimeValueForGrant . " + " CONSTRUCT { "
// + " ?Grant vivosocnet:endDateTimeOnGrant ?endDateTimeValueForGrant . " + " ?Person vivosocnet:lastCachedAt ?now . "
+ " " + " ?Grant vivosocnet:startDateTimeOnGrant ?startDateTimeValueForGrant . "
+ " } " // + " ?Grant vivosocnet:endDateTimeOnGrant ?endDateTimeValueForGrant . "
+ " WHERE { " + " "
+ " ?person core:" + roleTypeProperty + " ?Role . " + " } "
+ " ?Role core:roleContributesTo ?Grant . " + " WHERE { "
+ " " + " ?Person <http://purl.obolibrary.org/obo/RO_0000053> ?Role . "
+ " ?Grant core:dateTimeInterval ?dateTimeIntervalValueForGrant . " + " ?Role rdf:type core:" + roleType + " . "
// + " OPTIONAL { " + " ?Role core:relatedBy ?Grant . "
+ " ?dateTimeIntervalValueForGrant core:start ?startDateForGrant . " + " ?Grant rdf:type core:Grant . "
+ " ?startDateForGrant core:dateTime ?startDateTimeValueForGrant . " + " "
// + " } " + " ?Grant core:dateTimeInterval ?dateTimeIntervalValueForGrant . "
// + " OPTIONAL { " // + " OPTIONAL { "
// + " ?dateTimeIntervalValueForGrant core:end ?endDateForGrant . " + " ?dateTimeIntervalValueForGrant core:start ?startDateForGrant . "
// + " ?endDateForGrant core:dateTime ?endDateTimeValueForGrant " + " ?startDateForGrant core:dateTime ?startDateTimeValueForGrant . "
// + " } " // + " } "
+ " " // + " OPTIONAL { "
+ " LET(?now := afn:now()) " // + " ?dateTimeIntervalValueForGrant core:end ?endDateForGrant . "
+ " } "; // + " ?endDateForGrant core:dateTime ?endDateTimeValueForGrant "
// + " } "
String justDateTimeOnRolesQuery = "" + " "
+ " CONSTRUCT { " + " LET(?now := afn:now()) "
+ " ?person vivosocnet:lastCachedAt ?now . " + " } ";
+ " ?Grant vivosocnet:startDateTimeOnRole ?startDateTimeValue . "
// + " ?Grant vivosocnet:endDateTimeOnRole ?endDateTimeValue . " String justDateTimeOnRolesQuery = ""
+ " } " + " CONSTRUCT { "
+ " WHERE { " + " ?Person vivosocnet:lastCachedAt ?now . "
+ " ?person core:" + roleTypeProperty + " ?Role . " + " ?Grant vivosocnet:startDateTimeOnRole ?startDateTimeValue . "
+ " ?Role core:roleContributesTo ?Grant . " // + " ?Grant vivosocnet:endDateTimeOnRole ?endDateTimeValue . "
+ " " + " } "
+ " ?Role core:dateTimeInterval ?dateTimeIntervalValue . " + " WHERE { "
// + " OPTIONAL { " + " ?Person <http://purl.obolibrary.org/obo/RO_0000053> ?Role . "
+ " ?dateTimeIntervalValue core:start ?startDate . " + " ?Role rdf:type core:" + roleType + " . "
+ " ?startDate core:dateTime ?startDateTimeValue . " + " ?Role core:relatedBy ?Grant . "
// + " } " + " ?Grant rdf:type core:Grant . "
// + " " + " "
// + " OPTIONAL { " + " ?Role core:dateTimeInterval ?dateTimeIntervalValue . "
// + " ?dateTimeIntervalValue core:end ?endDate . " // + " OPTIONAL { "
// + " ?endDate core:dateTime ?endDateTimeValue . " + " ?dateTimeIntervalValue core:start ?startDate . "
// + " } " + " ?startDate core:dateTime ?startDateTimeValue . "
+ " " // + " } "
+ " LET(?now := afn:now()) " // + " "
+ " } "; // + " OPTIONAL { "
// + " ?dateTimeIntervalValue core:end ?endDate . "
differentPerspectiveQueries.add(justGrantsQuery); // + " ?endDate core:dateTime ?endDateTimeValue . "
differentPerspectiveQueries.add(justDateTimeOnGrantsQuery); // + " } "
differentPerspectiveQueries.add(justDateTimeOnRolesQuery); + " "
+ " LET(?now := afn:now()) "
return differentPerspectiveQueries; + " } ";
}
differentPerspectiveQueries.add(justGrantsQuery);
private Set<String> constructPeopleToGrantsQuery() { differentPerspectiveQueries.add(justDateTimeOnGrantsQuery);
differentPerspectiveQueries.add(justDateTimeOnRolesQuery);
Set<String> differentInvestigatorTypeQueries = new HashSet<String>();
return differentPerspectiveQueries;
Set<String> investigatorRoleQuery = constructPersonGrantsQueryTemplate("hasGrantAsAnInvestigator", "hasInvestigatorRole"); }
Set<String> piRoleQuery = constructPersonGrantsQueryTemplate("hasGrantAsPI", "hasPrincipalInvestigatorRole");
Set<String> coPIRoleQuery = constructPersonGrantsQueryTemplate("hasGrantAsCoPI", "hasCo-PrincipalInvestigatorRole"); private Set<String> constructPeopleToGrantsQuery() {
differentInvestigatorTypeQueries.addAll(investigatorRoleQuery); Set<String> differentInvestigatorTypeQueries = new HashSet<String>();
differentInvestigatorTypeQueries.addAll(piRoleQuery);
differentInvestigatorTypeQueries.addAll(coPIRoleQuery); Set<String> investigatorRoleQuery = constructPersonGrantsQueryTemplate("hasGrantAsAnInvestigator", "InvestigatorRole");
Set<String> piRoleQuery = constructPersonGrantsQueryTemplate("hasGrantAsPI", "PrincipalInvestigatorRole");
return differentInvestigatorTypeQueries; Set<String> coPIRoleQuery = constructPersonGrantsQueryTemplate("hasGrantAsCoPI", "CoPrincipalInvestigatorRole");
}
differentInvestigatorTypeQueries.addAll(investigatorRoleQuery);
private Model executeQuery(Set<String> constructQueries) { differentInvestigatorTypeQueries.addAll(piRoleQuery);
differentInvestigatorTypeQueries.addAll(coPIRoleQuery);
Model constructedModel = ModelFactory.createDefaultModel();
return differentInvestigatorTypeQueries;
before = System.currentTimeMillis(); }
log.debug("CONSTRUCT query string : " + constructQueries);
private Model executeQuery(Set<String> constructQueries) {
for (String currentQuery : constructQueries) {
Model constructedModel = ModelFactory.createDefaultModel();
Query query = null; before = System.currentTimeMillis();
log.debug("CONSTRUCT query string : " + constructQueries);
try {
query = QueryFactory.create(QueryConstants.getSparqlPrefixQuery() + currentQuery, SYNTAX); for (String currentQuery : constructQueries) {
} catch (Throwable th) {
log.error("Could not create CONSTRUCT SPARQL query for query "
+ "string. " + th.getMessage()); Query query = null;
log.error(currentQuery);
} try {
query = QueryFactory.create(QueryConstants.getSparqlPrefixQuery() + currentQuery, SYNTAX);
} catch (Throwable th) {
QueryExecution qe = QueryExecutionFactory.create(query, dataset); log.error("Could not create CONSTRUCT SPARQL query for query "
+ "string. " + th.getMessage());
try { log.error(currentQuery);
qe.execConstruct(constructedModel); }
} finally {
qe.close();
} QueryExecution qe = QueryExecutionFactory.create(query, dataset);
}
try {
after = System.currentTimeMillis(); qe.execConstruct(constructedModel);
log.debug("Time taken to execute the CONSTRUCT queries is in milliseconds: " } finally {
+ (after - before)); qe.close();
}
return constructedModel; }
}
after = System.currentTimeMillis();
public Model getConstructedModel() throws MalformedQueryParametersException { log.debug("Time taken to execute the CONSTRUCT queries is in milliseconds: "
return executeQuery(constructPeopleToGrantsQuery()); + (after - before));
}
} return constructedModel;
}
public Model getConstructedModel() throws MalformedQueryParametersException {
return executeQuery(constructPeopleToGrantsQuery());
}
}

View file

@ -48,8 +48,11 @@ public class PeopleToPublicationsModelConstructor implements ModelConstructor {
+ " ?journal rdfs:label ?journalLabel . " + " ?journal rdfs:label ?journalLabel . "
+ " } " + " } "
+ " WHERE { " + " WHERE { "
+ " ?person core:authorInAuthorship ?Resource . " + " ?person core:relatedBy ?Resource . "
+ " ?Resource core:linkedInformationResource ?Document . " + " ?person rdf:type foaf:Person . "
+ " ?Resource rdf:type core:Authorship . "
+ " ?Resource core:relates ?Document . "
+ " ?Document rdf:type bibo:Document . "
+ " ?Document rdfs:label ?DocumentLabel . " + " ?Document rdfs:label ?DocumentLabel . "
+ " " + " "
+ " OPTIONAL { " + " OPTIONAL { "

View file

@ -1,174 +1,180 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */ /* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webapp.visualization.modelconstructor; package edu.cornell.mannlib.vitro.webapp.visualization.modelconstructor;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import com.hp.hpl.jena.query.Dataset; import com.hp.hpl.jena.query.Dataset;
import com.hp.hpl.jena.query.Query; import com.hp.hpl.jena.query.Query;
import com.hp.hpl.jena.query.QueryExecution; import com.hp.hpl.jena.query.QueryExecution;
import com.hp.hpl.jena.query.QueryExecutionFactory; import com.hp.hpl.jena.query.QueryExecutionFactory;
import com.hp.hpl.jena.query.QueryFactory; import com.hp.hpl.jena.query.QueryFactory;
import com.hp.hpl.jena.query.Syntax; import com.hp.hpl.jena.query.Syntax;
import com.hp.hpl.jena.rdf.model.Model; import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.ModelFactory; import com.hp.hpl.jena.rdf.model.ModelFactory;
import edu.cornell.mannlib.vitro.webapp.visualization.constants.QueryConstants; import edu.cornell.mannlib.vitro.webapp.visualization.constants.QueryConstants;
import edu.cornell.mannlib.vitro.webapp.visualization.exceptions.MalformedQueryParametersException; import edu.cornell.mannlib.vitro.webapp.visualization.exceptions.MalformedQueryParametersException;
import edu.cornell.mannlib.vitro.webapp.visualization.visutils.ModelConstructor; import edu.cornell.mannlib.vitro.webapp.visualization.visutils.ModelConstructor;
public class PersonToGrantsModelConstructor implements ModelConstructor { public class PersonToGrantsModelConstructor implements ModelConstructor {
protected static final Syntax SYNTAX = Syntax.syntaxARQ; protected static final Syntax SYNTAX = Syntax.syntaxARQ;
private Dataset dataset; private Dataset dataset;
public static final String MODEL_TYPE = "PERSON_TO_GRANTS"; public static final String MODEL_TYPE = "PERSON_TO_GRANTS";
public static final String MODEL_TYPE_HUMAN_READABLE = "Grants for specific person via all roles"; public static final String MODEL_TYPE_HUMAN_READABLE = "Grants for specific person via all roles";
private String personURI; private String personURI;
private Log log = LogFactory.getLog(PersonToGrantsModelConstructor.class.getName()); private Log log = LogFactory.getLog(PersonToGrantsModelConstructor.class.getName());
private long before, after; private long before, after;
public PersonToGrantsModelConstructor(String personURI, Dataset dataset) { public PersonToGrantsModelConstructor(String personURI, Dataset dataset) {
this.personURI = personURI; this.personURI = personURI;
this.dataset = dataset; this.dataset = dataset;
} }
private Set<String> constructPersonGrantsQueryTemplate(String constructProperty, String roleTypeProperty) { private Set<String> constructPersonGrantsQueryTemplate(String constructProperty, String roleType) {
Set<String> differentPerspectiveQueries = new HashSet<String>(); Set<String> differentPerspectiveQueries = new HashSet<String>();
String justGrantsQuery = "" String justGrantsQuery = ""
+ " CONSTRUCT { " + " CONSTRUCT { "
+ " <" + personURI + "> vivosocnet:lastCachedAt ?now . " + " <" + personURI + "> vivosocnet:lastCachedAt ?now . "
+ " <" + personURI + "> vivosocnet:" + constructProperty + " ?Grant . " + " <" + personURI + "> vivosocnet:" + constructProperty + " ?Grant . "
+ " " + " "
+ " ?Grant rdf:type core:Grant . " + " ?Grant rdf:type core:Grant . "
+ " ?Grant rdfs:label ?grantLabel . " + " ?Grant rdfs:label ?grantLabel . "
+ " " + " "
+ " } " + " } "
+ " WHERE { " + " WHERE { "
+ " <" + personURI + "> core:" + roleTypeProperty + " ?Role . " + " <" + personURI + "> <http://purl.obolibrary.org/obo/RO_0000053> ?Role . "
+ " ?Role core:roleContributesTo ?Grant . " + " ?Role rdf:type core:" + roleType + " . "
+ " ?Grant rdfs:label ?grantLabel . " + " ?Role core:relatedBy ?Grant . "
+ " " + " ?Grant rdf:type core:Grant . "
+ " LET(?now := afn:now()) " + " ?Grant rdfs:label ?grantLabel . "
+ " } "; + " "
+ " LET(?now := afn:now()) "
String justDateTimeOnGrantsQuery = "" + " } ";
+ " CONSTRUCT { "
+ " <" + personURI + "> vivosocnet:lastCachedAt ?now . " String justDateTimeOnGrantsQuery = ""
+ " ?Grant vivosocnet:startDateTimeOnGrant ?startDateTimeValueForGrant . " + " CONSTRUCT { "
// + " ?Grant vivosocnet:endDateTimeOnGrant ?endDateTimeValueForGrant . " + " <" + personURI + "> vivosocnet:lastCachedAt ?now . "
+ " " + " ?Grant vivosocnet:startDateTimeOnGrant ?startDateTimeValueForGrant . "
+ " } " // + " ?Grant vivosocnet:endDateTimeOnGrant ?endDateTimeValueForGrant . "
+ " WHERE { " + " "
+ " <" + personURI + "> core:" + roleTypeProperty + " ?Role . " + " } "
+ " ?Role core:roleContributesTo ?Grant . " + " WHERE { "
+ " " + " <" + personURI + "> <http://purl.obolibrary.org/obo/RO_0000053> ?Role . "
+ " ?Grant core:dateTimeInterval ?dateTimeIntervalValueForGrant . " + " ?Role rdf:type core:" + roleType + " . "
// + " OPTIONAL { " + " ?Role core:relatedBy ?Grant . "
+ " ?dateTimeIntervalValueForGrant core:start ?startDateForGrant . " + " ?Grant rdf:type core:Grant . "
+ " ?startDateForGrant core:dateTime ?startDateTimeValueForGrant . " + " "
// + " } " + " ?Grant core:dateTimeInterval ?dateTimeIntervalValueForGrant . "
// + " OPTIONAL { " // + " OPTIONAL { "
// + " ?dateTimeIntervalValueForGrant core:end ?endDateForGrant . " + " ?dateTimeIntervalValueForGrant core:start ?startDateForGrant . "
// + " ?endDateForGrant core:dateTime ?endDateTimeValueForGrant " + " ?startDateForGrant core:dateTime ?startDateTimeValueForGrant . "
// + " } " // + " } "
+ " " // + " OPTIONAL { "
+ " LET(?now := afn:now()) " // + " ?dateTimeIntervalValueForGrant core:end ?endDateForGrant . "
+ " } "; // + " ?endDateForGrant core:dateTime ?endDateTimeValueForGrant "
// + " } "
String justDateTimeOnRolesQuery = "" + " "
+ " CONSTRUCT { " + " LET(?now := afn:now()) "
+ " <" + personURI + "> vivosocnet:lastCachedAt ?now . " + " } ";
+ " ?Grant vivosocnet:startDateTimeOnRole ?startDateTimeValue . "
// + " ?Grant vivosocnet:endDateTimeOnRole ?endDateTimeValue . " String justDateTimeOnRolesQuery = ""
+ " } " + " CONSTRUCT { "
+ " WHERE { " + " <" + personURI + "> vivosocnet:lastCachedAt ?now . "
+ " <" + personURI + "> core:" + roleTypeProperty + " ?Role . " + " ?Grant vivosocnet:startDateTimeOnRole ?startDateTimeValue . "
+ " ?Role core:roleContributesTo ?Grant . " // + " ?Grant vivosocnet:endDateTimeOnRole ?endDateTimeValue . "
+ " " + " } "
+ " ?Role core:dateTimeInterval ?dateTimeIntervalValue . " + " WHERE { "
// + " OPTIONAL { " + " <" + personURI + "> <http://purl.obolibrary.org/obo/RO_0000053> ?Role . "
+ " ?dateTimeIntervalValue core:start ?startDate . " + " ?Role rdf:type core:" + roleType + " . "
+ " ?startDate core:dateTime ?startDateTimeValue . " + " ?Role core:relatedBy ?Grant . "
// + " } " + " ?Grant rdf:type core:Grant . "
// + " " + " "
// + " OPTIONAL { " + " ?Role core:dateTimeInterval ?dateTimeIntervalValue . "
// + " ?dateTimeIntervalValue core:end ?endDate . " // + " OPTIONAL { "
// + " ?endDate core:dateTime ?endDateTimeValue . " + " ?dateTimeIntervalValue core:start ?startDate . "
// + " } " + " ?startDate core:dateTime ?startDateTimeValue . "
+ " " // + " } "
+ " LET(?now := afn:now()) " // + " "
+ " } "; // + " OPTIONAL { "
// + " ?dateTimeIntervalValue core:end ?endDate . "
differentPerspectiveQueries.add(justGrantsQuery); // + " ?endDate core:dateTime ?endDateTimeValue . "
differentPerspectiveQueries.add(justDateTimeOnGrantsQuery); // + " } "
differentPerspectiveQueries.add(justDateTimeOnRolesQuery); + " "
+ " LET(?now := afn:now()) "
return differentPerspectiveQueries; + " } ";
}
differentPerspectiveQueries.add(justGrantsQuery);
private Set<String> constructPersonToGrantsQuery() { differentPerspectiveQueries.add(justDateTimeOnGrantsQuery);
differentPerspectiveQueries.add(justDateTimeOnRolesQuery);
Set<String> differentInvestigatorTypeQueries = new HashSet<String>();
return differentPerspectiveQueries;
Set<String> investigatorRoleQuery = constructPersonGrantsQueryTemplate("hasGrantAsAnInvestigator", "hasInvestigatorRole"); }
Set<String> piRoleQuery = constructPersonGrantsQueryTemplate("hasGrantAsPI", "hasPrincipalInvestigatorRole");
Set<String> coPIRoleQuery = constructPersonGrantsQueryTemplate("hasGrantAsCoPI", "hasCo-PrincipalInvestigatorRole"); private Set<String> constructPersonToGrantsQuery() {
differentInvestigatorTypeQueries.addAll(investigatorRoleQuery); Set<String> differentInvestigatorTypeQueries = new HashSet<String>();
differentInvestigatorTypeQueries.addAll(piRoleQuery);
differentInvestigatorTypeQueries.addAll(coPIRoleQuery); Set<String> investigatorRoleQuery = constructPersonGrantsQueryTemplate("hasGrantAsAnInvestigator", "InvestigatorRole");
Set<String> piRoleQuery = constructPersonGrantsQueryTemplate("hasGrantAsPI", "PrincipalInvestigatorRole");
return differentInvestigatorTypeQueries; Set<String> coPIRoleQuery = constructPersonGrantsQueryTemplate("hasGrantAsCoPI", "CoPrincipalInvestigatorRole");
}
differentInvestigatorTypeQueries.addAll(investigatorRoleQuery);
private Model executeQuery(Set<String> constructQueries) { differentInvestigatorTypeQueries.addAll(piRoleQuery);
differentInvestigatorTypeQueries.addAll(coPIRoleQuery);
Model constructedModel = ModelFactory.createDefaultModel();
return differentInvestigatorTypeQueries;
before = System.currentTimeMillis(); }
log.debug("CONSTRUCT query string : " + constructQueries);
private Model executeQuery(Set<String> constructQueries) {
for (String currentQuery : constructQueries) {
Model constructedModel = ModelFactory.createDefaultModel();
Query query = null; before = System.currentTimeMillis();
log.debug("CONSTRUCT query string : " + constructQueries);
try {
query = QueryFactory.create(QueryConstants.getSparqlPrefixQuery() + currentQuery, SYNTAX); for (String currentQuery : constructQueries) {
} catch (Throwable th) {
log.error("Could not create CONSTRUCT SPARQL query for query "
+ "string. " + th.getMessage()); Query query = null;
log.error(currentQuery);
} try {
query = QueryFactory.create(QueryConstants.getSparqlPrefixQuery() + currentQuery, SYNTAX);
} catch (Throwable th) {
QueryExecution qe = QueryExecutionFactory.create(query, dataset); log.error("Could not create CONSTRUCT SPARQL query for query "
+ "string. " + th.getMessage());
try { log.error(currentQuery);
qe.execConstruct(constructedModel); }
} finally {
qe.close();
} QueryExecution qe = QueryExecutionFactory.create(query, dataset);
}
try {
after = System.currentTimeMillis(); qe.execConstruct(constructedModel);
log.debug("Time taken to execute the CONSTRUCT queries is in milliseconds: " } finally {
+ (after - before)); qe.close();
}
return constructedModel; }
}
after = System.currentTimeMillis();
public Model getConstructedModel() throws MalformedQueryParametersException { log.debug("Time taken to execute the CONSTRUCT queries is in milliseconds: "
return executeQuery(constructPersonToGrantsQuery()); + (after - before));
}
} return constructedModel;
}
public Model getConstructedModel() throws MalformedQueryParametersException {
return executeQuery(constructPersonToGrantsQuery());
}
}

View file

@ -51,8 +51,10 @@ public class PersonToPublicationsModelConstructor implements ModelConstructor {
+ " ?journal rdfs:label ?journalLabel . " + " ?journal rdfs:label ?journalLabel . "
+ " } " + " } "
+ " WHERE { " + " WHERE { "
+ " <" + personURI + "> core:authorInAuthorship ?Resource . " + " <" + personURI + "> core:relatedBy ?Resource . "
+ " ?Resource core:linkedInformationResource ?Document . " + " ?Resource rdf:type core:Authorship . "
+ " ?Resource core:relates ?Document . "
+ " ?Document rdf:type bibo:Document . "
+ " ?Document rdfs:label ?DocumentLabel . " + " ?Document rdfs:label ?DocumentLabel . "
+ " " + " "
+ " OPTIONAL { " + " OPTIONAL { "

View file

@ -50,7 +50,8 @@ public class SubOrganizationWithinModelConstructor implements ModelConstructor {
+ " CONSTRUCT { " + " CONSTRUCT { "
+ " ?organization rdf:type foaf:Organization . " + " ?organization rdf:type foaf:Organization . "
+ " ?organization rdfs:label ?organizationLabel . " + " ?organization rdfs:label ?organizationLabel . "
+ " ?organization core:subOrganizationWithin ?parentOrganization . " + " ?organization <http://purl.obolibrary.org/obo/BFO_0000050> ?parentOrganization . "
+ " ?parentOrganization rdf:type foaf:Organization . "
+ " ?parentOrganization rdfs:label ?parentOrganizationLabel . " + " ?parentOrganization rdfs:label ?parentOrganizationLabel . "
+ " } " + " } "
+ " WHERE { " + " WHERE { "
@ -58,7 +59,8 @@ public class SubOrganizationWithinModelConstructor implements ModelConstructor {
+ " ?organization rdfs:label ?organizationLabel . " + " ?organization rdfs:label ?organizationLabel . "
+ " " + " "
+ " OPTIONAL { " + " OPTIONAL { "
+ " ?organization core:subOrganizationWithin ?parentOrganization . " + " ?organization <http://purl.obolibrary.org/obo/BFO_0000050> ?parentOrganization . "
+ " ?parentOrganization rdf:type foaf:Organization . "
+ " ?parentOrganization rdfs:label ?parentOrganizationLabel . " + " ?parentOrganization rdfs:label ?parentOrganizationLabel . "
+ " } " + " } "
+ " } "; + " } ";

View file

@ -1,162 +1,163 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */ /* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webapp.visualization.personpubcount; package edu.cornell.mannlib.vitro.webapp.visualization.personpubcount;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import com.hp.hpl.jena.iri.IRI; import com.hp.hpl.jena.iri.IRI;
import com.hp.hpl.jena.iri.IRIFactory; import com.hp.hpl.jena.iri.IRIFactory;
import com.hp.hpl.jena.iri.Violation; import com.hp.hpl.jena.iri.Violation;
import com.hp.hpl.jena.query.Dataset; import com.hp.hpl.jena.query.Dataset;
import com.hp.hpl.jena.query.Query; import com.hp.hpl.jena.query.Query;
import com.hp.hpl.jena.query.QueryExecution; import com.hp.hpl.jena.query.QueryExecution;
import com.hp.hpl.jena.query.QueryExecutionFactory; import com.hp.hpl.jena.query.QueryExecutionFactory;
import com.hp.hpl.jena.query.QueryFactory; import com.hp.hpl.jena.query.QueryFactory;
import com.hp.hpl.jena.query.QuerySolution; import com.hp.hpl.jena.query.QuerySolution;
import com.hp.hpl.jena.query.ResultSet; import com.hp.hpl.jena.query.ResultSet;
import com.hp.hpl.jena.query.Syntax; import com.hp.hpl.jena.query.Syntax;
import com.hp.hpl.jena.rdf.model.RDFNode; import com.hp.hpl.jena.rdf.model.RDFNode;
import edu.cornell.mannlib.vitro.webapp.visualization.constants.QueryConstants; import edu.cornell.mannlib.vitro.webapp.visualization.constants.QueryConstants;
import edu.cornell.mannlib.vitro.webapp.visualization.constants.QueryFieldLabels; import edu.cornell.mannlib.vitro.webapp.visualization.constants.QueryFieldLabels;
import edu.cornell.mannlib.vitro.webapp.visualization.exceptions.MalformedQueryParametersException; import edu.cornell.mannlib.vitro.webapp.visualization.exceptions.MalformedQueryParametersException;
import edu.cornell.mannlib.vitro.webapp.visualization.valueobjects.Activity; import edu.cornell.mannlib.vitro.webapp.visualization.valueobjects.Activity;
import edu.cornell.mannlib.vitro.webapp.visualization.valueobjects.Individual; import edu.cornell.mannlib.vitro.webapp.visualization.valueobjects.Individual;
import edu.cornell.mannlib.vitro.webapp.visualization.visutils.QueryRunner; import edu.cornell.mannlib.vitro.webapp.visualization.visutils.QueryRunner;
/** /**
* This query runner is used to execute a sparql query that will fetch all the publications * This query runner is used to execute a sparql query that will fetch all the publications
* defined by bibo:Document property for a particular individual. * defined by bibo:Document property for a particular individual.
* *
* @author cdtank * @author cdtank
*/ */
public class PersonPublicationCountQueryRunner implements QueryRunner<Set<Activity>> { public class PersonPublicationCountQueryRunner implements QueryRunner<Set<Activity>> {
protected static final Syntax SYNTAX = Syntax.syntaxARQ; protected static final Syntax SYNTAX = Syntax.syntaxARQ;
private String personURI; private String personURI;
private Dataset dataset; private Dataset dataset;
private Individual author; private Individual author;
public Individual getAuthor() { public Individual getAuthor() {
return author; return author;
} }
private Log log; private Log log;
private static final String SPARQL_QUERY_COMMON_SELECT_CLAUSE = "" private static final String SPARQL_QUERY_COMMON_SELECT_CLAUSE = ""
+ "SELECT (str(?authorLabel) as ?" + QueryFieldLabels.AUTHOR_LABEL + ") \n" + "SELECT (str(?authorLabel) as ?" + QueryFieldLabels.AUTHOR_LABEL + ") \n"
+ " (str(?document) as ?" + QueryFieldLabels.DOCUMENT_URL + ") \n" + " (str(?document) as ?" + QueryFieldLabels.DOCUMENT_URL + ") \n"
+ " (str(?publicationDate) as ?" + QueryFieldLabels.DOCUMENT_PUBLICATION_DATE + ")\n"; + " (str(?publicationDate) as ?" + QueryFieldLabels.DOCUMENT_PUBLICATION_DATE + ")\n";
private static final String SPARQL_QUERY_COMMON_WHERE_CLAUSE = "" private static final String SPARQL_QUERY_COMMON_WHERE_CLAUSE = ""
+ "?document rdfs:label ?documentLabel .\n" + "?document rdfs:label ?documentLabel .\n"
+ "OPTIONAL { ?document core:dateTimeValue ?dateTimeValue . \n" + "OPTIONAL { ?document core:dateTimeValue ?dateTimeValue . \n"
+ " ?dateTimeValue core:dateTime ?publicationDate } .\n"; + " ?dateTimeValue core:dateTime ?publicationDate } .\n";
public PersonPublicationCountQueryRunner(String personURI, public PersonPublicationCountQueryRunner(String personURI,
Dataset dataset, Log log) { Dataset dataset, Log log) {
this.personURI = personURI; this.personURI = personURI;
this.dataset = dataset; this.dataset = dataset;
this.log = log; this.log = log;
} }
private Set<Activity> createJavaValueObjects(ResultSet resultSet) { private Set<Activity> createJavaValueObjects(ResultSet resultSet) {
Set<Activity> authorDocuments = new HashSet<Activity>(); Set<Activity> authorDocuments = new HashSet<Activity>();
while (resultSet.hasNext()) { while (resultSet.hasNext()) {
QuerySolution solution = resultSet.nextSolution(); QuerySolution solution = resultSet.nextSolution();
Activity biboDocument = new Activity( Activity biboDocument = new Activity(
solution.get(QueryFieldLabels.DOCUMENT_URL) solution.get(QueryFieldLabels.DOCUMENT_URL)
.toString()); .toString());
RDFNode publicationDateNode = solution.get(QueryFieldLabels.DOCUMENT_PUBLICATION_DATE); RDFNode publicationDateNode = solution.get(QueryFieldLabels.DOCUMENT_PUBLICATION_DATE);
if (publicationDateNode != null) { if (publicationDateNode != null) {
biboDocument.setActivityDate(publicationDateNode.toString()); biboDocument.setActivityDate(publicationDateNode.toString());
} }
/* /*
* Since we are getting publication count for just one author at a time we need * Since we are getting publication count for just one author at a time we need
* to create only one "Individual" instance. We test against the null for "author" to * to create only one "Individual" instance. We test against the null for "author" to
* make sure that it has not already been instantiated. * make sure that it has not already been instantiated.
* */ * */
RDFNode authorURLNode = solution.get(QueryFieldLabels.AUTHOR_URL); RDFNode authorURLNode = solution.get(QueryFieldLabels.AUTHOR_URL);
if (authorURLNode != null && author == null) { if (authorURLNode != null && author == null) {
author = new Individual(authorURLNode.toString()); author = new Individual(authorURLNode.toString());
RDFNode authorLabelNode = solution.get(QueryFieldLabels.AUTHOR_LABEL); RDFNode authorLabelNode = solution.get(QueryFieldLabels.AUTHOR_LABEL);
if (authorLabelNode != null) { if (authorLabelNode != null) {
author.setIndividualLabel(authorLabelNode.toString()); author.setIndividualLabel(authorLabelNode.toString());
} }
} }
authorDocuments.add(biboDocument); authorDocuments.add(biboDocument);
} }
return authorDocuments; return authorDocuments;
} }
private ResultSet executeQuery(String queryURI, private ResultSet executeQuery(String queryURI,
Dataset dataset) { Dataset dataset) {
QueryExecution queryExecution = null; QueryExecution queryExecution = null;
Query query = QueryFactory.create(getSparqlQuery(queryURI), SYNTAX); Query query = QueryFactory.create(getSparqlQuery(queryURI), SYNTAX);
queryExecution = QueryExecutionFactory.create(query, dataset); queryExecution = QueryExecutionFactory.create(query, dataset);
return queryExecution.execSelect(); return queryExecution.execSelect();
} }
private String getSparqlQuery(String queryURI) { private String getSparqlQuery(String queryURI) {
String sparqlQuery = QueryConstants.getSparqlPrefixQuery() String sparqlQuery = QueryConstants.getSparqlPrefixQuery()
+ SPARQL_QUERY_COMMON_SELECT_CLAUSE + SPARQL_QUERY_COMMON_SELECT_CLAUSE
+ "(str(<" + queryURI + ">) as ?authPersonLit)\n " + "(str(<" + queryURI + ">) as ?authPersonLit)\n "
+ "WHERE { \n" + "WHERE { \n"
+ "<" + queryURI + "> rdf:type foaf:Person ;\n" + "<" + queryURI + "> rdf:type foaf:Person ;\n"
+ " rdfs:label ?authorLabel \n;" + " rdfs:label ?authorLabel \n;"
+ " core:authorInAuthorship ?authorshipNode . \n" + " core:relatedBy ?authorshipNode . \n"
+ " ?authorshipNode rdf:type core:Authorship ;" + " ?authorshipNode rdf:type core:Authorship ;"
+ " core:linkedInformationResource ?document . \n" + " core:relates ?document . \n"
+ SPARQL_QUERY_COMMON_WHERE_CLAUSE + " ?document rdf:type bibo:Document . \n"
+ "}\n"; + SPARQL_QUERY_COMMON_WHERE_CLAUSE
+ "}\n";
log.debug(sparqlQuery);
log.debug(sparqlQuery);
return sparqlQuery;
} return sparqlQuery;
}
public Set<Activity> getQueryResult()
throws MalformedQueryParametersException { public Set<Activity> getQueryResult()
throws MalformedQueryParametersException {
if (StringUtils.isNotBlank(this.personURI)) {
if (StringUtils.isNotBlank(this.personURI)) {
/*
* To test for the validity of the URI submitted. /*
* */ * To test for the validity of the URI submitted.
IRIFactory iRIFactory = IRIFactory.jenaImplementation(); * */
IRI iri = iRIFactory.create(this.personURI); IRIFactory iRIFactory = IRIFactory.jenaImplementation();
if (iri.hasViolation(false)) { IRI iri = iRIFactory.create(this.personURI);
String errorMsg = ((Violation) iri.violations(false).next()).getShortMessage(); if (iri.hasViolation(false)) {
log.error("Pub Count vis Query " + errorMsg); String errorMsg = ((Violation) iri.violations(false).next()).getShortMessage();
throw new MalformedQueryParametersException( log.error("Pub Count vis Query " + errorMsg);
"URI provided for an individual is malformed."); throw new MalformedQueryParametersException(
} "URI provided for an individual is malformed.");
}
} else {
throw new MalformedQueryParametersException("URL parameter is either null or empty."); } else {
} throw new MalformedQueryParametersException("URL parameter is either null or empty.");
}
ResultSet resultSet = executeQuery(this.personURI,
this.dataset); ResultSet resultSet = executeQuery(this.personURI,
this.dataset);
return createJavaValueObjects(resultSet);
} return createJavaValueObjects(resultSet);
}
}
}

View file

@ -80,8 +80,10 @@ public class OrganizationUtilityFunctions {
String whereClause = "?organization rdf:type foaf:Organization ;" String whereClause = "?organization rdf:type foaf:Organization ;"
+ " rdfs:label ?organizationLabel . \n" + " rdfs:label ?organizationLabel . \n"
+ "OPTIONAL { ?organization core:hasSubOrganization ?subOrg } . \n" + "OPTIONAL { ?organization <http://purl.obolibrary.org/obo/BFO_0000051> ?subOrg . \n"
+ "OPTIONAL { ?organization core:subOrganizationWithin ?parent } . \n" + " ?subOrg rdf:type foaf:Organization } . \n"
+ "OPTIONAL { ?organization <http://purl.obolibrary.org/obo/BFO_0000050> ?parent . \n"
+ " ?parent rdf:type foaf:Organization } . \n"
+ "FILTER ( !bound(?parent) ). \n"; + "FILTER ( !bound(?parent) ). \n";
String groupOrderClause = "GROUP BY ?organization ?organizationLabel \n" String groupOrderClause = "GROUP BY ?organization ?organizationLabel \n"

View file

@ -123,9 +123,10 @@ public class UtilitiesRequestHandler implements VisualizationRequestHandler {
String whereClause = String whereClause =
"<" + individualURI + "> rdf:type foaf:Person ;" "<" + individualURI + "> rdf:type foaf:Person ;"
+ " core:authorInAuthorship ?authorshipNode . \n" + " core:relatedBy ?authorshipNode . \n"
+ "?authorshipNode rdf:type core:Authorship ;" + "?authorshipNode rdf:type core:Authorship ;"
+ " core:linkedInformationResource ?document ."; + " core:relates ?document . \n"
+ "?document rdf:type bibo:Document .";
String groupOrderClause = "GROUP BY ?" + QueryFieldLabels.AUTHOR_URL + " \n"; String groupOrderClause = "GROUP BY ?" + QueryFieldLabels.AUTHOR_URL + " \n";
@ -152,16 +153,22 @@ public class UtilitiesRequestHandler implements VisualizationRequestHandler {
ObjectProperty predicate = ModelUtils.getPropertyForRoleInClass(grantType, vitroRequest.getWebappDaoFactory()); ObjectProperty predicate = ModelUtils.getPropertyForRoleInClass(grantType, vitroRequest.getWebappDaoFactory());
String roleToGrantPredicate = "<" + predicate.getURI() + ">"; String roleToGrantPredicate = "<" + predicate.getURI() + ">";
String whereClause = "{ <" + individualURI + "> rdf:type foaf:Person ;" String whereClause = "{ <" + individualURI + "> rdf:type foaf:Person ;"
+ " core:hasCo-PrincipalInvestigatorRole ?Role . \n" + " <http://purl.obolibrary.org/obo/RO_0000053> ?Role . \n"
+ "?Role rdf:type core:PrincipalInvestigatorRole . \n"
+ "?Role " + roleToGrantPredicate + " ?Grant . }" + "?Role " + roleToGrantPredicate + " ?Grant . }"
+ "UNION \n" + "UNION \n"
+ "{ <" + individualURI + "> rdf:type foaf:Person ;" + "{ <" + individualURI + "> rdf:type foaf:Person ;"
+ " core:hasPrincipalInvestigatorRole ?Role . \n" + " <http://purl.obolibrary.org/obo/RO_0000053> ?Role . \n"
+ "?Role rdf:type core:CoPrincipalInvestigatorRole . \n"
+ "?Role " + roleToGrantPredicate + " ?Grant . }" + "?Role " + roleToGrantPredicate + " ?Grant . }"
+ "UNION \n" + "UNION \n"
+ "{ <" + individualURI + "> rdf:type foaf:Person ;" + "{ <" + individualURI + "> rdf:type foaf:Person ;"
+ " core:hasInvestigatorRole ?Role . \n" + " <http://purl.obolibrary.org/obo/RO_0000053> ?Role . \n"
+ "?Role " + roleToGrantPredicate + " ?Grant . }"; + "?Role rdf:type core:InvestigatorRole. \n"
+ "?Role vitro:mostSpecificType ?subclass . \n"
+ "?Role " + roleToGrantPredicate + " ?Grant . \n"
+ "FILTER (?subclass != core:PrincipalInvestigatorRole && "
+ "?subclass != core:CoPrincipalInvestigatorRole)}";
QueryRunner<ResultSet> numberOfGrantsQueryHandler = QueryRunner<ResultSet> numberOfGrantsQueryHandler =
new GenericQueryRunner(fieldLabelToOutputFieldLabel, new GenericQueryRunner(fieldLabelToOutputFieldLabel,
@ -302,9 +309,11 @@ public class UtilitiesRequestHandler implements VisualizationRequestHandler {
String whereClause = "?organization rdf:type foaf:Organization ;" String whereClause = "?organization rdf:type foaf:Organization ;"
+ " rdfs:label ?organizationLabel . \n" + " rdfs:label ?organizationLabel . \n"
+ "OPTIONAL { ?organization core:hasSubOrganization ?subOrg } . \n" + "OPTIONAL { ?organization core:http://purl.obolibrary.org/obo/BFO_0000051 ?subOrg . \n"
+ "OPTIONAL { ?organization core:subOrganizationWithin ?parent } . \n" + " ?subOrg rdf:type foaf:Organization } . \n"
+ "FILTER ( !bound(?parent) ). \n"; + "OPTIONAL { ?organization core:http://purl.obolibrary.org/obo/BFO_0000050 ?parent } . \n"
+ " ?parent rdf:type foaf:Organization } . \n"
+ "FILTER ( !bound(?parent) ). \n";
String groupOrderClause = "GROUP BY ?organization ?organizationLabel \n" String groupOrderClause = "GROUP BY ?organization ?organizationLabel \n"
+ "ORDER BY DESC(?numOfChildren)\n" + "ORDER BY DESC(?numOfChildren)\n"

View file

@ -1,134 +1,138 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */ /* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webapp.visualization.visutils; package edu.cornell.mannlib.vitro.webapp.visualization.visutils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.Log;
import com.hp.hpl.jena.iri.IRI; import org.apache.commons.logging.LogFactory;
import com.hp.hpl.jena.iri.IRIFactory;
import com.hp.hpl.jena.iri.Violation; import com.hp.hpl.jena.iri.IRI;
import com.hp.hpl.jena.query.Dataset; import com.hp.hpl.jena.iri.IRIFactory;
import com.hp.hpl.jena.query.Query; import com.hp.hpl.jena.iri.Violation;
import com.hp.hpl.jena.query.QueryExecution; import com.hp.hpl.jena.query.Dataset;
import com.hp.hpl.jena.query.QueryExecutionFactory; import com.hp.hpl.jena.query.Query;
import com.hp.hpl.jena.query.QueryFactory; import com.hp.hpl.jena.query.QueryExecution;
import com.hp.hpl.jena.query.QuerySolution; import com.hp.hpl.jena.query.QueryExecutionFactory;
import com.hp.hpl.jena.query.ResultSet; import com.hp.hpl.jena.query.QueryFactory;
import com.hp.hpl.jena.query.Syntax; import com.hp.hpl.jena.query.QuerySolution;
import com.hp.hpl.jena.rdf.model.RDFNode; import com.hp.hpl.jena.query.ResultSet;
import com.hp.hpl.jena.query.Syntax;
import edu.cornell.mannlib.vitro.webapp.visualization.constants.QueryConstants; import com.hp.hpl.jena.rdf.model.RDFNode;
import edu.cornell.mannlib.vitro.webapp.visualization.constants.QueryFieldLabels;
import edu.cornell.mannlib.vitro.webapp.visualization.exceptions.MalformedQueryParametersException; import edu.cornell.mannlib.vitro.webapp.visualization.constants.QueryConstants;
import edu.cornell.mannlib.vitro.webapp.visualization.valueobjects.GenericQueryMap; import edu.cornell.mannlib.vitro.webapp.visualization.constants.QueryFieldLabels;
import edu.cornell.mannlib.vitro.webapp.visualization.exceptions.MalformedQueryParametersException;
import edu.cornell.mannlib.vitro.webapp.visualization.valueobjects.GenericQueryMap;
/**
* This query runner is used to execute a sparql query that will fetch all the
* properties available for the provided individual URI. /**
* * This query runner is used to execute a sparql query that will fetch all the
* @author cdtank * properties available for the provided individual URI.
*/ *
public class AllPropertiesQueryRunner implements QueryRunner<GenericQueryMap> { * @author cdtank
*/
protected static final Syntax SYNTAX = Syntax.syntaxARQ; public class AllPropertiesQueryRunner implements QueryRunner<GenericQueryMap> {
private String filterRule, individualURI; protected static final Syntax SYNTAX = Syntax.syntaxARQ;
private Dataset dataset;
private String filterRule, individualURI;
private Log log; private Dataset dataset;
public AllPropertiesQueryRunner(String individualURI, private Log log = LogFactory.getLog(AllPropertiesQueryRunner.class.getName());
String filterRule,
Dataset dataset, public AllPropertiesQueryRunner(String individualURI,
Log log) { String filterRule,
Dataset dataset,
this.individualURI = individualURI; Log log) {
this.filterRule = filterRule;
this.dataset = dataset; this.individualURI = individualURI;
this.log = log; this.filterRule = filterRule;
this.dataset = dataset;
} this.log = log;
private GenericQueryMap createJavaValueObjects(ResultSet resultSet) { }
GenericQueryMap queryResult = new GenericQueryMap(); private GenericQueryMap createJavaValueObjects(ResultSet resultSet) {
while (resultSet.hasNext()) { GenericQueryMap queryResult = new GenericQueryMap();
QuerySolution solution = resultSet.nextSolution();
while (resultSet.hasNext()) {
QuerySolution solution = resultSet.nextSolution();
RDFNode predicateNode = solution.get(QueryFieldLabels.PREDICATE);
RDFNode objectNode = solution.get(QueryFieldLabels.OBJECT);
RDFNode predicateNode = solution.get(QueryFieldLabels.PREDICATE);
if (predicateNode != null && objectNode != null) { RDFNode objectNode = solution.get(QueryFieldLabels.OBJECT);
queryResult.addEntry(predicateNode.toString(),
objectNode.toString()); if (predicateNode != null && objectNode != null) {
} queryResult.addEntry(predicateNode.toString(),
objectNode.toString());
} }
return queryResult; }
}
return queryResult;
private ResultSet executeQuery(String queryText, }
Dataset dataset) {
private ResultSet executeQuery(String queryText,
QueryExecution queryExecution = null; Dataset dataset) {
Query query = QueryFactory.create(queryText, SYNTAX);
QueryExecution queryExecution = null;
queryExecution = QueryExecutionFactory.create(query, dataset); Query query = QueryFactory.create(queryText, SYNTAX);
return queryExecution.execSelect();
} queryExecution = QueryExecutionFactory.create(query, dataset);
return queryExecution.execSelect();
private String generateGenericSparqlQuery(String queryURI, String filterRule) { }
// Resource uri1 = ResourceFactory.createResource(queryURI);
String filterClause; private String generateGenericSparqlQuery(String queryURI, String filterRule) {
// Resource uri1 = ResourceFactory.createResource(queryURI);
if (StringUtils.isNotBlank(filterRule)) { String filterClause;
filterClause = "FILTER ( " + filterRule + " ) . ";
} else { if (StringUtils.isNotBlank(filterRule)) {
filterClause = ""; filterClause = "FILTER ( " + filterRule + " ) . ";
} } else {
filterClause = "";
String sparqlQuery = QueryConstants.getSparqlPrefixQuery() }
+ "SELECT "
+ " (str(?predicate) as ?" + QueryFieldLabels.PREDICATE + ") " String sparqlQuery = QueryConstants.getSparqlPrefixQuery()
+ " (str(?object) as ?" + QueryFieldLabels.OBJECT + ") " + "SELECT "
+ "WHERE { " + " (str(?predicate) as ?" + QueryFieldLabels.PREDICATE + ") "
+ "<" + queryURI + "> ?predicate ?object. " + " (str(?object) as ?" + QueryFieldLabels.OBJECT + ") "
+ filterClause + "WHERE { "
+ "}"; + "<" + queryURI + "> ?predicate ?object. "
+ filterClause
return sparqlQuery; + "}";
}
log.debug("sparqlQuery = " + sparqlQuery.toString());
public GenericQueryMap getQueryResult()
throws MalformedQueryParametersException { return sparqlQuery;
if (StringUtils.isNotBlank(this.individualURI)) { }
/*
* To test for the validity of the URI submitted. public GenericQueryMap getQueryResult()
* */ throws MalformedQueryParametersException {
IRIFactory iRIFactory = IRIFactory.jenaImplementation(); if (StringUtils.isNotBlank(this.individualURI)) {
IRI iri = iRIFactory.create(this.individualURI); /*
if (iri.hasViolation(false)) { * To test for the validity of the URI submitted.
String errorMsg = ((Violation) iri.violations(false).next()).getShortMessage(); * */
log.error("Generic Query " + errorMsg); IRIFactory iRIFactory = IRIFactory.jenaImplementation();
throw new MalformedQueryParametersException( IRI iri = iRIFactory.create(this.individualURI);
"URI provided for an individual is malformed."); if (iri.hasViolation(false)) {
} String errorMsg = ((Violation) iri.violations(false).next()).getShortMessage();
log.error("Generic Query " + errorMsg);
} else { throw new MalformedQueryParametersException(
throw new MalformedQueryParametersException("URI parameter is either null or empty."); "URI provided for an individual is malformed.");
} }
ResultSet resultSet = executeQuery(generateGenericSparqlQuery( } else {
this.individualURI, throw new MalformedQueryParametersException("URI parameter is either null or empty.");
this.filterRule), }
this.dataset);
ResultSet resultSet = executeQuery(generateGenericSparqlQuery(
return createJavaValueObjects(resultSet); this.individualURI,
} this.filterRule),
} this.dataset);
return createJavaValueObjects(resultSet);
}
}

View file

@ -1,98 +1,104 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */ /* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webapp.visualization.visutils; package edu.cornell.mannlib.vitro.webapp.visualization.visutils;
import java.util.Map; import java.util.Map;
import org.apache.commons.logging.Log;
import com.hp.hpl.jena.query.Dataset; import org.apache.commons.logging.LogFactory;
import com.hp.hpl.jena.query.Query;
import com.hp.hpl.jena.query.QueryExecution; import com.hp.hpl.jena.query.Dataset;
import com.hp.hpl.jena.query.QueryExecutionFactory; import com.hp.hpl.jena.query.Query;
import com.hp.hpl.jena.query.QueryFactory; import com.hp.hpl.jena.query.QueryExecution;
import com.hp.hpl.jena.query.ResultSet; import com.hp.hpl.jena.query.QueryExecutionFactory;
import com.hp.hpl.jena.query.Syntax; import com.hp.hpl.jena.query.QueryFactory;
import com.hp.hpl.jena.query.ResultSet;
import edu.cornell.mannlib.vitro.webapp.visualization.constants.QueryConstants; import com.hp.hpl.jena.query.Syntax;
import edu.cornell.mannlib.vitro.webapp.visualization.exceptions.MalformedQueryParametersException;
import edu.cornell.mannlib.vitro.webapp.visualization.constants.QueryConstants;
import edu.cornell.mannlib.vitro.webapp.visualization.exceptions.MalformedQueryParametersException;
/**
* This query runner is used to run a generic sparql query based on the "select",
* "where" & "filter" rules provided to it. /**
* * This query runner is used to run a generic sparql query based on the "select",
* @author cdtank * "where" & "filter" rules provided to it.
*/ *
public class GenericQueryRunner implements QueryRunner<ResultSet> { * @author cdtank
*/
protected static final Syntax SYNTAX = Syntax.syntaxARQ; public class GenericQueryRunner implements QueryRunner<ResultSet> {
private String whereClause; protected static final Syntax SYNTAX = Syntax.syntaxARQ;
private Dataset dataset;
private String whereClause;
private Map<String, String> fieldLabelToOutputFieldLabel; private Dataset dataset;
private String groupOrderClause; private Map<String, String> fieldLabelToOutputFieldLabel;
private String aggregationRules; private Log log = LogFactory.getLog(GenericQueryRunner.class.getName());
public GenericQueryRunner(Map<String, String> fieldLabelToOutputFieldLabel, private String groupOrderClause;
String aggregationRules,
String whereClause, private String aggregationRules;
String groupOrderClause,
Dataset dataset) { public GenericQueryRunner(Map<String, String> fieldLabelToOutputFieldLabel,
String aggregationRules,
this.fieldLabelToOutputFieldLabel = fieldLabelToOutputFieldLabel; String whereClause,
this.aggregationRules = aggregationRules; String groupOrderClause,
this.whereClause = whereClause; Dataset dataset) {
this.groupOrderClause = groupOrderClause;
this.dataset = dataset; this.fieldLabelToOutputFieldLabel = fieldLabelToOutputFieldLabel;
} this.aggregationRules = aggregationRules;
this.whereClause = whereClause;
private ResultSet executeQuery(String queryText, this.groupOrderClause = groupOrderClause;
Dataset dataset) { this.dataset = dataset;
}
QueryExecution queryExecution = null;
Query query = QueryFactory.create(queryText, SYNTAX); private ResultSet executeQuery(String queryText,
queryExecution = QueryExecutionFactory.create(query, dataset); Dataset dataset) {
return queryExecution.execSelect();
} QueryExecution queryExecution = null;
Query query = QueryFactory.create(queryText, SYNTAX);
private String generateGenericSparqlQuery() { queryExecution = QueryExecutionFactory.create(query, dataset);
return queryExecution.execSelect();
StringBuilder sparqlQuery = new StringBuilder(); }
sparqlQuery.append(QueryConstants.getSparqlPrefixQuery());
private String generateGenericSparqlQuery() {
sparqlQuery.append("SELECT\n");
StringBuilder sparqlQuery = new StringBuilder();
for (Map.Entry<String, String> currentfieldLabelToOutputFieldLabel sparqlQuery.append(QueryConstants.getSparqlPrefixQuery());
: this.fieldLabelToOutputFieldLabel.entrySet()) {
sparqlQuery.append("SELECT\n");
sparqlQuery.append("\t(str(?" + currentfieldLabelToOutputFieldLabel.getKey() + ") as ?"
+ currentfieldLabelToOutputFieldLabel.getValue() + ")\n"); for (Map.Entry<String, String> currentfieldLabelToOutputFieldLabel
: this.fieldLabelToOutputFieldLabel.entrySet()) {
}
sparqlQuery.append("\t(str(?" + currentfieldLabelToOutputFieldLabel.getKey() + ") as ?"
sparqlQuery.append("\n" + this.aggregationRules + "\n"); + currentfieldLabelToOutputFieldLabel.getValue() + ")\n");
sparqlQuery.append("WHERE {\n"); }
sparqlQuery.append(this.whereClause); sparqlQuery.append("\n" + this.aggregationRules + "\n");
sparqlQuery.append("}\n"); sparqlQuery.append("WHERE {\n");
sparqlQuery.append(this.groupOrderClause); sparqlQuery.append(this.whereClause);
return sparqlQuery.toString(); sparqlQuery.append("}\n");
}
sparqlQuery.append(this.groupOrderClause);
public ResultSet getQueryResult()
throws MalformedQueryParametersException { log.debug("sparqlQuery = " + sparqlQuery.toString());
ResultSet resultSet = executeQuery(generateGenericSparqlQuery(), return sparqlQuery.toString();
this.dataset); }
return resultSet; public ResultSet getQueryResult()
} throws MalformedQueryParametersException {
}
ResultSet resultSet = executeQuery(generateGenericSparqlQuery(),
this.dataset);
return resultSet;
}
}

View file

@ -1,97 +1,103 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */ /* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webapp.visualization.visutils; package edu.cornell.mannlib.vitro.webapp.visualization.visutils;
import java.util.Map; import java.util.Map;
import com.hp.hpl.jena.query.Query; import org.apache.commons.logging.Log;
import com.hp.hpl.jena.query.QueryExecution; import org.apache.commons.logging.LogFactory;
import com.hp.hpl.jena.query.QueryExecutionFactory;
import com.hp.hpl.jena.query.QueryFactory; import com.hp.hpl.jena.query.Query;
import com.hp.hpl.jena.query.ResultSet; import com.hp.hpl.jena.query.QueryExecution;
import com.hp.hpl.jena.query.Syntax; import com.hp.hpl.jena.query.QueryExecutionFactory;
import com.hp.hpl.jena.rdf.model.Model; import com.hp.hpl.jena.query.QueryFactory;
import com.hp.hpl.jena.query.ResultSet;
import edu.cornell.mannlib.vitro.webapp.visualization.constants.QueryConstants; import com.hp.hpl.jena.query.Syntax;
import edu.cornell.mannlib.vitro.webapp.visualization.exceptions.MalformedQueryParametersException; import com.hp.hpl.jena.rdf.model.Model;
import edu.cornell.mannlib.vitro.webapp.visualization.constants.QueryConstants;
import edu.cornell.mannlib.vitro.webapp.visualization.exceptions.MalformedQueryParametersException;
/**
* This query runner is used to run a generic sparql query based on the "select",
* "where" & "filter" rules provided to it.
* /**
* @author cdtank * This query runner is used to run a generic sparql query based on the "select",
*/ * "where" & "filter" rules provided to it.
public class GenericQueryRunnerOnModel implements QueryRunner<ResultSet> { *
* @author cdtank
protected static final Syntax SYNTAX = Syntax.syntaxARQ; */
public class GenericQueryRunnerOnModel implements QueryRunner<ResultSet> {
private String whereClause;
private Model model; protected static final Syntax SYNTAX = Syntax.syntaxARQ;
private Map<String, String> fieldLabelToOutputFieldLabel; private String whereClause;
private Model model;
private String groupOrderClause;
private Map<String, String> fieldLabelToOutputFieldLabel;
private String aggregationRules;
private Log log = LogFactory.getLog(GenericQueryRunnerOnModel.class.getName());
public GenericQueryRunnerOnModel(Map<String, String> fieldLabelToOutputFieldLabel,
String aggregationRules, private String groupOrderClause;
String whereClause,
String groupOrderClause, private String aggregationRules;
Model model) {
public GenericQueryRunnerOnModel(Map<String, String> fieldLabelToOutputFieldLabel,
this.fieldLabelToOutputFieldLabel = fieldLabelToOutputFieldLabel; String aggregationRules,
this.aggregationRules = aggregationRules; String whereClause,
this.whereClause = whereClause; String groupOrderClause,
this.groupOrderClause = groupOrderClause; Model model) {
this.model = model;
} this.fieldLabelToOutputFieldLabel = fieldLabelToOutputFieldLabel;
this.aggregationRules = aggregationRules;
private ResultSet executeQuery(String queryText, this.whereClause = whereClause;
Model dataset) { this.groupOrderClause = groupOrderClause;
this.model = model;
QueryExecution queryExecution = null; }
Query query = QueryFactory.create(queryText, SYNTAX);
queryExecution = QueryExecutionFactory.create(query, dataset); private ResultSet executeQuery(String queryText,
return queryExecution.execSelect(); Model dataset) {
}
QueryExecution queryExecution = null;
private String generateGenericSparqlQuery() { Query query = QueryFactory.create(queryText, SYNTAX);
queryExecution = QueryExecutionFactory.create(query, dataset);
StringBuilder sparqlQuery = new StringBuilder(); return queryExecution.execSelect();
sparqlQuery.append(QueryConstants.getSparqlPrefixQuery()); }
sparqlQuery.append("SELECT\n"); private String generateGenericSparqlQuery() {
for (Map.Entry<String, String> currentfieldLabelToOutputFieldLabel StringBuilder sparqlQuery = new StringBuilder();
: this.fieldLabelToOutputFieldLabel.entrySet()) { sparqlQuery.append(QueryConstants.getSparqlPrefixQuery());
sparqlQuery.append("\t(str(?" + currentfieldLabelToOutputFieldLabel.getKey() + ") as ?" sparqlQuery.append("SELECT\n");
+ currentfieldLabelToOutputFieldLabel.getValue() + ")\n");
for (Map.Entry<String, String> currentfieldLabelToOutputFieldLabel
} : this.fieldLabelToOutputFieldLabel.entrySet()) {
sparqlQuery.append("\n" + this.aggregationRules + "\n"); sparqlQuery.append("\t(str(?" + currentfieldLabelToOutputFieldLabel.getKey() + ") as ?"
+ currentfieldLabelToOutputFieldLabel.getValue() + ")\n");
sparqlQuery.append("WHERE {\n");
}
sparqlQuery.append(this.whereClause);
sparqlQuery.append("\n" + this.aggregationRules + "\n");
sparqlQuery.append("}\n");
sparqlQuery.append("WHERE {\n");
sparqlQuery.append(this.groupOrderClause);
sparqlQuery.append(this.whereClause);
return sparqlQuery.toString();
} sparqlQuery.append("}\n");
public ResultSet getQueryResult() sparqlQuery.append(this.groupOrderClause);
throws MalformedQueryParametersException {
log.debug("sparqlQuery = " + sparqlQuery.toString());
ResultSet resultSet = executeQuery(generateGenericSparqlQuery(), return sparqlQuery.toString();
this.model); }
return resultSet; public ResultSet getQueryResult()
} throws MalformedQueryParametersException {
}
ResultSet resultSet = executeQuery(generateGenericSparqlQuery(),
this.model);
return resultSet;
}
}

View file

@ -435,8 +435,8 @@ check_grants_to_exclude = Check those grants and projects you want to exclude fr
manage_affiliated_people = Manage People Affiliated with manage_affiliated_people = Manage People Affiliated with
check_people_to_exclude = Check those people you want to exclude from the profile page. check_people_to_exclude = Check those people you want to exclude from the profile page.
manage_grants = Manage grants for manage_publications_for = Manage Publications for
check_pubs_to_exclude = Check those grants you want to exclude from the profile page. check_pubs_to_exclude = Check those publications you want to exclude from the profile page.
manage_web_pages = Manage Web Pages manage_web_pages = Manage Web Pages
has_no_webpages = This individual currently has no web pages specified. Add a new web page by clicking on the button below. has_no_webpages = This individual currently has no web pages specified. Add a new web page by clicking on the button below.
@ -840,3 +840,6 @@ full_name = Full name
full_name_for = full name for full_name_for = full name for
first_name = First name first_name = First name
last_name = Last name last_name = Last name
title_not_found = Title not found.
speeches_capitalized = Speeches
theses_capitalized = Theses

View file

@ -148,4 +148,3 @@ ${scripts.add('<script type="text/javascript" src="${urls.base}/js/individual/in
'<script type="text/javascript" src="${urls.base}/js/individual/individualUriRdf.js"></script>', '<script type="text/javascript" src="${urls.base}/js/individual/individualUriRdf.js"></script>',
'<script type="text/javascript" src="${urls.base}/js/jquery-ui/js/jquery-ui-1.8.9.custom.min.js"></script>', '<script type="text/javascript" src="${urls.base}/js/jquery-ui/js/jquery-ui-1.8.9.custom.min.js"></script>',
'<script type="text/javascript" src="${urls.base}/js/imageUpload/imageUploadUtils.js"></script>')} '<script type="text/javascript" src="${urls.base}/js/imageUpload/imageUploadUtils.js"></script>')}