Merge branch 'maint-rel-1.6' into develop

This commit is contained in:
hudajkhan 2013-11-11 18:43:24 -05:00
commit c832112628
18 changed files with 14689 additions and 14529 deletions

View file

@ -42,3 +42,5 @@
<http://vitro.mannlib.cornell.edu/ns/vitro/siteConfig/hasLeaderRoleConfig> <http://vitro.mannlib.cornell.edu/ns/vitro/ApplicationConfiguration#displayName> "jefe de"@es . <http://vitro.mannlib.cornell.edu/ns/vitro/siteConfig/hasLeaderRoleConfig> <http://vitro.mannlib.cornell.edu/ns/vitro/ApplicationConfiguration#displayName> "jefe de"@es .
<http://vitro.mannlib.cornell.edu/ns/vitro/siteConfig/hasMemberRoleConfig> <http://vitro.mannlib.cornell.edu/ns/vitro/ApplicationConfiguration#displayName> "miembro de"@es . <http://vitro.mannlib.cornell.edu/ns/vitro/siteConfig/hasMemberRoleConfig> <http://vitro.mannlib.cornell.edu/ns/vitro/ApplicationConfiguration#displayName> "miembro de"@es .
<http://vitro.mannlib.cornell.edu/ns/vitro/siteConfig/personTelephoneConfig> <http://vitro.mannlib.cornell.edu/ns/vitro/ApplicationConfiguration#displayName> "tel\u00E9fono"@es . <http://vitro.mannlib.cornell.edu/ns/vitro/siteConfig/personTelephoneConfig> <http://vitro.mannlib.cornell.edu/ns/vitro/ApplicationConfiguration#displayName> "tel\u00E9fono"@es .
<http://vitro.mannlib.cornell.edu/ns/vitro/siteConfig/hasSubOrganizationConfig> <http://vitro.mannlib.cornell.edu/ns/vitro/ApplicationConfiguration#displayName> "tiene sub-organización"@es .
<http://vitro.mannlib.cornell.edu/ns/vitro/siteConfig/subOrganizationWithinConfig> <http://vitro.mannlib.cornell.edu/ns/vitro/ApplicationConfiguration#displayName> "organización dentro de"@es .

View file

@ -120,6 +120,7 @@ missing_info_resource = falta de recursos de información
award_receipt_name = Nombre del premio recibido award_receipt_name = Nombre del premio recibido
award_name = Nombre del premio award_name = Nombre del premio
conferred_by = conferida por conferred_by = conferida por
conferred_on = conferida a
selected_award = Premio Seleccionado selected_award = Premio Seleccionado
incomplete_date_time_interval = intervalo de la fecha / hora incompleta incomplete_date_time_interval = intervalo de la fecha / hora incompleta

View file

@ -0,0 +1,136 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
<!-- See guidelines in vitro/doc/list_view_configuration_guidelines.txt -->
<list-view-config>
<query-select>
PREFIX foaf: &lt;http://xmlns.com/foaf/0.1/&gt;
PREFIX afn: &lt;http://jena.hpl.hp.com/ARQ/function#&gt;
PREFIX bibo: &lt;http://purl.org/ontology/bibo/&gt;
PREFIX core: &lt;http://vivoweb.org/ontology/core#&gt;
PREFIX owl: &lt;http://www.w3.org/2002/07/owl#&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;
SELECT DISTINCT ?awardReceipt
?receiptLabel
?award
?awardLabel
?givenTo
?givenToLabel
?dateTimeStart
?dateTimeEnd
?dateTime
WHERE {
?subject ?property ?awardReceipt .
?awardReceipt a core:AwardReceipt .
OPTIONAL { ?awardReceipt rdfs:label ?receiptLabel }
OPTIONAL { ?awardReceipt core:relates ?award .
?award a core:Award .
?award core:relatedBy ?awardReceipt .
?award rdfs:label ?awardLabel
}
OPTIONAL { ?awardReceipt core:relates ?givenTo .
?givenTo rdfs:label ?givenToLabel
}
OPTIONAL { ?awardReceipt core:dateTimeInterval ?dateTimeInterval .
?dateTimeInterval core:start ?dateTimeStartValue .
?dateTimeStartValue core:dateTime ?dateTimeStart
}
OPTIONAL { ?awardReceipt core:dateTimeInterval ?dateTimeInterval .
?dateTimeInterval core:end ?dateTimeEndValue .
?dateTimeEndValue core:dateTime ?dateTimeEnd
}
OPTIONAL { ?awardReceipt core:dateTimeValue ?dateTimeValue .
?dateTimeValue core:dateTime ?dateTime
}
} ORDER BY DESC(?dateTime) DESC(?dateTimeEnd)
</query-select>
<query-construct>
PREFIX bibo: &lt;http://purl.org/ontology/bibo/&gt;
PREFIX core: &lt;http://vivoweb.org/ontology/core#&gt;
PREFIX rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt;
PREFIX foaf: &lt;http://xmlns.com/foaf/0.1/&gt;
CONSTRUCT {
?subject ?property ?awardReceipt .
?awardReceipt a core:AwardReceipt .
?awardReceipt rdfs:label ?receiptLabel .
?awardReceipt core:relates ?award .
?award a core:Award .
?award core:relatedBy ?awardReceipt .
?award rdfs:label ?awardLabel .
?awardReceipt core:relates ?givenTo .
?givenTo rdfs:label ?givenToLabel .
?awardReceipt core:dateTimeValue ?dateTimeValue .
?dateTimeValue core:dateTime ?dateTime
} WHERE {
{
?subject ?property ?awardReceipt .
?awardReceipt a core:AwardReceipt .
} UNION {
?subject ?property ?awardReceipt .
?awardReceipt a core:AwardReceipt .
?awardReceipt rdfs:label ?receiptLabel
} UNION {
?subject ?property ?awardReceipt .
?awardReceipt a core:AwardReceipt .
?awardReceipt rdfs:label ?receiptLabel .
?awardReceipt core:relates ?award .
?award a core:Award .
?award core:relatedBy ?awardReceipt .
?award rdfs:label ?awardLabel
} UNION {
?subject ?property ?awardReceipt .
?awardReceipt a core:AwardReceipt .
?awardReceipt rdfs:label ?receiptLabel .
?awardReceipt core:relates ?givenTo .
?givenTo a foaf:Person .
?givenTo rdfs:label ?givenToLabel
} UNION {
?subject ?property ?awardReceipt .
?awardReceipt a core:AwardReceipt .
?awardReceipt core:dateTimeValue ?dateTimeValue .
?dateTimeValue core:dateTime ?dateTime
}
}
</query-construct>
<query-construct>
PREFIX core: &lt;http://vivoweb.org/ontology/core#&gt;
CONSTRUCT {
?subject ?property ?awardReceipt .
?awardReceipt a core:AwardReceipt .
?awardReceipt core:dateTimeInterval ?dateTimeInterval .
?dateTimeInterval core:start ?dateTimeStartValue .
?dateTimeStartValue core:dateTime ?dateTimeStart
} WHERE {
?subject ?property ?awardReceipt .
?awardReceipt a core:AwardReceipt .
?awardReceipt core:dateTimeInterval ?dateTimeInterval .
?dateTimeInterval core:start ?dateTimeStartValue .
?dateTimeStartValue core:dateTime ?dateTimeStart
}
</query-construct>
<query-construct>
PREFIX core: &lt;http://vivoweb.org/ontology/core#&gt;
CONSTRUCT {
?subject ?property ?awardReceipt .
?awardReceipt a core:AwardReceipt .
?awardReceipt core:dateTimeInterval ?dateTimeInterval .
?dateTimeInterval core:end ?dateTimeEndValue .
?dateTimeEndValue core:dateTime ?dateTimeEnd
} WHERE {
?subject ?property ?awardReceipt .
?awardReceipt a core:AwardReceipt .
?awardReceipt core:dateTimeInterval ?dateTimeInterval .
?dateTimeInterval core:end ?dateTimeEndValue .
?dateTimeEndValue core:dateTime ?dateTimeEnd
}
</query-construct>
<template>propStatement-awardOrHonorGiven.ftl</template>
</list-view-config>

View file

@ -0,0 +1,40 @@
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
<#-- Custom object property statement view for faux property "awards and honors". See the PropertyConfig.3 file for details.
This template must be self-contained and not rely on other variables set for the individual page, because it
is also used to generate the property statement during a deletion.
-->
<#import "lib-sequence.ftl" as s>
<#import "lib-datetime.ftl" as dt>
<@showAward statement />
<#-- Use a macro to keep variable assignments local; otherwise the values carry over to the
next statement -->
<#macro showAward statement>
<#local linkedIndividual>
<#if statement.award??>
<a href="${profileUrl(statement.uri("award"))}" title="${i18n().award_name}">${statement.awardLabel!}</a>
<#else>
<a href="${profileUrl(statement.uri("awardReceipt"))}" title="${i18n().award_receipt_name}">${statement.receiptLabel!}</a>
</#if>
</#local>
<#local dateTimeVal>
<#if statement.dateTime??>
<@dt.yearSpan statement.dateTime! />
<#else>
<@dt.yearIntervalSpan "${statement.dateTimeStart!}" "${statement.dateTimeEnd!}" />
</#if>
</#local>
<#local conferredOn>
<#if statement.givenTo?has_content && statement.givenToLabel?has_content>
${i18n().conferred_on} <a href="${profileUrl(statement.uri("givenTo"))}" title="${i18n().conferred_on}">${statement.givenToLabel}</a>
</#if>
</#local>
<@s.join [ linkedIndividual, conferredOn!, dateTimeVal! ] />
</#macro>

View file

@ -76,7 +76,7 @@
</p> </p>
<p> <p>
<label for="streetAddress">${i18n().street_address} 2 ${requiredHint}</label> <label for="streetAddress">${i18n().street_address} 2</label>
<input size="40" type="text" id="streetAddressTwo" name="streetAddressTwo" value="" /> <input size="40" type="text" id="streetAddressTwo" name="streetAddressTwo" value="" />
<input type="hidden" id="streetAddress" name="streetAddress" value="${streetAddressValue}" /> <input type="hidden" id="streetAddress" name="streetAddress" value="${streetAddressValue}" />
</p> </p>

View file

@ -25,7 +25,7 @@
<#if webpage?has_content> <#-- true when the property is in the list, even if not populated (when editing) --> <#if webpage?has_content> <#-- true when the property is in the list, even if not populated (when editing) -->
<nav role="navigation"> <nav role="navigation">
<#local label = "Websites"> <#local label = "${i18n().websites}">
<@p.addLinkWithLabel webpage editable label /> <@p.addLinkWithLabel webpage editable label />
<#if webpage.statements?has_content> <#-- if there are any statements --> <#if webpage.statements?has_content> <#-- if there are any statements -->
<#include "individual-webpage.ftl" > <#include "individual-webpage.ftl" >

View file

@ -41,6 +41,8 @@ local:organizationForPositionConfig a :ObjectPropertyDisplayConfig ;
:displayName "people" ; :displayName "people" ;
:listViewConfigFile "listViewConfig-organizationForPosition.xml"^^xsd:string ; :listViewConfigFile "listViewConfig-organizationForPosition.xml"^^xsd:string ;
:propertyGroup <http://vivoweb.org/ontology#vitroPropertyGroupaffiliation> ; :propertyGroup <http://vivoweb.org/ontology#vitroPropertyGroupaffiliation> ;
vitro:collateBySubclassAnnot
"true"^^xsd:boolean;
vitro:displayRankAnnot 10; vitro:displayRankAnnot 10;
vitro:hiddenFromDisplayBelowRoleLevelAnnot role:public ; vitro:hiddenFromDisplayBelowRoleLevelAnnot role:public ;
vitro:prohibitedFromUpdateBelowRoleLevelAnnot role:public ; vitro:prohibitedFromUpdateBelowRoleLevelAnnot role:public ;
@ -921,6 +923,20 @@ local:awardReceiptsAwardForConfig a :ObjectPropertyDisplayConfig ;
vitro:prohibitedFromUpdateBelowRoleLevelAnnot role:public ; vitro:prohibitedFromUpdateBelowRoleLevelAnnot role:public ;
:propertyGroup <http://vivoweb.org/ontology#vitroPropertyGroupoverview> . :propertyGroup <http://vivoweb.org/ontology#vitroPropertyGroupoverview> .
local:awardOrHonorGivenContext a :ConfigContext ;
:hasConfiguration local:awardOrHonorGivenConfig ;
:configContextFor <http://vivoweb.org/ontology/core#assigns> ;
:qualifiedByDomain <http://xmlns.com/foaf/0.1/Organization> ;
:qualifiedBy <http://vivoweb.org/ontology/core#AwardReceipt> .
local:awardOrHonorGivenConfig a :ObjectPropertyDisplayConfig ;
:listViewConfigFile "listViewConfig-awardOrHonorGiven.xml"^^xsd:string ;
:displayName "award or honor given" ;
vitro:displayRankAnnot 72;
vitro:hiddenFromDisplayBelowRoleLevelAnnot role:public ;
vitro:prohibitedFromUpdateBelowRoleLevelAnnot role:public ;
:propertyGroup <http://vivoweb.org/ontology#vitroPropertyGroupoverview> .
local:addressLocationContext a :ConfigContext ; local:addressLocationContext a :ConfigContext ;
:hasConfiguration local:addressLocationConfig ; :hasConfiguration local:addressLocationConfig ;
:configContextFor <http://purl.obolibrary.org/obo/RO_0001025> ; :configContextFor <http://purl.obolibrary.org/obo/RO_0001025> ;

View file

@ -5088,6 +5088,8 @@ vivo:termLabel
skos:related skos:related
rdfs:label "related"@en-US ; rdfs:label "related"@en-US ;
vitro:customEntryFormAnnot
"edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.AddConceptThroughObjectPropertyGenerator"^^xsd:string ;
vitro:displayLimitAnnot vitro:displayLimitAnnot
"5"^^xsd:int ; "5"^^xsd:int ;
vitro:displayRankAnnot vitro:displayRankAnnot

View file

@ -240,11 +240,22 @@ public class AddEditWebpageFormGenerator extends BaseEditConfigurationGenerator
private String getUrlPatternToReturnTo(VitroRequest vreq) { private String getUrlPatternToReturnTo(VitroRequest vreq) {
String subjectUri = EditConfigurationUtils.getSubjectUri(vreq); String subjectUri = EditConfigurationUtils.getSubjectUri(vreq);
String predicateUri = EditConfigurationUtils.getPredicateUri(vreq); String predicateUri = EditConfigurationUtils.getPredicateUri(vreq);
//Also add domain and range uris if they exist to enable cancel to work properly
String domainUri = (String) vreq.getParameter("domainUri");
String rangeUri = (String) vreq.getParameter("rangeUri");
String generatorName = "edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.ManageWebpagesForIndividualGenerator"; String generatorName = "edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.ManageWebpagesForIndividualGenerator";
String editUrl = EditConfigurationUtils.getEditUrlWithoutContext(vreq); String editUrl = EditConfigurationUtils.getEditUrlWithoutContext(vreq);
return editUrl + "?subjectUri=" + UrlBuilder.urlEncode(subjectUri) + String returnPath = editUrl + "?subjectUri=" + UrlBuilder.urlEncode(subjectUri) +
"&predicateUri=" + UrlBuilder.urlEncode(predicateUri) + "&predicateUri=" + UrlBuilder.urlEncode(predicateUri) +
"&editForm=" + UrlBuilder.urlEncode(generatorName); "&editForm=" + UrlBuilder.urlEncode(generatorName);
if(domainUri != null && !domainUri.isEmpty()) {
returnPath += "&domainUri=" + UrlBuilder.urlEncode(domainUri);
}
if(rangeUri != null && !rangeUri.isEmpty()) {
returnPath += "&rangeUri=" + UrlBuilder.urlEncode(rangeUri);
}
return returnPath;
} }
private String getLinkUri(VitroRequest vreq) { private String getLinkUri(VitroRequest vreq) {

View file

@ -35,6 +35,7 @@ public class AddOutreachProviderRoleToPersonGenerator extends AddRoleToPersonTwo
"http://vivoweb.org/ontology/core#CoreLaboratory","Core Laboratory", "http://vivoweb.org/ontology/core#CoreLaboratory","Core Laboratory",
"http://vivoweb.org/ontology/core#Department","Department", "http://vivoweb.org/ontology/core#Department","Department",
"http://vivoweb.org/ontology/core#Division","Division", "http://vivoweb.org/ontology/core#Division","Division",
"http://purl.org/NET/c4dm/event.owl#Event","Event",
"http://vivoweb.org/ontology/core#ExtensionUnit","Extension Unit", "http://vivoweb.org/ontology/core#ExtensionUnit","Extension Unit",
"http://vivoweb.org/ontology/core#Foundation","Foundation", "http://vivoweb.org/ontology/core#Foundation","Foundation",
"http://vivoweb.org/ontology/core#FundingOrganization","Funding Organization", "http://vivoweb.org/ontology/core#FundingOrganization","Funding Organization",

View file

@ -12,26 +12,21 @@ 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.ontology.OntModel;
import com.hp.hpl.jena.query.Query;
import com.hp.hpl.jena.query.QueryExecution;
import com.hp.hpl.jena.query.QueryExecutionFactory;
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.QuerySolutionMap; import com.hp.hpl.jena.query.QuerySolutionMap;
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.rdf.model.RDFNode; import com.hp.hpl.jena.rdf.model.RDFNode;
import com.hp.hpl.jena.rdf.model.Resource; import com.hp.hpl.jena.rdf.model.Resource;
import com.hp.hpl.jena.rdf.model.ResourceFactory; import com.hp.hpl.jena.rdf.model.ResourceFactory;
import com.hp.hpl.jena.rdf.model.Statement; import com.hp.hpl.jena.rdf.model.Statement;
import com.hp.hpl.jena.shared.Lock;
import edu.cornell.mannlib.vitro.webapp.dao.jena.QueryUtils;
import edu.cornell.mannlib.vitro.webapp.rdfservice.RDFService;
import edu.cornell.mannlib.vitro.webapp.search.beans.StatementToURIsToUpdate; import edu.cornell.mannlib.vitro.webapp.search.beans.StatementToURIsToUpdate;
public class AdditionalURIsForContextNodes implements StatementToURIsToUpdate { public class AdditionalURIsForContextNodes implements StatementToURIsToUpdate {
private OntModel model; private final RDFService rdfService;
private Set<String> alreadyChecked; private Set<String> alreadyChecked;
private long accumulatedTime = 0; private long accumulatedTime = 0;
@ -43,8 +38,8 @@ public class AdditionalURIsForContextNodes implements StatementToURIsToUpdate {
private Log log = LogFactory.getLog(AdditionalURIsForContextNodes.class); private Log log = LogFactory.getLog(AdditionalURIsForContextNodes.class);
public AdditionalURIsForContextNodes( OntModel jenaOntModel){ public AdditionalURIsForContextNodes( RDFService rdfService){
this.model = jenaOntModel; this.rdfService = rdfService;
} }
@Override @Override
@ -93,42 +88,27 @@ public class AdditionalURIsForContextNodes implements StatementToURIsToUpdate {
List<String> uriList = new ArrayList<String>(); List<String> uriList = new ArrayList<String>();
for(String query : queryList){ for (String query : queryList) {
QuerySolutionMap initialBinding = new QuerySolutionMap();
Resource uriResource = ResourceFactory.createResource(uri);
initialBinding.add("uri", uriResource);
//log.info("Executing query: "+ query); ResultSet results = QueryUtils.getQueryResults(query,
initialBinding, rdfService);
QuerySolutionMap initialBinding = new QuerySolutionMap(); while (results.hasNext()) {
Resource uriResource = ResourceFactory.createResource(uri); QuerySolution soln = results.nextSolution();
initialBinding.add("uri", uriResource); Iterator<String> iter = soln.varNames();
while (iter.hasNext()) {
Query sparqlQuery = QueryFactory.create( query, Syntax.syntaxARQ); String name = iter.next();
model.getLock().enterCriticalSection(Lock.READ); RDFNode node = soln.get(name);
try{ if (node != null) {
QueryExecution qExec = QueryExecutionFactory.create(sparqlQuery, model, initialBinding); uriList.add("" + node.toString());
try{ } else {
ResultSet results = qExec.execSelect(); log.debug(name + " is null");
while(results.hasNext()){ }
QuerySolution soln = results.nextSolution(); }
Iterator<String> iter = soln.varNames() ; }
while( iter.hasNext()){ }
String name = iter.next();
RDFNode node = soln.get( name );
if( node != null ){
uriList.add("" + node.toString());
}else{
log.debug(name + " is null");
}
}
}
}catch(Throwable t){
log.error(t,t);
} finally{
qExec.close();
}
}finally{
model.getLock().leaveCriticalSection();
}
}
if( log.isDebugEnabled() ) if( log.isDebugEnabled() )
log.debug( "additional uris for " + uri + " are " + uriList); log.debug( "additional uris for " + uri + " are " + uriList);

View file

@ -5,9 +5,8 @@ package edu.cornell.mannlib.vitro.webapp.search.indexing;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import com.hp.hpl.jena.ontology.OntModel;
import edu.cornell.mannlib.vitro.webapp.dao.IndividualDao; import edu.cornell.mannlib.vitro.webapp.dao.IndividualDao;
import edu.cornell.mannlib.vitro.webapp.rdfservice.RDFService;
import edu.cornell.mannlib.vitro.webapp.search.beans.StatementToURIsToUpdate; import edu.cornell.mannlib.vitro.webapp.search.beans.StatementToURIsToUpdate;
/** /**
@ -16,12 +15,12 @@ import edu.cornell.mannlib.vitro.webapp.search.beans.StatementToURIsToUpdate;
*/ */
public class AdditionalUriFinders { public class AdditionalUriFinders {
public static List<StatementToURIsToUpdate> getList(OntModel jenaOntModel, public static List<StatementToURIsToUpdate> getList(RDFService rdfService,
IndividualDao indDao) { IndividualDao indDao) {
List<StatementToURIsToUpdate> uriFinders = new ArrayList<>(); List<StatementToURIsToUpdate> uriFinders = new ArrayList<>();
uriFinders.add(new AdditionalURIsForDataProperties()); uriFinders.add(new AdditionalURIsForDataProperties());
uriFinders.add(new AdditionalURIsForObjectProperties(jenaOntModel)); uriFinders.add(new AdditionalURIsForObjectProperties(rdfService));
uriFinders.add(new AdditionalURIsForContextNodes(jenaOntModel)); uriFinders.add(new AdditionalURIsForContextNodes(rdfService));
uriFinders.add(new AdditionalURIsForTypeStatements()); uriFinders.add(new AdditionalURIsForTypeStatements());
uriFinders.add(new URIsForClassGroupChange(indDao)); uriFinders.add(new URIsForClassGroupChange(indDao));
return uriFinders; return uriFinders;

View file

@ -29,7 +29,8 @@ public class VivoAgentContextNodeFields extends ContextNodeFields{
+ " prefix foaf: <http://xmlns.com/foaf/0.1/> " + " prefix foaf: <http://xmlns.com/foaf/0.1/> "
+ " prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> " + " prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> "
+ " prefix localNav: <http://vitro.mannlib.cornell.edu/ns/localnav#> " + " prefix localNav: <http://vitro.mannlib.cornell.edu/ns/localnav#> "
+ " prefix bibo: <http://purl.org/ontology/bibo/> "; + " prefix bibo: <http://purl.org/ontology/bibo/> "
+ " prefix obo: <http://purl.obolibrary.org/obo/> \n" ;
//queries for foaf:Agent //queries for foaf:Agent
@ -49,14 +50,9 @@ public class VivoAgentContextNodeFields extends ContextNodeFields{
" ?uri rdf:type foaf:Agent . " + " ?uri rdf:type foaf:Agent . " +
" ?uri ?b ?c . " + " ?uri ?b ?c . " +
" ?c rdf:type core:Position . " + " ?c rdf:type core:Position . " +
" ?c core:involvedOrganizationName ?ContextNodeProperty . }"); " ?c core:relates ?i . " +
" ?i rdf:type foaf:Organization . " +
queriesForAgent.add(prefix + "SELECT " + " ?i rdfs:label ?ContextNodeProperty . }");
"(str(?ContextNodeProperty) as ?contextNodeProperty) WHERE {" +
" ?uri rdf:type foaf:Agent . " +
" ?uri ?b ?c . " +
" ?c rdf:type core:Position . " +
" ?c core:positionInOrganization ?i . ?i rdfs:label ?ContextNodeProperty . }");
queriesForAgent.add(prefix + "SELECT " + queriesForAgent.add(prefix + "SELECT " +
"(str(?ContextNodeProperty) as ?contextNodeProperty) WHERE {" + "(str(?ContextNodeProperty) as ?contextNodeProperty) WHERE {" +
@ -70,7 +66,6 @@ public class VivoAgentContextNodeFields extends ContextNodeFields{
queriesForAgent.add(prefix + queriesForAgent.add(prefix +
"SELECT " + "SELECT " +
"(str(?HRJobTitle) as ?hrJobTitle) " + "(str(?HRJobTitle) as ?hrJobTitle) " +
"(str(?InvolvedOrganizationName) as ?involvedOrganizationName) " +
"(str(?PositionInOrganization) as ?positionInOrganization) " + "(str(?PositionInOrganization) as ?positionInOrganization) " +
"(str(?TitleOrRole) as ?titleOrRole) WHERE {" "(str(?TitleOrRole) as ?titleOrRole) WHERE {"
@ -78,8 +73,7 @@ public class VivoAgentContextNodeFields extends ContextNodeFields{
+ " ?c rdf:type core:Position . " + " ?c rdf:type core:Position . "
+ " OPTIONAL { ?c core:hrJobTitle ?HRJobTitle . } . " + " OPTIONAL { ?c core:hrJobTitle ?HRJobTitle . } . "
+ " OPTIONAL { ?c core:involvedOrganizationName ?InvolvedOrganizationName . } ." + " OPTIONAL { ?c core:relates ?i . ?i rdf:type foaf:Organization . ?i rdfs:label ?PositionInOrganization . } . "
+ " OPTIONAL { ?c core:positionInOrganization ?i . ?i rdfs:label ?PositionInOrganization . } . "
+ " OPTIONAL { ?c core:titleOrRole ?TitleOrRole . } . " + " OPTIONAL { ?c core:titleOrRole ?TitleOrRole . } . "
+ " }"); + " }");
@ -88,36 +82,49 @@ public class VivoAgentContextNodeFields extends ContextNodeFields{
queriesForAgent.add(prefix + "SELECT " + queriesForAgent.add(prefix + "SELECT " +
"(str(?ContextNodeProperty) as ?contextNodeProperty) WHERE {" + "(str(?ContextNodeProperty) as ?contextNodeProperty) WHERE {" +
" ?uri rdf:type foaf:Agent ; ?b ?c . " + " ?uri rdf:type foaf:Agent ; ?b ?c . " +
" ?c rdf:type core:Relationship . " + " ?c rdf:type core:AdvisingRelationship . " +
" ?c core:advisee ?d . ?d rdfs:label ?ContextNodeProperty . }"); " ?c rdfs:label ?ContextNodeProperty . }");
queriesForAgent.add(prefix + "SELECT " + queriesForAgent.add(prefix + "SELECT " +
"(str(?ContextNodeProperty) as ?contextNodeProperty) WHERE {" + "(str(?ContextNodeProperty) as ?contextNodeProperty) WHERE {" +
" ?uri rdf:type foaf:Agent ; ?b ?c . " + " ?uri rdf:type foaf:Agent ; ?b ?c . " +
" ?c rdf:type core:Relationship . " + " ?c rdf:type core:AdvisingRelationship . " +
" ?c core:degreeCandidacy ?e . ?e rdfs:label ?ContextNodeProperty . }"); " ?c core:degreeCandidacy ?e . ?e rdfs:label ?ContextNodeProperty . }");
queriesForAgent.add(prefix + "SELECT " + queriesForAgent.add(prefix + "SELECT " +
"(str(?label) as ?adviseeLabel) WHERE {" + "(str(?label) as ?adviseeLabel) WHERE {" +
" ?uri rdf:type foaf:Agent ." + " ?uri rdf:type foaf:Agent ." +
" ?c rdf:type core:Relationship . " + " ?c rdf:type core:AdvisingRelationship . " +
" ?c core:advisor ?uri . " + " ?c core:relates ?uri . " +
" ?c core:advisee ?d . ?d rdfs:label ?label .}" ); " ?uri obo:RO_0000053 ?advisorRole . " +
" ?advisorRole rdf:type core:AdvisorRole . " +
" ?c core:relates ?d . " +
" ?d rdf:type foaf:Person . " +
" ?d obo:RO_0000053 ?adviseeRole . " +
" ?adviseeRole rdf:type core:AdviseeRole . " +
" ?d rdfs:label ?ContextNodeProperty . }");
queriesForAgent.add(prefix + "SELECT " + queriesForAgent.add(prefix + "SELECT " +
"(str(?label) as ?advisorLabel) WHERE {" + "(str(?label) as ?advisorLabel) WHERE {" +
" ?uri rdf:type foaf:Agent ." + " ?uri rdf:type foaf:Agent ." +
" ?c rdf:type core:Relationship . " + " ?c rdf:type core:AdvisingRelationship . " +
" ?c core:advisee ?uri . " + " ?c core:relates ?uri . " +
" ?c core:advisor ?d . ?d rdfs:label ?label .}" ); " ?uri obo:RO_0000053 ?adviseeRole . " +
" ?adviseeRole rdf:type core:AdviseeRole . " +
" ?c core:relates ?d . " +
" ?d rdf:type foaf:Person . " +
" ?d obo:RO_0000053 ?advisorRole . " +
" ?advisorRole rdf:type core:AdvisorRole . " +
" ?d rdfs:label ?ContextNodeProperty . }");
/* Author */ /* Author */
queriesForAgent.add(prefix + "SELECT " + queriesForAgent.add(prefix + "SELECT " +
"(str(?ContextNodeProperty) as ?contextNodeProperty) WHERE {" + "(str(?ContextNodeProperty) as ?contextNodeProperty) WHERE {" +
" ?uri rdf:type foaf:Agent ; ?b ?c . " + " ?uri rdf:type foaf:Agent ; ?b ?c . " +
" ?c rdf:type core:Relationship . " + " ?c rdf:type core:Authorship . " +
" ?c core:linkedAuthor ?f . " + " ?c core:relates ?f . " +
" ?f rdf:type foaf:Person . " +
" ?f rdfs:label ?ContextNodeProperty . " + " ?f rdfs:label ?ContextNodeProperty . " +
" FILTER( ?f != ?uri ) " + " FILTER( ?f != ?uri ) " +
"}"); "}");
@ -125,8 +132,9 @@ public class VivoAgentContextNodeFields extends ContextNodeFields{
queriesForAgent.add(prefix + "SELECT " + queriesForAgent.add(prefix + "SELECT " +
"(str(?ContextNodeProperty) as ?contextNodeProperty) WHERE {" + "(str(?ContextNodeProperty) as ?contextNodeProperty) WHERE {" +
" ?uri rdf:type foaf:Agent ; ?b ?c . " + " ?uri rdf:type foaf:Agent ; ?b ?c . " +
" ?c rdf:type core:Relationship . " + " ?c rdf:type core:Authorship . " +
" ?c core:linkedInformationResource ?h . ?h rdfs:label ?ContextNodeProperty . }"); " ?c core:relates ?h . " +
" ?h rdf:type obo:IAO_0000030 . ?h rdfs:label ?ContextNodeProperty . }");
/* Award */ /* Award */
@ -138,8 +146,8 @@ public class VivoAgentContextNodeFields extends ContextNodeFields{
"WHERE {" "WHERE {"
+ " ?uri rdf:type foaf:Agent ; ?b ?c . " + " ?uri rdf:type foaf:Agent ; ?b ?c . "
+ " ?c rdf:type core:AwardReceipt . " + " ?c rdf:type core:AwardReceipt . "
+ " OPTIONAL { ?c rdfs:label ?AwardLabel . } . " + " OPTIONAL { ?c core:relates ?e . ?e rdf:type core:Award . ?e rdfs:label ?AwardLabel . } . "
+ " OPTIONAL { ?c core:awardConferredBy ?d . ?d rdfs:label ?AwardConferredBy . } . " + " OPTIONAL { ?c core:assignedBy ?d . ?d rdf:type foaf:Organization . ?d rdfs:label ?AwardConferredBy . } . "
+ " OPTIONAL { ?c core:description ?Description . } . " + " OPTIONAL { ?c core:description ?Description . } . "
+ " }"); + " }");
@ -147,8 +155,9 @@ public class VivoAgentContextNodeFields extends ContextNodeFields{
queriesForAgent.add(prefix + queriesForAgent.add(prefix +
"SELECT (str(?OrganizationLabel) as ?organizationLabel) WHERE {" "SELECT (str(?OrganizationLabel) as ?organizationLabel) WHERE {"
+ "?uri rdf:type foaf:Agent ; ?b ?c . " + " ?uri rdf:type foaf:Agent ; ?b ?c . "
+ " ?c rdf:type core:Role ; core:roleIn ?Organization ." + " ?c rdf:type obo:BFO_0000023 ; core:roleContributesTo ?Organization ."
+ " ?Organization rdf:type core:Organization . "
+ " ?Organization rdfs:label ?OrganizationLabel . " + " ?Organization rdfs:label ?OrganizationLabel . "
+ " }"); + " }");
@ -163,12 +172,16 @@ public class VivoAgentContextNodeFields extends ContextNodeFields{
"(str(?TrainingAtOrganizationLabel) as ?trainingAtOrganizationLabel) WHERE {" "(str(?TrainingAtOrganizationLabel) as ?trainingAtOrganizationLabel) WHERE {"
+ " ?uri rdf:type foaf:Agent ; ?b ?c . " + " ?uri rdf:type foaf:Agent ; ?b ?c . "
+ " ?c rdf:type core:EducationalTraining . " + " ?c rdf:type core:EducationalProcess . "
+ "OPTIONAL { ?c core:degreeEarned ?d . ?d rdfs:label ?AcademicDegreeLabel ; core:abbreviation ?AcademicDegreeAbbreviation . } . " + "OPTIONAL { ?c core:relates ?d . "
+ " ?d rdf:type core:AwardedDegree . "
+ " ?d core:relates ?e . "
+ " ?e rdf:type core:AcademicDegree . "
+ " ?e rdfs:label ?AcademicDegreeLabel . } . "
+ "OPTIONAL { ?c core:majorField ?MajorField .} ." + "OPTIONAL { ?c core:majorField ?MajorField .} ."
+ " OPTIONAL { ?c core:departmentOrSchool ?DepartmentOrSchool . }" + " OPTIONAL { ?c core:departmentOrSchool ?DepartmentOrSchool . }"
+ " OPTIONAL { ?c core:trainingAtOrganization ?e . ?e rdfs:label ?TrainingAtOrganizationLabel . } . " + " OPTIONAL { ?c obo:RO_0000057 ?f . ?f rdf:type foaf:organization . ?f rdfs:label ?TrainingAtOrganizationLabel . } . "
+"}"); +"}");
} }
} }

View file

@ -48,6 +48,7 @@ public class VivoISFAdvisingFields extends ContextNodeFields {
" ?rel rdf:type core:AdvisingRelationship . \n" + " ?rel rdf:type core:AdvisingRelationship . \n" +
" ?rel core:relates ?other . \n" + " ?rel core:relates ?other . \n" +
" ?other rdfs:label ?result . \n" + " ?other rdfs:label ?result . \n" +
" FILTER( ?other != ?uri ) \n" +
"}"; "}";
} }

View file

@ -12,11 +12,13 @@ import org.junit.Test;
import com.hp.hpl.jena.ontology.OntModel; import com.hp.hpl.jena.ontology.OntModel;
import com.hp.hpl.jena.rdf.model.ModelFactory; import com.hp.hpl.jena.rdf.model.ModelFactory;
import edu.cornell.mannlib.vitro.webapp.search.indexing.AdditionalURIsForContextNodes; import edu.cornell.mannlib.vitro.webapp.rdfservice.impl.jena.model.RDFServiceModel;
public class AdditionalURIsForContextNodesTest { public class AdditionalURIsForContextNodesTest {
private AdditionalURIsForContextNodes uriFinder;
@Test @Test
public void testPositionChanges(){ public void testPositionChanges(){
String n3 = String n3 =
@ -59,12 +61,7 @@ public class AdditionalURIsForContextNodesTest {
"<http://vivoweb.org/ontology/core#DateTimeInterval> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#Class> . \n" + "<http://vivoweb.org/ontology/core#DateTimeInterval> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#Class> . \n" +
"<http://vivoweb.org/ontology/core#Department> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#Class> . \n" ; "<http://vivoweb.org/ontology/core#Department> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#Class> . \n" ;
//make a test model with an person, an authorship context node and a book populateModelAndCreateUriFinder(n3);
OntModel model = ModelFactory.createOntologyModel();
model.read( new StringReader(n3), null, "N3");
//make an AdditionalURIsForContextNodesTest object with that model
AdditionalURIsForContextNodes uriFinder = new AdditionalURIsForContextNodes( model );
//if the person changes then the org needs to be updated //if the person changes then the org needs to be updated
List<String> uris = uriFinder.findAdditionalURIsToIndex( "http://caruso-laptop.mannlib.cornell.edu:8090/vivo/individual/n932"); List<String> uris = uriFinder.findAdditionalURIsToIndex( "http://caruso-laptop.mannlib.cornell.edu:8090/vivo/individual/n932");
@ -107,22 +104,16 @@ public class AdditionalURIsForContextNodesTest {
" core:contributingRole <http://caruso-laptop.mannlib.cornell.edu:8090/vivo/individual/n2577> . \n" + " core:contributingRole <http://caruso-laptop.mannlib.cornell.edu:8090/vivo/individual/n2577> . \n" +
" <http://vivo.scripps.edu/individual/n14979> a <http://xmlns.com/foaf/0.1/Person> , owl:Thing , <http://xmlns.com/foaf/0.1/Agent> . \n"; " <http://vivo.scripps.edu/individual/n14979> a <http://xmlns.com/foaf/0.1/Person> , owl:Thing , <http://xmlns.com/foaf/0.1/Agent> . \n";
//make a test model with an person, an authorship context node and a book //make a test model with an person, an authorship context node and a book
OntModel model = ModelFactory.createOntologyModel(); populateModelAndCreateUriFinder(n3);
model.read( new StringReader(n3), null, "N3");
//make an AdditionalURIsForContextNodesTest object with that model
AdditionalURIsForContextNodes uriFinder = new AdditionalURIsForContextNodes( model );
//get additional uris for org //get additional uris for org
List<String> uris = uriFinder.findAdditionalURIsToIndex( "http://caruso-laptop.mannlib.cornell.edu:8090/vivo/individual/n2592"); List<String> uris = uriFinder.findAdditionalURIsToIndex( "http://caruso-laptop.mannlib.cornell.edu:8090/vivo/individual/n2592");
assertTrue("did not find person for context node", uris.contains("http://vivo.scripps.edu/individual/n14979" )); assertTrue("did not find person for context node", uris.contains("http://vivo.scripps.edu/individual/n14979" ));
} }
@Test @Test
public void testLeaderRoleChanges(){ public void testLeaderRoleChanges(){
String n3= String n3=
@ -153,13 +144,7 @@ public class AdditionalURIsForContextNodesTest {
"<http://vivo.scripps.edu/individual/n7080> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#Thing> . \n " + "<http://vivo.scripps.edu/individual/n7080> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#Thing> . \n " +
"<http://vivo.scripps.edu/individual/n7080> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Organization> . \n " ; "<http://vivo.scripps.edu/individual/n7080> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Organization> . \n " ;
populateModelAndCreateUriFinder(n3);
//make a test model with an person, a leader role node and a university
OntModel model = ModelFactory.createOntologyModel();
model.read( new StringReader(n3), null, "N3");
//make an AdditionalURIsForContextNodesTest object with that model
AdditionalURIsForContextNodes uriFinder = new AdditionalURIsForContextNodes( model );
//if the person changes then the university needs to be updated //if the person changes then the university needs to be updated
List<String> uris = uriFinder.findAdditionalURIsToIndex( "http://vivo.scripps.edu/individual/n2027"); List<String> uris = uriFinder.findAdditionalURIsToIndex( "http://vivo.scripps.edu/individual/n2027");
@ -168,8 +153,6 @@ public class AdditionalURIsForContextNodesTest {
//if the university changes then the person needs to be updated //if the university changes then the person needs to be updated
uris = uriFinder.findAdditionalURIsToIndex( "http://vivo.scripps.edu/individual/n7080"); uris = uriFinder.findAdditionalURIsToIndex( "http://vivo.scripps.edu/individual/n7080");
assertTrue("did not find person for context node", uris.contains("http://vivo.scripps.edu/individual/n2027" )); assertTrue("did not find person for context node", uris.contains("http://vivo.scripps.edu/individual/n2027" ));
} }
@ -204,14 +187,7 @@ public class AdditionalURIsForContextNodesTest {
"<http://vivo.scripps.edu/individual/n6004> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#Thing> . \n " + "<http://vivo.scripps.edu/individual/n6004> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#Thing> . \n " +
"<http://vivo.scripps.edu/individual/n6004> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Organization> . \n " ; "<http://vivo.scripps.edu/individual/n6004> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Organization> . \n " ;
populateModelAndCreateUriFinder(n3);
//make a test model with an person, a member role node and a university
OntModel model = ModelFactory.createOntologyModel();
model.read( new StringReader(n3), null, "N3");
//make an AdditionalURIsForContextNodesTest object with that model
AdditionalURIsForContextNodes uriFinder = new AdditionalURIsForContextNodes( model );
//if the person changes then the university needs to be updated //if the person changes then the university needs to be updated
List<String> uris = uriFinder.findAdditionalURIsToIndex( "http://vivo.scripps.edu/individual/n4519"); List<String> uris = uriFinder.findAdditionalURIsToIndex( "http://vivo.scripps.edu/individual/n4519");
@ -255,14 +231,7 @@ public class AdditionalURIsForContextNodesTest {
"<http://vivo.scripps.edu/individual/n5177> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#Thing> . \n" + "<http://vivo.scripps.edu/individual/n5177> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#Thing> . \n" +
"<http://vivo.scripps.edu/individual/n5177> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://vivoweb.org/ontology/core#Process> . \n" ; "<http://vivo.scripps.edu/individual/n5177> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://vivoweb.org/ontology/core#Process> . \n" ;
populateModelAndCreateUriFinder(n3);
//make a test model with an person, a clinical role node and a project
OntModel model = ModelFactory.createOntologyModel();
model.read( new StringReader(n3), null, "N3");
//make an AdditionalURIsForContextNodesTest object with that model
AdditionalURIsForContextNodes uriFinder = new AdditionalURIsForContextNodes( model );
//if the person changes then the project needs to be updated //if the person changes then the project needs to be updated
List<String> uris = uriFinder.findAdditionalURIsToIndex( "http://vivo.scripps.edu/individual/n4858"); List<String> uris = uriFinder.findAdditionalURIsToIndex( "http://vivo.scripps.edu/individual/n4858");
@ -303,12 +272,7 @@ public class AdditionalURIsForContextNodesTest {
"<http://vivo.scripps.edu/individual/n4442> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#Thing> . \n" + "<http://vivo.scripps.edu/individual/n4442> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#Thing> . \n" +
"<http://vivo.scripps.edu/individual/n4442> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://purl.obolibrary.org/obo/ERO_0000005> . \n" ; "<http://vivo.scripps.edu/individual/n4442> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://purl.obolibrary.org/obo/ERO_0000005> . \n" ;
//make a test model with an person, a clinical role node and a service populateModelAndCreateUriFinder(n3);
OntModel model = ModelFactory.createOntologyModel();
model.read( new StringReader(n3), null, "N3");
//make an AdditionalURIsForContextNodesTest object with that model
AdditionalURIsForContextNodes uriFinder = new AdditionalURIsForContextNodes( model );
//if the person changes then the service needs to be updated //if the person changes then the service needs to be updated
List<String> uris = uriFinder.findAdditionalURIsToIndex( "http://vivo.scripps.edu/individual/n5651"); List<String> uris = uriFinder.findAdditionalURIsToIndex( "http://vivo.scripps.edu/individual/n5651");
@ -350,13 +314,7 @@ public class AdditionalURIsForContextNodesTest {
"<http://vivo.scripps.edu/individual/n1305> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://purl.org/NET/c4dm/event.owl#Event> . \n" + "<http://vivo.scripps.edu/individual/n1305> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://purl.org/NET/c4dm/event.owl#Event> . \n" +
"<http://vivo.scripps.edu/individual/n1305> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#Thing> . \n" ; "<http://vivo.scripps.edu/individual/n1305> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#Thing> . \n" ;
populateModelAndCreateUriFinder(n3);
//make a test model with an person, a presenter role node and a presentation
OntModel model = ModelFactory.createOntologyModel();
model.read( new StringReader(n3), null, "N3");
//make an AdditionalURIsForContextNodesTest object with that model
AdditionalURIsForContextNodes uriFinder = new AdditionalURIsForContextNodes( model );
//if the person changes then the presentation needs to be updated //if the person changes then the presentation needs to be updated
List<String> uris = uriFinder.findAdditionalURIsToIndex( "http://vivo.scripps.edu/individual/n5596"); List<String> uris = uriFinder.findAdditionalURIsToIndex( "http://vivo.scripps.edu/individual/n5596");
@ -399,12 +357,7 @@ public class AdditionalURIsForContextNodesTest {
"<http://vivo.scripps.edu/individual/n4107> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#Thing> . \n " + "<http://vivo.scripps.edu/individual/n4107> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#Thing> . \n " +
"<http://vivo.scripps.edu/individual/n4107> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://vivoweb.org/ontology/core#InvitedTalk> . \n " ; "<http://vivo.scripps.edu/individual/n4107> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://vivoweb.org/ontology/core#InvitedTalk> . \n " ;
//make a test model with an person, a presenter role node and an invited talk populateModelAndCreateUriFinder(n3);
OntModel model = ModelFactory.createOntologyModel();
model.read( new StringReader(n3), null, "N3");
//make an AdditionalURIsForContextNodesTest object with that model
AdditionalURIsForContextNodes uriFinder = new AdditionalURIsForContextNodes( model );
//if the person changes then the invited talk needs to be updated //if the person changes then the invited talk needs to be updated
List<String> uris = uriFinder.findAdditionalURIsToIndex( "http://vivo.scripps.edu/individual/n4112"); List<String> uris = uriFinder.findAdditionalURIsToIndex( "http://vivo.scripps.edu/individual/n4112");
@ -447,13 +400,7 @@ public class AdditionalURIsForContextNodesTest {
"<http://vivo.scripps.edu/individual/n4252> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#Thing> . \n" + "<http://vivo.scripps.edu/individual/n4252> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#Thing> . \n" +
"<http://vivo.scripps.edu/individual/n4252> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://vivoweb.org/ontology/core#Grant> . \n" ; "<http://vivo.scripps.edu/individual/n4252> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://vivoweb.org/ontology/core#Grant> . \n" ;
populateModelAndCreateUriFinder(n3);
//make a test model with an person, a researcher role node and a grant
OntModel model = ModelFactory.createOntologyModel();
model.read( new StringReader(n3), null, "N3");
//make an AdditionalURIsForContextNodesTest object with that model
AdditionalURIsForContextNodes uriFinder = new AdditionalURIsForContextNodes( model );
//if the person changes then the grant needs to be updated //if the person changes then the grant needs to be updated
List<String> uris = uriFinder.findAdditionalURIsToIndex( "http://vivo.scripps.edu/individual/n4957"); List<String> uris = uriFinder.findAdditionalURIsToIndex( "http://vivo.scripps.edu/individual/n4957");
@ -497,14 +444,7 @@ public class AdditionalURIsForContextNodesTest {
"<http://vivo.scripps.edu/individual/n564> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#Thing> . \n " + "<http://vivo.scripps.edu/individual/n564> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#Thing> . \n " +
"<http://vivo.scripps.edu/individual/n564> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://vivoweb.org/ontology/core#Process> . \n " ; "<http://vivo.scripps.edu/individual/n564> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://vivoweb.org/ontology/core#Process> . \n " ;
populateModelAndCreateUriFinder(n3);
//make a test model with an person, a researcher role node and a project
OntModel model = ModelFactory.createOntologyModel();
model.read( new StringReader(n3), null, "N3");
//make an AdditionalURIsForContextNodesTest object with that model
AdditionalURIsForContextNodes uriFinder = new AdditionalURIsForContextNodes( model );
//if the person changes then the project needs to be updated //if the person changes then the project needs to be updated
List<String> uris = uriFinder.findAdditionalURIsToIndex( "http://vivo.scripps.edu/individual/n2029"); List<String> uris = uriFinder.findAdditionalURIsToIndex( "http://vivo.scripps.edu/individual/n2029");
@ -548,13 +488,7 @@ public class AdditionalURIsForContextNodesTest {
"<http://vivo.scripps.edu/individual/n1742> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#Thing> . \n" + "<http://vivo.scripps.edu/individual/n1742> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#Thing> . \n" +
"<http://vivo.scripps.edu/individual/n1742> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://vivoweb.org/ontology/core#Grant> . \n" ; "<http://vivo.scripps.edu/individual/n1742> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://vivoweb.org/ontology/core#Grant> . \n" ;
populateModelAndCreateUriFinder(n3);
//make a test model with an person, a principal investigator role node and a grant
OntModel model = ModelFactory.createOntologyModel();
model.read( new StringReader(n3), null, "N3");
//make an AdditionalURIsForContextNodesTest object with that model
AdditionalURIsForContextNodes uriFinder = new AdditionalURIsForContextNodes( model );
//if the person changes then the grant needs to be updated //if the person changes then the grant needs to be updated
List<String> uris = uriFinder.findAdditionalURIsToIndex( "http://vivo.scripps.edu/individual/n2368"); List<String> uris = uriFinder.findAdditionalURIsToIndex( "http://vivo.scripps.edu/individual/n2368");
@ -598,12 +532,7 @@ public class AdditionalURIsForContextNodesTest {
"<http://vivo.scripps.edu/individual/n4931> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#Thing> . \n" + "<http://vivo.scripps.edu/individual/n4931> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#Thing> . \n" +
"<http://vivo.scripps.edu/individual/n4931> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://vivoweb.org/ontology/core#Grant> . \n" ; "<http://vivo.scripps.edu/individual/n4931> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://vivoweb.org/ontology/core#Grant> . \n" ;
//make a test model with an person, a co-principal investigator role node and a grant populateModelAndCreateUriFinder(n3);
OntModel model = ModelFactory.createOntologyModel();
model.read( new StringReader(n3), null, "N3");
//make an AdditionalURIsForContextNodesTest object with that model
AdditionalURIsForContextNodes uriFinder = new AdditionalURIsForContextNodes( model );
//if the copi changes then the grant needs to be updated //if the copi changes then the grant needs to be updated
List<String> uris = uriFinder.findAdditionalURIsToIndex( "http://vivo.scripps.edu/individual/n1373"); List<String> uris = uriFinder.findAdditionalURIsToIndex( "http://vivo.scripps.edu/individual/n1373");
@ -646,13 +575,7 @@ public class AdditionalURIsForContextNodesTest {
"<http://vivo.scripps.edu/individual/n160> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#Thing> . \n" + "<http://vivo.scripps.edu/individual/n160> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#Thing> . \n" +
"<http://vivo.scripps.edu/individual/n160> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://vivoweb.org/ontology/core#Grant> . \n" ; "<http://vivo.scripps.edu/individual/n160> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://vivoweb.org/ontology/core#Grant> . \n" ;
populateModelAndCreateUriFinder(n3);
//make a test model with an person, a investigator role node and a grant
OntModel model = ModelFactory.createOntologyModel();
model.read( new StringReader(n3), null, "N3");
//make an AdditionalURIsForContextNodesTest object with that model
AdditionalURIsForContextNodes uriFinder = new AdditionalURIsForContextNodes( model );
//if the investigator changes then the grant needs to be updated //if the investigator changes then the grant needs to be updated
List<String> uris = uriFinder.findAdditionalURIsToIndex( "http://vivo.scripps.edu/individual/n5282"); List<String> uris = uriFinder.findAdditionalURIsToIndex( "http://vivo.scripps.edu/individual/n5282");
@ -662,9 +585,20 @@ public class AdditionalURIsForContextNodesTest {
uris = uriFinder.findAdditionalURIsToIndex( "http://vivo.scripps.edu/individual/n160"); uris = uriFinder.findAdditionalURIsToIndex( "http://vivo.scripps.edu/individual/n160");
assertTrue("did not find investigator for grant", uris.contains("http://vivo.scripps.edu/individual/n5282" )); assertTrue("did not find investigator for grant", uris.contains("http://vivo.scripps.edu/individual/n5282" ));
} }
// ----------------------------------------------------------------------
// Helper methods
// ----------------------------------------------------------------------
/**
* Build a Model from this N3 string, and create a URI Finder based on that
* Model.
*/
private void populateModelAndCreateUriFinder(String n3String) {
OntModel model = ModelFactory.createOntologyModel();
model.read(new StringReader(n3String), null, "N3");
uriFinder = new AdditionalURIsForContextNodes(
new RDFServiceModel(model));
}
} }

View file

@ -24,33 +24,33 @@ import edu.cornell.mannlib.vitro.webapp.rdfservice.impl.RDFServiceFactorySingle;
import edu.cornell.mannlib.vitro.webapp.rdfservice.impl.jena.model.RDFServiceModel; import edu.cornell.mannlib.vitro.webapp.rdfservice.impl.jena.model.RDFServiceModel;
public class VivoAgentContextNodeFieldsTest extends AbstractTestClass{ public class VivoAgentContextNodeFieldsTest extends AbstractTestClass{
static String SPCA = "http://vivo.mydomain.edu/individual/n8087"; static String SPCA = "http://vivo.mydomain.edu/individual/n8087";
static RDFServiceFactory rdfServiceFactory; static RDFServiceFactory rdfServiceFactory;
@BeforeClass @BeforeClass
public static void setup(){ public static void setup(){
Model m = ModelFactory.createDefaultModel(); Model m = ModelFactory.createDefaultModel();
InputStream stream = VivoAgentContextNodeFieldsTest InputStream stream = VivoAgentContextNodeFieldsTest
.class.getResourceAsStream("./NIHVIVO3853_DataSet1.rdf"); .class.getResourceAsStream("./NIHVIVO3853_DataSet1.rdf");
long preloadSize = m.size(); long preloadSize = m.size();
m.read(stream, null); m.read(stream, null);
assertTrue("expected to load statements from file", m.size() > preloadSize ); assertTrue("expected to load statements from file", m.size() > preloadSize );
assertTrue("expect statements about SPCA", assertTrue("expect statements about SPCA",
m.contains(ResourceFactory.createResource(SPCA),(Property) null,(RDFNode) null)); m.contains(ResourceFactory.createResource(SPCA),(Property) null,(RDFNode) null));
RDFService rdfService = new RDFServiceModel(m); RDFService rdfService = new RDFServiceModel(m);
rdfServiceFactory = new RDFServiceFactorySingle(rdfService); rdfServiceFactory = new RDFServiceFactorySingle(rdfService);
} }
@Test @Test
public void testJane(){ public void testJane(){
Individual ind = new IndividualImpl(); Individual ind = new IndividualImpl();
ind.setURI(SPCA); ind.setURI(SPCA);
VivoAgentContextNodeFields vacnf = new VivoAgentContextNodeFields(rdfServiceFactory); VivoAgentContextNodeFields vacnf = new VivoAgentContextNodeFields(rdfServiceFactory);
@ -61,11 +61,11 @@ public class VivoAgentContextNodeFieldsTest extends AbstractTestClass{
boolean hasJane = values.toLowerCase().indexOf("jane") > 0; boolean hasJane = values.toLowerCase().indexOf("jane") > 0;
assertTrue("expected to have jane because SPCA advises jane", hasJane); assertTrue("expected to have jane because SPCA advises jane", hasJane);
} }
@Test @Test
public void testWonder(){ public void testWonder(){
Individual ind = new IndividualImpl(); Individual ind = new IndividualImpl();
ind.setURI(SPCA); ind.setURI(SPCA);
VivoAgentContextNodeFields vacnf = new VivoAgentContextNodeFields(rdfServiceFactory); VivoAgentContextNodeFields vacnf = new VivoAgentContextNodeFields(rdfServiceFactory);
@ -76,11 +76,11 @@ public class VivoAgentContextNodeFieldsTest extends AbstractTestClass{
boolean hasWonder = values.toLowerCase().indexOf("wonders") > 0; boolean hasWonder = values.toLowerCase().indexOf("wonders") > 0;
assertTrue("expected to have jane because SPCA won wonders award", hasWonder); assertTrue("expected to have jane because SPCA won wonders award", hasWonder);
} }
@Test @Test
public void testChimp(){ public void testChimp(){
Individual ind = new IndividualImpl(); Individual ind = new IndividualImpl();
ind.setURI(SPCA); ind.setURI(SPCA);
VivoAgentContextNodeFields vacnf = new VivoAgentContextNodeFields(rdfServiceFactory); VivoAgentContextNodeFields vacnf = new VivoAgentContextNodeFields(rdfServiceFactory);
@ -91,5 +91,5 @@ public class VivoAgentContextNodeFieldsTest extends AbstractTestClass{
boolean hasNotChimp = ! (values.toLowerCase().indexOf("chimp") > 0); boolean hasNotChimp = ! (values.toLowerCase().indexOf("chimp") > 0);
assertTrue("expected to not have chimp because jane won chimp award, not SPCA", hasNotChimp); assertTrue("expected to not have chimp because jane won chimp award, not SPCA", hasNotChimp);
} }
} }

View file

@ -120,6 +120,7 @@ missing_info_resource = missing information resource
award_receipt_name = award receipt name award_receipt_name = award receipt name
award_name = award name award_name = award name
conferred_by = conferred by conferred_by = conferred by
conferred_on = conferred on
selected_award = Selected Award selected_award = Selected Award
incomplete_date_time_interval = incomplete date/time interval incomplete_date_time_interval = incomplete date/time interval