Merge branch 'develop' into feature/microformats

Merging the latest changes in develop into the microformats branch. Necessary before doing ther pull request and merging microformats back into develop. (I think.)
This commit is contained in:
Tim Worrall 2014-11-25 13:10:51 -05:00
commit ce3c4a3539
25 changed files with 218 additions and 256 deletions

View file

@ -75,6 +75,7 @@
<include name="languages/**/*" /> <include name="languages/**/*" />
<include name="config/*.properties" /> <include name="config/*.properties" />
<include name="config/*.txt" /> <include name="config/*.txt" />
<include name="config/*.n3" />
<include name="config/jarlist/*.txt" /> <include name="config/jarlist/*.txt" />
<include name="config/solr/*" /> <include name="config/solr/*" />
<include name="context.xml" /> <include name="context.xml" />

View file

@ -0,0 +1,35 @@
@prefix : <http://vitro.mannlib.cornell.edu/ns/vitro/ApplicationSetup#> .
:application
a <java:edu.cornell.mannlib.vitro.webapp.application.ApplicationImpl> ,
<java:edu.cornell.mannlib.vitro.webapp.modules.Application> ;
:hasSearchEngine :searchEngineWrapper ;
:hasImageProcessor :imageProcessor ;
:hasFileStorage :fileStorage ;
:hasContentTripleSource :contentTripleSource ;
:hasConfigurationTripleSource :configurationTripleSource .
:imageProcessor
a <java:edu.cornell.mannlib.vitro.webapp.imageprocessor.jai.JaiImageProcessor> ,
<java:edu.cornell.mannlib.vitro.webapp.modules.imageProcessor.ImageProcessor> .
:fileStorage
a <java:edu.cornell.mannlib.vitro.webapp.filestorage.impl.FileStorageImplWrapper> ,
<java:edu.cornell.mannlib.vitro.webapp.modules.fileStorage.FileStorage> .
:searchEngineWrapper
a <java:edu.cornell.mannlib.vitro.webapp.searchengine.InstrumentedSearchEngineWrapper> ,
<java:edu.cornell.mannlib.vitro.webapp.modules.searchEngine.SearchEngine> ;
:wraps :searchEngine .
:searchEngine
a <java:edu.cornell.mannlib.vitro.webapp.searchengine.solr.SolrSearchEngine> ,
<java:edu.cornell.mannlib.vitro.webapp.modules.searchEngine.SearchEngine> .
:contentTripleSource
a <java:edu.cornell.mannlib.vitro.webapp.triplesource.impl.sdb.ContentTripleSourceSDB> ,
<java:edu.cornell.mannlib.vitro.webapp.modules.tripleSource.ContentTripleSource> .
:configurationTripleSource
a <java:edu.cornell.mannlib.vitro.webapp.triplesource.impl.tdb.ConfigurationTripleSourceTDB> ,
<java:edu.cornell.mannlib.vitro.webapp.modules.tripleSource.ConfigurationTripleSource> .

View file

@ -8,9 +8,9 @@ find these files in this directory:
Instructions for installing VIVO on your machine, including Instructions for installing VIVO on your machine, including
a simple installation and several options. a simple installation and several options.
Upgrade Instructions for VIVO release 1.7.pdf Upgrade Instructions for VIVO release 1.8.pdf
Instructions for migrating a VIVO installation from release Instructions for migrating a VIVO installation from release
1.6 to release 1.7 1.7 to release 1.8
If these files are not present, or to obtain the latest version of the If these files are not present, or to obtain the latest version of the
instructions, go to: instructions, go to:

View file

@ -7,6 +7,8 @@
edu.cornell.mannlib.vitro.webapp.servlet.setup.JvmSmokeTests edu.cornell.mannlib.vitro.webapp.servlet.setup.JvmSmokeTests
edu.cornell.mannlib.vitro.webapp.application.ApplicationSetup
edu.cornell.mannlib.vitro.webapp.config.ConfigurationPropertiesSetup edu.cornell.mannlib.vitro.webapp.config.ConfigurationPropertiesSetup
edu.cornell.mannlib.vitro.webapp.config.ConfigurationPropertiesSmokeTests edu.cornell.mannlib.vitro.webapp.config.ConfigurationPropertiesSmokeTests
@ -16,15 +18,12 @@ edu.cornell.mannlib.vitro.webapp.servlet.setup.GuardAgainstUnmigratedRDB
edu.cornell.mannlib.vitro.webapp.utils.developer.DeveloperSettings$Setup edu.cornell.mannlib.vitro.webapp.utils.developer.DeveloperSettings$Setup
edu.cornell.mannlib.vitro.webapp.application.ApplicationImpl$Setup edu.cornell.mannlib.vitro.webapp.application.ApplicationImpl$ComponentsSetup
edu.cornell.mannlib.vitro.webapp.config.RevisionInfoSetup edu.cornell.mannlib.vitro.webapp.config.RevisionInfoSetup
edu.cornell.mannlib.vitro.webapp.email.FreemarkerEmailFactory$Setup edu.cornell.mannlib.vitro.webapp.email.FreemarkerEmailFactory$Setup
# In 1.8, this should replace JenaPersistentDataSourceSetup, RDFServiceSetup, and maybe more.
edu.cornell.mannlib.vitro.webapp.servlet.setup.rdfsetup.RDFSetup
edu.cornell.mannlib.vitro.webapp.servlet.setup.ConfigurationModelsSetup edu.cornell.mannlib.vitro.webapp.servlet.setup.ConfigurationModelsSetup
edu.cornell.mannlib.vitro.webapp.servlet.setup.ContentModelSetup edu.cornell.mannlib.vitro.webapp.servlet.setup.ContentModelSetup
@ -64,9 +63,6 @@ edu.ucsf.vitro.opensocial.OpenSocialSmokeTests
# For multiple language support # For multiple language support
edu.cornell.mannlib.vitro.webapp.i18n.selection.LocaleSelectionSetup edu.cornell.mannlib.vitro.webapp.i18n.selection.LocaleSelectionSetup
# Add VIVO specific DocumentModifers, this must come before SearchIndexerSetup
edu.cornell.mannlib.vitro.webapp.search.documentBuilding.VivoDocumentModifiers
# The search indexer uses a "public" permission, so the PropertyRestrictionPolicyHelper # The search indexer uses a "public" permission, so the PropertyRestrictionPolicyHelper
# and the PermissionRegistry must already be set up. # and the PermissionRegistry must already be set up.
edu.cornell.mannlib.vitro.webapp.searchindex.SearchIndexerSetup edu.cornell.mannlib.vitro.webapp.searchindex.SearchIndexerSetup

View file

@ -20,7 +20,7 @@ roleExamples-->
<#--Variable assignments for Add Clinical Role To Person--> <#--Variable assignments for Add Clinical Role To Person-->
<#assign roleDescriptor = "${i18n().collection_series_editor_role}" /> <#assign roleDescriptor = "${i18n().collection_series_editor_role}" />
<#assign typeSelectorLabel = "${i18n().editor_role_in}" /> <#assign typeSelectorLabel = "${i18n().editor_role_in}" />
<#assign genericLabel = "Collection" /> <#assign genericLabel = "Collection or Series" />
<#assign acTypes = "{activity: 'http://purl.org/ontology/bibo/Collection'}" /> <#assign acTypes = "{activity: 'http://purl.org/ontology/bibo/Collection'}" />

View file

@ -53,7 +53,8 @@
editMode: 'add', editMode: 'add',
typeName: 'Concept', typeName: 'Concept',
defaultTypeName: 'concept', // used in repair mode to generate button text defaultTypeName: 'concept', // used in repair mode to generate button text
baseHref: '${urls.base}/individual?uri=' baseHref: '${urls.base}/individual?uri=',
limitToConceptClasses:["http://www.w3.org/2004/02/skos/core#Concept"]
}; };
var i18nStrings = { var i18nStrings = {
selectAnExisting: '${i18n().select_an_existing}', selectAnExisting: '${i18n().select_an_existing}',

View file

@ -113,7 +113,7 @@ var addAuthorForm = {
// after hitting 'cancel.' // after hitting 'cancel.'
initAuthorListOnlyView: function() { initAuthorListOnlyView: function() {
if ($('.authorship').length) { // make sure we have at least one author if ($('li.authorship').length) { // make sure we have at least one author
// Reorder authors on page load so that previously unranked authors get a rank. Otherwise, // Reorder authors on page load so that previously unranked authors get a rank. Otherwise,
// when we add a new author, it will get put ahead of any previously unranked authors, instead // when we add a new author, it will get put ahead of any previously unranked authors, instead
// of at the end of the list. (It is also helpful to normalize the data before we get started.) // of at the end of the list. (It is also helpful to normalize the data before we get started.)
@ -282,7 +282,7 @@ var addAuthorForm = {
setAcFilter: function() { setAcFilter: function() {
this.acFilter = []; this.acFilter = [];
$('.authorship').each(function() { $('li.authorship').each(function() {
var uri = $(this).data('authorUri'); var uri = $(this).data('authorUri');
addAuthorForm.acFilter.push(uri); addAuthorForm.acFilter.push(uri);
}); });
@ -404,7 +404,7 @@ var addAuthorForm = {
type: 'POST', type: 'POST',
success: function(data, status, request) { success: function(data, status, request) {
var pos; var pos;
$('.authorship').each(function(index){ $('li.authorship').each(function(index){
pos = index + 1; pos = index + 1;
// Set the new position for this element. The only function of this value // Set the new position for this element. The only function of this value
// is so we can reset an element to its original position in case reordering fails. // is so we can reset an element to its original position in case reordering fails.
@ -440,7 +440,7 @@ var addAuthorForm = {
// have to keep retrieving data from or modifying the DOM as we manipulate the // have to keep retrieving data from or modifying the DOM as we manipulate the
// authorships. // authorships.
initAuthorshipData: function() { initAuthorshipData: function() {
$('.authorship').each(function(index) { $('li.authorship').each(function(index) {
$(this).data(authorshipData[index]); $(this).data(authorshipData[index]);
// RY We might still need position to put back an element after reordering // RY We might still need position to put back an element after reordering
@ -462,7 +462,7 @@ var addAuthorForm = {
findAuthorship: function(key, value) { findAuthorship: function(key, value) {
var matchingAuthorship = $(); // if we don't find one, return an empty jQuery set var matchingAuthorship = $(); // if we don't find one, return an empty jQuery set
$('.authorship').each(function() { $('li.authorship').each(function() {
var authorship = $(this); var authorship = $(this);
if ( authorship.data(key) === value ) { if ( authorship.data(key) === value ) {
matchingAuthorship = authorship; matchingAuthorship = authorship;
@ -644,7 +644,7 @@ var addAuthorForm = {
url: $(link).attr('href'), url: $(link).attr('href'),
type: 'POST', type: 'POST',
data: { data: {
deletion: $(link).parents('.authorship').data('authorshipUri') deletion: $(link).parents('li.authorship').data('authorshipUri')
}, },
dataType: 'json', dataType: 'json',
context: link, // context for callback context: link, // context for callback
@ -654,7 +654,7 @@ var addAuthorForm = {
if (status === 'success') { if (status === 'success') {
authorship = $(this).parents('.authorship'); authorship = $(this).parents('li.authorship');
// Clear autocomplete cache entries matching this author's name, else // Clear autocomplete cache entries matching this author's name, else
// autocomplete will be retrieved from the cache, which excludes the removed author. // autocomplete will be retrieved from the cache, which excludes the removed author.
@ -673,7 +673,7 @@ var addAuthorForm = {
$(this).remove(); $(this).remove();
// Actions that depend on the author having been removed from the DOM: // Actions that depend on the author having been removed from the DOM:
numAuthors = $('.authorship').length; // retrieve the length after removing authorship from the DOM numAuthors = $('li.authorship').length; // retrieve the length after removing authorship from the DOM
// If removed item not last, reorder to remove any gaps // If removed item not last, reorder to remove any gaps
if (numAuthors > 0 && ! removeLast) { if (numAuthors > 0 && ! removeLast) {

View file

@ -953,6 +953,54 @@ local:webpageInfoConfig a :ObjectPropertyDisplayConfig ;
vitro:customEntryFormAnnot "edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.ManageWebpagesForIndividualGenerator"^^<http://www.w3.org/2001/XMLSchema#string> ; vitro:customEntryFormAnnot "edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.ManageWebpagesForIndividualGenerator"^^<http://www.w3.org/2001/XMLSchema#string> ;
:propertyGroup <http://vivoweb.org/ontology#vitroPropertyGroupoverview> . :propertyGroup <http://vivoweb.org/ontology#vitroPropertyGroupoverview> .
local:webpageSoftwareContext a :ConfigContext ;
:hasConfiguration local:webpageSoftwareConfig ;
:configContextFor <http://purl.obolibrary.org/obo/ARG_2000028> ;
:qualifiedByDomain <http://purl.obolibrary.org/obo/ERO_0000071> ;
:qualifiedByRoot <http://www.w3.org/2006/vcard/ns#Kind> ;
:qualifiedBy <http://www.w3.org/2006/vcard/ns#URL> .
local:webpageSoftwareConfig a :ObjectPropertyDisplayConfig ;
:listViewConfigFile "listViewConfig-webpage.xml"^^xsd:string ;
:displayName "webpage" ;
vitro:displayRankAnnot 40;
vitro:hiddenFromDisplayBelowRoleLevelAnnot role:public ;
vitro:prohibitedFromUpdateBelowRoleLevelAnnot role:public ;
vitro:customEntryFormAnnot "edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.ManageWebpagesForIndividualGenerator"^^<http://www.w3.org/2001/XMLSchema#string> ;
:propertyGroup <http://vivoweb.org/ontology#vitroPropertyGroupoverview> .
local:webpageFacilityContext a :ConfigContext ;
:hasConfiguration local:webpageFacilityConfig ;
:configContextFor <http://purl.obolibrary.org/obo/ARG_2000028> ;
:qualifiedByDomain <http://vivoweb.org/ontology/core#Facility> ;
:qualifiedByRoot <http://www.w3.org/2006/vcard/ns#Kind> ;
:qualifiedBy <http://www.w3.org/2006/vcard/ns#URL> .
local:webpageFacilityConfig a :ObjectPropertyDisplayConfig ;
:listViewConfigFile "listViewConfig-webpage.xml"^^xsd:string ;
:displayName "webpage" ;
vitro:displayRankAnnot 40;
vitro:hiddenFromDisplayBelowRoleLevelAnnot role:public ;
vitro:prohibitedFromUpdateBelowRoleLevelAnnot role:public ;
vitro:customEntryFormAnnot "edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.ManageWebpagesForIndividualGenerator"^^<http://www.w3.org/2001/XMLSchema#string> ;
:propertyGroup <http://vivoweb.org/ontology#vitroPropertyGroupoverview> .
local:webpageProjectContext a :ConfigContext ;
:hasConfiguration local:webpageProjectConfig ;
:configContextFor <http://purl.obolibrary.org/obo/ARG_2000028> ;
:qualifiedByDomain <http://vivoweb.org/ontology/core#Project> ;
:qualifiedByRoot <http://www.w3.org/2006/vcard/ns#Kind> ;
:qualifiedBy <http://www.w3.org/2006/vcard/ns#URL> .
local:webpageProjectConfig a :ObjectPropertyDisplayConfig ;
:listViewConfigFile "listViewConfig-webpage.xml"^^xsd:string ;
:displayName "webpage" ;
vitro:displayRankAnnot 40;
vitro:hiddenFromDisplayBelowRoleLevelAnnot role:public ;
vitro:prohibitedFromUpdateBelowRoleLevelAnnot role:public ;
vitro:customEntryFormAnnot "edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.ManageWebpagesForIndividualGenerator"^^<http://www.w3.org/2001/XMLSchema#string> ;
:propertyGroup <http://vivoweb.org/ontology#vitroPropertyGroupoverview> .
local:webpageEventContext a :ConfigContext ; local:webpageEventContext a :ConfigContext ;
:hasConfiguration local:webpageEventConfig ; :hasConfiguration local:webpageEventConfig ;
:configContextFor <http://purl.obolibrary.org/obo/ARG_2000028> ; :configContextFor <http://purl.obolibrary.org/obo/ARG_2000028> ;
@ -1746,7 +1794,7 @@ local:bfo_0000055Config a :ObjectPropertyDisplayConfig ;
:displayName "participant" ; :displayName "participant" ;
vitro:displayRankAnnot 17; vitro:displayRankAnnot 17;
vitro:hiddenFromDisplayBelowRoleLevelAnnot role:public ; vitro:hiddenFromDisplayBelowRoleLevelAnnot role:public ;
vitro:prohibitedFromUpdateBelowRoleLevelAnnot role:nobody ; vitro:prohibitedFromUpdateBelowRoleLevelAnnot role:public ;
vitro:customEntryFormAnnot "edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.ProjectHasParticipantGenerator"^^<http://www.w3.org/2001/XMLSchema#string> ; vitro:customEntryFormAnnot "edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.ProjectHasParticipantGenerator"^^<http://www.w3.org/2001/XMLSchema#string> ;
:propertyGroup <http://vivoweb.org/ontology#vitroPropertyGroupoverview> . :propertyGroup <http://vivoweb.org/ontology#vitroPropertyGroupoverview> .

View file

@ -0,0 +1,46 @@
@prefix : <http://vitro.mannlib.cornell.edu/ns/vitro/ApplicationSetup#> .
#
# Specify the SearchIndexExcluders and DocumentModifiers for VIVO.
# These are in addition to the ones specified for VIVO.
#
:vivoSearchExcluder_namespaceExcluder
a <java:edu.cornell.mannlib.vitro.webapp.search.documentBuilding.ExcludeBasedOnNamespace> ,
<java:edu.cornell.mannlib.vitro.webapp.search.documentBuilding.SearchIndexExcluder> ;
:excludes
"http://purl.obolibrary.org/obo/" .
# ------------------------------------
:vivodocumentModifier_calculateParameters
a <java:edu.cornell.mannlib.vitro.webapp.search.documentBuilding.CalculateParameters> ,
<java:edu.cornell.mannlib.vitro.webapp.search.documentBuilding.DocumentModifier> .
:vivodocumentModifier_valuesFromVcards
a <java:edu.cornell.mannlib.vitro.webapp.search.documentBuilding.VIVOValuesFromVcards> ,
<java:edu.cornell.mannlib.vitro.webapp.search.documentBuilding.DocumentModifier> .
:vivodocumentModifier_ISFBasicFields
a <java:edu.cornell.mannlib.vitro.webapp.search.documentBuilding.VivoISFBasicFields> ,
<java:edu.cornell.mannlib.vitro.webapp.search.documentBuilding.DocumentModifier> .
:vivodocumentModifier_ISFAdvisingFields
a <java:edu.cornell.mannlib.vitro.webapp.search.documentBuilding.VivoISFAdvisingFields> ,
<java:edu.cornell.mannlib.vitro.webapp.search.documentBuilding.DocumentModifier> .
:vivodocumentModifier_ISFEducationFields
a <java:edu.cornell.mannlib.vitro.webapp.search.documentBuilding.VivoISFEducationFields> ,
<java:edu.cornell.mannlib.vitro.webapp.search.documentBuilding.DocumentModifier> .
:vivodocumentModifier_ISFGrantFields
a <java:edu.cornell.mannlib.vitro.webapp.search.documentBuilding.VivoISFGrantFields> ,
<java:edu.cornell.mannlib.vitro.webapp.search.documentBuilding.DocumentModifier> .
:vivodocumentModifier_ISFMemberFields
a <java:edu.cornell.mannlib.vitro.webapp.search.documentBuilding.VivoISFMemberFields> ,
<java:edu.cornell.mannlib.vitro.webapp.search.documentBuilding.DocumentModifier> .
:vivodocumentModifier_informationResourceContextNodeFields
a <java:edu.cornell.mannlib.vitro.webapp.search.documentBuilding.VivoInformationResourceContextNodeFields> ,
<java:edu.cornell.mannlib.vitro.webapp.search.documentBuilding.DocumentModifier> .

View file

@ -1,68 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE rdf [
<!ENTITY xsd "http://www.w3.org/2001/XMLSchema#">
]>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:owl="http://www.w3.org/2002/07/owl#"
xmlns="http://vitro.mannlib.cornell.edu/ns/vitro/public#"
xml:base="http://vitro.mannlib.cornell.edu/ns/vitro/public"
>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Vitro Application Public Ontology
This ontology is used by the Vitro application.
It contains constructs that are available for public export and use.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<owl:Ontology rdf:about="">
<owl:versionInfo rdf:datatype="&xsd;decimal">0.1</owl:versionInfo>
</owl:Ontology>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
File-related constructs
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<owl:Class rdf:about="#File"/>
<owl:Class rdf:about="#FileByteStream"/>
<owl:DatatypeProperty rdf:about="#filename">
<rdfs:domain><owl:Class rdf:about="#File"/></rdfs:domain>
<rdfs:range rdf:resource="&xsd;string"/>
</owl:DatatypeProperty>
<owl:DatatypeProperty rdf:about="#mimeType">
<rdfs:domain><owl:Class rdf:about="#File"/></rdfs:domain>
<rdfs:range rdf:resource="&xsd;string"/>
</owl:DatatypeProperty>
<owl:DatatypeProperty rdf:about="#attribution">
<rdfs:domain><owl:Class rdf:about="#File"/></rdfs:domain>
<rdfs:range rdf:resource="&xsd;string"/>
</owl:DatatypeProperty>
<owl:ObjectProperty rdf:about="#downloadLocation">
<rdfs:domain><owl:Class rdf:about="#File"/></rdfs:domain>
<rdfs:range><owl:Class rdf:about="#FileByteStream"/></rdfs:range>
</owl:ObjectProperty>
<owl:ObjectProperty rdf:about="#thumbnailImage">
<rdfs:domain><owl:Class rdf:about="#File"/></rdfs:domain>
<rdfs:range><owl:Class rdf:about="#File"/></rdfs:range>
</owl:ObjectProperty>
<owl:ObjectProperty rdf:about="#mainImage">
<rdfs:range><owl:Class rdf:about="#File"/></rdfs:range>
</owl:ObjectProperty>
<owl:ObjectProperty rdf:about="#image">
<rdfs:range><owl:Class rdf:about="#File"/></rdfs:range>
</owl:ObjectProperty>
</rdf:RDF>

View file

@ -34,6 +34,7 @@ import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import org.w3c.dom.NodeList; import org.w3c.dom.NodeList;
import edu.cornell.mannlib.vitro.webapp.application.ApplicationUtils;
import edu.cornell.mannlib.vitro.webapp.config.ConfigurationProperties; import edu.cornell.mannlib.vitro.webapp.config.ConfigurationProperties;
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest; import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.FreemarkerHttpServlet; import edu.cornell.mannlib.vitro.webapp.controller.freemarker.FreemarkerHttpServlet;
@ -213,13 +214,8 @@ public class FileHarvestController extends FreemarkerHttpServlet {
*/ */
private static String getUploadPathBase(ServletContext context) throws Exception private static String getUploadPathBase(ServletContext context) throws Exception
{ {
String vitroHomeDirectoryName = ConfigurationProperties.getBean(context).getProperty(FileStorageImplWrapper.PROPERTY_VITRO_HOME_DIR); String vitroHomeDirectoryName = ApplicationUtils.instance().getHomeDirectory().getPath().toString();
if (vitroHomeDirectoryName == null) { return vitroHomeDirectoryName + "/" + FileStorageImplWrapper.FILE_STORAGE_SUBDIRECTORY + "/" + PATH_TO_UPLOADS;
throw new Exception("Vitro home directory name could not be found.");
}
String pathBase = vitroHomeDirectoryName + "/" + FileStorageImplWrapper.FILE_STORAGE_SUBDIRECTORY + "/" + PATH_TO_UPLOADS;
return pathBase;
} }
/** /**

View file

@ -53,7 +53,7 @@ public class AddEditorRoleToPersonGenerator extends AddRoleToPersonTwoStageGener
/** Do not show the role label field for the AddEditorRoleToPerson form */ /** Do not show the role label field for the AddEditorRoleToPerson form */
@Override @Override
boolean isShowRoleLabelField() { return false; } boolean isShowRoleLabelField() { return true; }
/* /*
* Use the methods below to change the date/time precision in the * Use the methods below to change the date/time precision in the

View file

@ -12,6 +12,7 @@ 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.DatasetFactory;
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;
@ -26,12 +27,13 @@ import com.hp.hpl.jena.rdf.model.ResourceFactory;
import com.hp.hpl.jena.shared.Lock; import com.hp.hpl.jena.shared.Lock;
import edu.cornell.mannlib.vitro.webapp.beans.Individual; import edu.cornell.mannlib.vitro.webapp.beans.Individual;
import edu.cornell.mannlib.vitro.webapp.modelaccess.ContextModelAccess;
import edu.cornell.mannlib.vitro.webapp.modules.searchEngine.SearchInputDocument; import edu.cornell.mannlib.vitro.webapp.modules.searchEngine.SearchInputDocument;
import edu.cornell.mannlib.vitro.webapp.search.VitroSearchTermNames; import edu.cornell.mannlib.vitro.webapp.search.VitroSearchTermNames;
import edu.cornell.mannlib.vitro.webapp.search.documentBuilding.DocumentModifier; import edu.cornell.mannlib.vitro.webapp.utils.configuration.ContextModelsUser;
public class CalculateParameters implements DocumentModifier { public class CalculateParameters implements DocumentModifier, ContextModelsUser {
private boolean shutdown = false; private boolean shutdown = false;
private Dataset dataset; private Dataset dataset;
@ -60,13 +62,9 @@ public class CalculateParameters implements DocumentModifier {
private static Log log = LogFactory.getLog(CalculateParameters.class); private static Log log = LogFactory.getLog(CalculateParameters.class);
public CalculateParameters(Dataset dataset){ @Override
this.dataset =dataset; public void setContextModels(ContextModelAccess models) {
// new Thread(new TotalInd(this.dataset,totalCountQuery)).start(); this.dataset = DatasetFactory.create(models.getOntModel());
}
public CalculateParameters(){
super();
} }
public float calculateBeta(String uri){ public float calculateBeta(String uri){
@ -241,7 +239,7 @@ public class CalculateParameters implements DocumentModifier {
} }
@Override @Override
public void modifyDocument(Individual individual, SearchInputDocument doc, StringBuffer addUri) { public void modifyDocument(Individual individual, SearchInputDocument doc) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
// calculate beta value. // calculate beta value.
log.debug("Parameter calculation starts.."); log.debug("Parameter calculation starts..");

View file

@ -15,11 +15,11 @@ import com.hp.hpl.jena.query.ResultSet;
import com.hp.hpl.jena.rdf.model.RDFNode; import com.hp.hpl.jena.rdf.model.RDFNode;
import edu.cornell.mannlib.vitro.webapp.beans.Individual; import edu.cornell.mannlib.vitro.webapp.beans.Individual;
import edu.cornell.mannlib.vitro.webapp.modelaccess.ContextModelAccess;
import edu.cornell.mannlib.vitro.webapp.modules.searchEngine.SearchInputDocument; import edu.cornell.mannlib.vitro.webapp.modules.searchEngine.SearchInputDocument;
import edu.cornell.mannlib.vitro.webapp.rdfservice.RDFService; import edu.cornell.mannlib.vitro.webapp.rdfservice.RDFService;
import edu.cornell.mannlib.vitro.webapp.rdfservice.RDFServiceFactory;
import edu.cornell.mannlib.vitro.webapp.rdfservice.impl.RDFServiceUtils; import edu.cornell.mannlib.vitro.webapp.rdfservice.impl.RDFServiceUtils;
import edu.cornell.mannlib.vitro.webapp.search.documentBuilding.DocumentModifier; import edu.cornell.mannlib.vitro.webapp.utils.configuration.ContextModelsUser;
/** /**
* If there are any VCards on this Individual with Title objects, store the text * If there are any VCards on this Individual with Title objects, store the text
@ -28,7 +28,7 @@ import edu.cornell.mannlib.vitro.webapp.search.documentBuilding.DocumentModifier
* If there are any VCards on this Individual with EMail objects, store the text * If there are any VCards on this Individual with EMail objects, store the text
* in the ALL_TEXT field. * in the ALL_TEXT field.
*/ */
public class VIVOValuesFromVcards implements DocumentModifier { public class VIVOValuesFromVcards implements DocumentModifier, ContextModelsUser {
private static final Log log = LogFactory private static final Log log = LogFactory
.getLog(VIVOValuesFromVcards.class); .getLog(VIVOValuesFromVcards.class);
@ -77,16 +77,16 @@ public class VIVOValuesFromVcards implements DocumentModifier {
} }
}}; }};
private RDFServiceFactory rdfServiceFactory; private RDFService rdfService;
private boolean shutdown = false; private boolean shutdown = false;
public VIVOValuesFromVcards(RDFServiceFactory rdfServiceFactory) { @Override
this.rdfServiceFactory = rdfServiceFactory; public void setContextModels(ContextModelAccess models) {
this.rdfService = models.getRDFService();
} }
@Override @Override
public void modifyDocument(Individual individual, SearchInputDocument doc, public void modifyDocument(Individual individual, SearchInputDocument doc) {
StringBuffer addUri) {
if (individual == null) if (individual == null)
return; return;
@ -101,7 +101,6 @@ public class VIVOValuesFromVcards implements DocumentModifier {
String query = queryTemplate.replaceAll("\\?uri", uri); String query = queryTemplate.replaceAll("\\?uri", uri);
try { try {
RDFService rdfService = rdfServiceFactory.getRDFService();
ResultSet results = RDFServiceUtils.sparqlSelectQuery(query, ResultSet results = RDFServiceUtils.sparqlSelectQuery(query,
rdfService); rdfService);
if (results != null) { if (results != null) {

View file

@ -4,9 +4,6 @@ package edu.cornell.mannlib.vitro.webapp.search.documentBuilding;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import edu.cornell.mannlib.vitro.webapp.rdfservice.RDFServiceFactory;
import edu.cornell.mannlib.vitro.webapp.search.documentBuilding.ContextNodeFields;
/** /**
* Class that adds text from context nodes to Search Documents for * Class that adds text from context nodes to Search Documents for
* foaf:Agent individuals. * foaf:Agent individuals.
@ -15,8 +12,8 @@ public class VivoAgentContextNodeFields extends ContextNodeFields{
static List<String> queriesForAgent = new ArrayList<String>(); static List<String> queriesForAgent = new ArrayList<String>();
public VivoAgentContextNodeFields(RDFServiceFactory rdfServiceFactory){ public VivoAgentContextNodeFields(){
super(queriesForAgent,rdfServiceFactory); super(queriesForAgent);
} }
protected static final String prefix = protected static final String prefix =

View file

@ -1,72 +0,0 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webapp.search.documentBuilding;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import com.hp.hpl.jena.query.Dataset;
import com.hp.hpl.jena.query.DatasetFactory;
import edu.cornell.mannlib.vitro.webapp.modelaccess.ModelAccess;
import edu.cornell.mannlib.vitro.webapp.rdfservice.RDFServiceFactory;
import edu.cornell.mannlib.vitro.webapp.rdfservice.impl.RDFServiceUtils;
public class VivoDocumentModifiers implements javax.servlet.ServletContextListener{
/**
* Exclude from the search index individuals who's URIs start with these namespaces.
*/
private static final String[] INDIVIDUAL_NS_EXCLUDES={
//bdc34: seems that there are a lot of odd OBO things in the search, exclude them
"http://purl.obolibrary.org/obo/"
};
@SuppressWarnings("unchecked")
@Override
public void contextInitialized(ServletContextEvent sce) {
ServletContext context = sce.getServletContext();
RDFServiceFactory rdfServiceFactory = RDFServiceUtils.getRDFServiceFactory(context);
Dataset dataset = DatasetFactory.create(ModelAccess.on(context).getOntModel());
/* Put DocumentModifiers into servlet context for use later in startup by SearchSetup
* This adds the code for VIVO specific additions to the building
* of search input Documents. */
List<DocumentModifier> modifiers = (List<DocumentModifier>)context.getAttribute("DocumentModifiers");
if( modifiers == null ){
modifiers = new ArrayList<DocumentModifier>();
context.setAttribute("DocumentModifiers", modifiers);
}
modifiers.add(new CalculateParameters(dataset));
modifiers.add( new VIVOValuesFromVcards( rdfServiceFactory ));
modifiers.add( new VivoISFBasicFields( rdfServiceFactory ));
modifiers.add( new VivoISFAdvisingFields( rdfServiceFactory ));
modifiers.add( new VivoISFEducationFields( rdfServiceFactory ));
modifiers.add( new VivoISFGrantFields( rdfServiceFactory ));
modifiers.add( new VivoISFMemberFields( rdfServiceFactory ));
modifiers.add(new VivoInformationResourceContextNodeFields(rdfServiceFactory));
/*
* Add VIVO specific code that excludes Individuals from the search index.
*/
List<SearchIndexExcluder> excludes =
(List<SearchIndexExcluder>)context.getAttribute("SearchIndexExcludes");
if( excludes == null ){
excludes = new ArrayList<SearchIndexExcluder>();
context.setAttribute("SearchIndexExcludes", excludes);
}
excludes.add(new ExcludeBasedOnNamespace(INDIVIDUAL_NS_EXCLUDES ));
}
@Override
public void contextDestroyed(ServletContextEvent arg0) {
// do nothing.
}
}

View file

@ -5,9 +5,6 @@ package edu.cornell.mannlib.vitro.webapp.search.documentBuilding;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import edu.cornell.mannlib.vitro.webapp.rdfservice.RDFServiceFactory;
import edu.cornell.mannlib.vitro.webapp.search.documentBuilding.ContextNodeFields;
/** /**
* DocumentModifier for adding rdfs:labels of individuals related via * DocumentModifier for adding rdfs:labels of individuals related via
* a advising relationship. * a advising relationship.
@ -31,8 +28,8 @@ public class VivoISFAdvisingFields extends ContextNodeFields {
queries.add( makeQueryForPeople() ); queries.add( makeQueryForPeople() );
} }
public VivoISFAdvisingFields(RDFServiceFactory rdfServiceFactory){ public VivoISFAdvisingFields(){
super(queries,rdfServiceFactory); super(queries);
} }
/** /**

View file

@ -5,9 +5,6 @@ package edu.cornell.mannlib.vitro.webapp.search.documentBuilding;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import edu.cornell.mannlib.vitro.webapp.rdfservice.RDFServiceFactory;
import edu.cornell.mannlib.vitro.webapp.search.documentBuilding.ContextNodeFields;
/** /**
* DocumentModifier to populate Search index fields for the basic ISF relationships. * DocumentModifier to populate Search index fields for the basic ISF relationships.
* *
@ -23,8 +20,7 @@ public class VivoISFBasicFields extends ContextNodeFields {
* Subtypes of vivo:Relationship that get handled by this class. * Subtypes of vivo:Relationship that get handled by this class.
*/ */
private static String[] RELATIONSHIP_TYPES = { private static String[] RELATIONSHIP_TYPES = {
//VIVONS + "Relationship", VIVONS + "Position",
VIVONS + "Postion",
VIVONS + "Authorship", VIVONS + "Authorship",
VIVONS + "Collaboration", VIVONS + "Collaboration",
VIVONS + "Affiliation" VIVONS + "Affiliation"
@ -32,8 +28,8 @@ public class VivoISFBasicFields extends ContextNodeFields {
static List<String> queries = new ArrayList<String>(); static List<String> queries = new ArrayList<String>();
public VivoISFBasicFields(RDFServiceFactory rdfServiceFactory){ public VivoISFBasicFields(){
super(queries,rdfServiceFactory); super(queries);
} }
protected static final String prefix = protected static final String prefix =

View file

@ -5,9 +5,6 @@ package edu.cornell.mannlib.vitro.webapp.search.documentBuilding;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import edu.cornell.mannlib.vitro.webapp.rdfservice.RDFServiceFactory;
import edu.cornell.mannlib.vitro.webapp.search.documentBuilding.ContextNodeFields;
public class VivoISFEducationFields extends ContextNodeFields { public class VivoISFEducationFields extends ContextNodeFields {
private static String VIVONS = "http://vivoweb.org/ontology/core#"; private static String VIVONS = "http://vivoweb.org/ontology/core#";
@ -18,8 +15,8 @@ public class VivoISFEducationFields extends ContextNodeFields {
+ " prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> \n" + " prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> \n"
+ " prefix obo: <http://purl.obolibrary.org/obo/> \n" ; + " prefix obo: <http://purl.obolibrary.org/obo/> \n" ;
public VivoISFEducationFields(RDFServiceFactory rdfServiceFactory){ public VivoISFEducationFields(){
super(queries,rdfServiceFactory); super(queries);
} }
/** /**

View file

@ -5,9 +5,6 @@ package edu.cornell.mannlib.vitro.webapp.search.documentBuilding;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import edu.cornell.mannlib.vitro.webapp.rdfservice.RDFServiceFactory;
import edu.cornell.mannlib.vitro.webapp.search.documentBuilding.ContextNodeFields;
/* /*
* This DocumentModifier is for the ISF style grants. * This DocumentModifier is for the ISF style grants.
* It will * It will
@ -30,8 +27,8 @@ public class VivoISFGrantFields extends ContextNodeFields {
+ " prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> \n" + " prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> \n"
+ " prefix obo: <http://purl.obolibrary.org/obo/> \n" ; + " prefix obo: <http://purl.obolibrary.org/obo/> \n" ;
public VivoISFGrantFields(RDFServiceFactory rdfServiceFactory){ public VivoISFGrantFields(){
super(queries,rdfServiceFactory); super(queries);
} }
/** /**

View file

@ -5,9 +5,6 @@ package edu.cornell.mannlib.vitro.webapp.search.documentBuilding;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import edu.cornell.mannlib.vitro.webapp.rdfservice.RDFServiceFactory;
import edu.cornell.mannlib.vitro.webapp.search.documentBuilding.ContextNodeFields;
/** /**
* This class will: * This class will:
* add people's names to organization's search Documents. * add people's names to organization's search Documents.
@ -26,8 +23,8 @@ public class VivoISFMemberFields extends ContextNodeFields {
+ " prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> \n" + " prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> \n"
+ " prefix obo: <http://purl.obolibrary.org/obo/> \n" ; + " prefix obo: <http://purl.obolibrary.org/obo/> \n" ;
public VivoISFMemberFields(RDFServiceFactory rdfServiceFactory){ public VivoISFMemberFields(){
super(queries,rdfServiceFactory); super(queries);
} }
/** /**
@ -37,7 +34,7 @@ public class VivoISFMemberFields extends ContextNodeFields {
prefix + prefix +
"SELECT (str(?rawresult) as ?result) WHERE {\n" + "SELECT (str(?rawresult) as ?result) WHERE {\n" +
" ?uri rdf:type foaf:Organization . \n" + " ?uri rdf:type foaf:Organization . \n" +
" ?role core:roleContrigutesTo ?uri . \n" + " ?role core:roleContributesTo ?uri . \n" +
" ?person obo:RO_0000053 ?role . \n" + " ?person obo:RO_0000053 ?role . \n" +
" ?person rdfs:label ?rawresult .\n" + " ?person rdfs:label ?rawresult .\n" +
"}"; "}";
@ -49,7 +46,7 @@ public class VivoISFMemberFields extends ContextNodeFields {
prefix + prefix +
"SELECT (str(?rawresult) as ?result) WHERE {\n" + "SELECT (str(?rawresult) as ?result) WHERE {\n" +
" ?uri rdf:type foaf:Person . \n" + " ?uri rdf:type foaf:Person . \n" +
" ?uri obo:RO_0000053 / core:roleContrigutesTo / rdfs:label ?rawresult . \n" + " ?uri obo:RO_0000053 / core:roleContributesTo / rdfs:label ?rawresult . \n" +
"}"; "}";

View file

@ -4,9 +4,6 @@ package edu.cornell.mannlib.vitro.webapp.search.documentBuilding;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import edu.cornell.mannlib.vitro.webapp.rdfservice.RDFServiceFactory;
import edu.cornell.mannlib.vitro.webapp.search.documentBuilding.ContextNodeFields;
/** /**
* Class that adds text from context nodes to search index Documents for * Class that adds text from context nodes to search index Documents for
* obo:IAO_0000030 individuals. * obo:IAO_0000030 individuals.
@ -18,8 +15,8 @@ public class VivoInformationResourceContextNodeFields extends ContextNodeFields{
static List<String> queriesForInformationResource = new ArrayList<String>(); static List<String> queriesForInformationResource = new ArrayList<String>();
public VivoInformationResourceContextNodeFields(RDFServiceFactory rdfServiceFactory){ public VivoInformationResourceContextNodeFields(){
super(queriesForInformationResource, rdfServiceFactory); super(queriesForInformationResource);
} }
protected static final String prefix = protected static final String prefix =

View file

@ -9,6 +9,8 @@ import java.io.InputStream;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.junit.Test; import org.junit.Test;
import stubs.edu.cornell.mannlib.vitro.webapp.modelaccess.ContextModelAccessStub;
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 com.hp.hpl.jena.rdf.model.Property; import com.hp.hpl.jena.rdf.model.Property;
@ -18,17 +20,14 @@ import com.hp.hpl.jena.rdf.model.ResourceFactory;
import edu.cornell.mannlib.vitro.testing.AbstractTestClass; import edu.cornell.mannlib.vitro.testing.AbstractTestClass;
import edu.cornell.mannlib.vitro.webapp.beans.Individual; import edu.cornell.mannlib.vitro.webapp.beans.Individual;
import edu.cornell.mannlib.vitro.webapp.beans.IndividualImpl; import edu.cornell.mannlib.vitro.webapp.beans.IndividualImpl;
import edu.cornell.mannlib.vitro.webapp.rdfservice.RDFService; import edu.cornell.mannlib.vitro.webapp.modelaccess.ModelAccess.WhichService;
import edu.cornell.mannlib.vitro.webapp.rdfservice.RDFServiceFactory;
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 ContextModelAccessStub contextModels;
static RDFServiceFactory rdfServiceFactory;
@BeforeClass @BeforeClass
public static void setup(){ public static void setup(){
@ -44,8 +43,8 @@ public class VivoAgentContextNodeFieldsTest extends AbstractTestClass{
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); contextModels = new ContextModelAccessStub();
rdfServiceFactory = new RDFServiceFactorySingle(rdfService); contextModels.setRDFService(WhichService.CONTENT, new RDFServiceModel(m));
} }
@Test @Test
@ -53,7 +52,8 @@ public class VivoAgentContextNodeFieldsTest extends AbstractTestClass{
Individual ind = new IndividualImpl(); Individual ind = new IndividualImpl();
ind.setURI(SPCA); ind.setURI(SPCA);
VivoAgentContextNodeFields vacnf = new VivoAgentContextNodeFields(rdfServiceFactory); VivoAgentContextNodeFields vacnf = new VivoAgentContextNodeFields();
vacnf.setContextModels(contextModels);
StringBuffer sb = vacnf.getValues( ind ); StringBuffer sb = vacnf.getValues( ind );
assertNotNull( sb ); assertNotNull( sb );
@ -68,7 +68,8 @@ public class VivoAgentContextNodeFieldsTest extends AbstractTestClass{
Individual ind = new IndividualImpl(); Individual ind = new IndividualImpl();
ind.setURI(SPCA); ind.setURI(SPCA);
VivoAgentContextNodeFields vacnf = new VivoAgentContextNodeFields(rdfServiceFactory); VivoAgentContextNodeFields vacnf = new VivoAgentContextNodeFields();
vacnf.setContextModels(contextModels);
StringBuffer sb = vacnf.getValues( ind ); StringBuffer sb = vacnf.getValues( ind );
assertNotNull( sb ); assertNotNull( sb );
@ -83,7 +84,8 @@ public class VivoAgentContextNodeFieldsTest extends AbstractTestClass{
Individual ind = new IndividualImpl(); Individual ind = new IndividualImpl();
ind.setURI(SPCA); ind.setURI(SPCA);
VivoAgentContextNodeFields vacnf = new VivoAgentContextNodeFields(rdfServiceFactory); VivoAgentContextNodeFields vacnf = new VivoAgentContextNodeFields();
vacnf.setContextModels(contextModels);
StringBuffer sb = vacnf.getValues( ind ); StringBuffer sb = vacnf.getValues( ind );
assertNotNull( sb ); assertNotNull( sb );

View file

@ -10,6 +10,8 @@ import org.apache.commons.lang.StringUtils;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.junit.Test; import org.junit.Test;
import stubs.edu.cornell.mannlib.vitro.webapp.modelaccess.ContextModelAccessStub;
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 com.hp.hpl.jena.rdf.model.Property; import com.hp.hpl.jena.rdf.model.Property;
@ -19,9 +21,7 @@ import com.hp.hpl.jena.rdf.model.ResourceFactory;
import edu.cornell.mannlib.vitro.testing.AbstractTestClass; import edu.cornell.mannlib.vitro.testing.AbstractTestClass;
import edu.cornell.mannlib.vitro.webapp.beans.Individual; import edu.cornell.mannlib.vitro.webapp.beans.Individual;
import edu.cornell.mannlib.vitro.webapp.beans.IndividualImpl; import edu.cornell.mannlib.vitro.webapp.beans.IndividualImpl;
import edu.cornell.mannlib.vitro.webapp.rdfservice.RDFService; import edu.cornell.mannlib.vitro.webapp.modelaccess.ModelAccess.WhichService;
import edu.cornell.mannlib.vitro.webapp.rdfservice.RDFServiceFactory;
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;
/** /**
@ -32,8 +32,7 @@ import edu.cornell.mannlib.vitro.webapp.rdfservice.impl.jena.model.RDFServiceMod
public class VivoAgentContextNodeFieldsTest2 extends AbstractTestClass{ public class VivoAgentContextNodeFieldsTest2 extends AbstractTestClass{
static String HISTORY_DEPT = "http://vivo.colorado.edu/deptid_10238" ; static String HISTORY_DEPT = "http://vivo.colorado.edu/deptid_10238" ;
static ContextModelAccessStub contextModels;
static RDFServiceFactory rdfServiceFactory;
@BeforeClass @BeforeClass
public static void setup(){ public static void setup(){
@ -52,8 +51,8 @@ public class VivoAgentContextNodeFieldsTest2 extends AbstractTestClass{
assertTrue("expect statements about HISTORY_DEPT", assertTrue("expect statements about HISTORY_DEPT",
m.contains(ResourceFactory.createResource(HISTORY_DEPT),(Property) null,(RDFNode) null)); m.contains(ResourceFactory.createResource(HISTORY_DEPT),(Property) null,(RDFNode) null));
RDFService rdfService = new RDFServiceModel(m); contextModels = new ContextModelAccessStub();
rdfServiceFactory = new RDFServiceFactorySingle(rdfService); contextModels.setRDFService(WhichService.CONTENT, new RDFServiceModel(m));
} }
/** /**
@ -65,7 +64,8 @@ public class VivoAgentContextNodeFieldsTest2 extends AbstractTestClass{
Individual ind = new IndividualImpl(); Individual ind = new IndividualImpl();
ind.setURI(HISTORY_DEPT); ind.setURI(HISTORY_DEPT);
VivoAgentContextNodeFields vacnf = new VivoAgentContextNodeFields(rdfServiceFactory); VivoAgentContextNodeFields vacnf = new VivoAgentContextNodeFields();
vacnf.setContextModels(contextModels);
StringBuffer sb = vacnf.getValues( ind ); StringBuffer sb = vacnf.getValues( ind );
assertNotNull( sb ); assertNotNull( sb );

View file

@ -9,6 +9,7 @@ import java.util.Collection;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import stubs.edu.cornell.mannlib.vitro.webapp.modelaccess.ContextModelAccessStub;
import stubs.edu.cornell.mannlib.vitro.webapp.modules.ApplicationStub; import stubs.edu.cornell.mannlib.vitro.webapp.modules.ApplicationStub;
import stubs.edu.cornell.mannlib.vitro.webapp.modules.searchEngine.SearchEngineStub; import stubs.edu.cornell.mannlib.vitro.webapp.modules.searchEngine.SearchEngineStub;
import stubs.javax.servlet.ServletContextStub; import stubs.javax.servlet.ServletContextStub;
@ -23,10 +24,8 @@ import edu.cornell.mannlib.vitro.webapp.application.ApplicationUtils;
import edu.cornell.mannlib.vitro.webapp.beans.Individual; import edu.cornell.mannlib.vitro.webapp.beans.Individual;
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory; import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
import edu.cornell.mannlib.vitro.webapp.dao.jena.WebappDaoFactoryJena; import edu.cornell.mannlib.vitro.webapp.dao.jena.WebappDaoFactoryJena;
import edu.cornell.mannlib.vitro.webapp.modelaccess.ModelAccess.WhichService;
import edu.cornell.mannlib.vitro.webapp.modules.searchEngine.SearchInputDocument; import edu.cornell.mannlib.vitro.webapp.modules.searchEngine.SearchInputDocument;
import edu.cornell.mannlib.vitro.webapp.rdfservice.RDFService;
import edu.cornell.mannlib.vitro.webapp.rdfservice.RDFServiceFactory;
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 VivoInformationResourceContextNodeFieldsTest extends AbstractTestClass { public class VivoInformationResourceContextNodeFieldsTest extends AbstractTestClass {
@ -55,21 +54,24 @@ public class VivoInformationResourceContextNodeFieldsTest extends AbstractTestCl
Individual ind = wadf.getIndividualDao().getIndividualByURI(DOCUMENT_URI); Individual ind = wadf.getIndividualDao().getIndividualByURI(DOCUMENT_URI);
Assert.assertNotNull(ind); Assert.assertNotNull(ind);
RDFService rdfService = new RDFServiceModel(ontModel); ContextModelAccessStub contextModels = new ContextModelAccessStub();
RDFServiceFactory rdfServiceFactory = new RDFServiceFactorySingle(rdfService); contextModels.setRDFService(WhichService.CONTENT, new RDFServiceModel(ontModel));
SearchInputDocument doc = ApplicationUtils.instance().getSearchEngine().createInputDocument(); SearchInputDocument doc = ApplicationUtils.instance().getSearchEngine().createInputDocument();
doc.addField("ALLTEXT", ""); doc.addField("ALLTEXT", "");
VivoInformationResourceContextNodeFields vircnf = new VivoInformationResourceContextNodeFields(rdfServiceFactory); VivoInformationResourceContextNodeFields vircnf = new VivoInformationResourceContextNodeFields();
vircnf.modifyDocument(ind, doc, new StringBuffer()); vircnf.setContextModels(contextModels);
vircnf.modifyDocument(ind, doc);
Collection<Object> values = doc.getField("ALLTEXT").getValues(); Collection<Object> values = doc.getField("ALLTEXT").getValues();
for( Object value : values){ for( Object value : values){
Assert.assertFalse("rdf:label erroneously added by document modifier:", value.toString().contains(RDFS_LABEL_VALUE)); Assert.assertFalse("rdf:label erroneously added by document modifier:", value.toString().contains(RDFS_LABEL_VALUE));
} }
VivoAgentContextNodeFields vacnf = new VivoAgentContextNodeFields(rdfServiceFactory); VivoAgentContextNodeFields vacnf = new VivoAgentContextNodeFields();
vacnf.modifyDocument(ind, doc, new StringBuffer()); vacnf.setContextModels(contextModels);
vacnf.modifyDocument(ind, doc);
} }