Merge branch 'develop' of github.com:vivo-project/VIVO into develop
This commit is contained in:
commit
957b6345e7
15 changed files with 554 additions and 82 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -6,4 +6,5 @@
|
|||
/deploy.properties
|
||||
/build.properties
|
||||
/runtime.properties
|
||||
catalog-v001.xml
|
||||
/ontology/public/catalog-v0001.xml
|
||||
|
||||
|
|
47
productMods/WEB-INF/filegraph/tbox/ConceptSemanticType.owl
Normal file
47
productMods/WEB-INF/filegraph/tbox/ConceptSemanticType.owl
Normal file
|
@ -0,0 +1,47 @@
|
|||
<rdf:RDF
|
||||
xmlns:vitro-public="http://vitro.mannlib.cornell.edu/ns/vitro/public#"
|
||||
xmlns:c4o="http://purl.org/spar/c4o/"
|
||||
xmlns:ero="http://purl.obolibrary.org/obo/"
|
||||
xmlns:pvs="http://vivoweb.org/ontology/provenance-support#"
|
||||
xmlns:owl2="http://www.w3.org/2006/12/owl2-xml#"
|
||||
xmlns:scirr="http://vivoweb.org/ontology/scientific-research-resource#"
|
||||
xmlns:vivo="http://vivoweb.org/ontology/core#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:bibo="http://purl.org/ontology/bibo/"
|
||||
xmlns:afn="http://jena.hpl.hp.com/ARQ/function#"
|
||||
xmlns:foaf="http://xmlns.com/foaf/0.1/"
|
||||
xmlns:scires="http://vivoweb.org/ontology/scientific-research#"
|
||||
xmlns:dcterms="http://purl.org/dc/terms/"
|
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
|
||||
xmlns:geo="http://aims.fao.org/aos/geopolitical.owl#"
|
||||
xmlns:skco="http://www.w3.org/2004/02/skos/core#"
|
||||
xmlns:event="http://purl.org/NET/c4dm/event.owl#"
|
||||
xmlns:dcelem="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:vitro="http://vitro.mannlib.cornell.edu/ns/vitro/0.7#"
|
||||
xmlns:vann="http://purl.org/vocab/vann/"
|
||||
xmlns:skos="http://www.w3.org/2008/05/skos#"
|
||||
xmlns:swvs="http://www.w3.org/2003/06/sw-vocab-status/ns#"
|
||||
xmlns:owl="http://www.w3.org/2002/07/owl#"
|
||||
xmlns:fabio="http://purl.org/spar/fabio/"
|
||||
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">
|
||||
|
||||
<owl:versionInfo rdf:datatype="http://www.w3.org/2001/XMLSchema#decimal"
|
||||
>0.7</owl:versionInfo>
|
||||
|
||||
|
||||
<owl:Class rdf:about="http://vivoweb.org/ontology/core#ConceptSemanticType">
|
||||
<vitro:exampleAnnot rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
|
||||
>Semantic Type for given concept, for example UMLS's type returned for concepts</vitro:exampleAnnot>
|
||||
<vitro:descriptionAnnot rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
|
||||
>Semantic Type for given concept, for example UMLS's type returned for concepts.</vitro:descriptionAnnot>
|
||||
|
||||
<vitro:shortDef rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
|
||||
>Concept Semantic Type</vitro:shortDef>
|
||||
</owl:Class>
|
||||
|
||||
<owl:ObjectProperty rdf:about="http://vivoweb.org/ontology/core#hasConceptSemanticType">
|
||||
<rdfs:range rdf:resource="http://vivoweb.org/ontology/core#ConceptSemanticType"/>
|
||||
<owl:inverseOf rdf:resource="http://vivoweb.org/ontology/core#isConceptSemanticTypeOf"/>
|
||||
</owl:ObjectProperty>
|
||||
|
||||
</rdf:RDF>
|
|
@ -9,6 +9,7 @@ $(document).ready(function(){
|
|||
|
||||
$.extend(this, urlsBase);
|
||||
$.extend(this, i18nStrings);
|
||||
$.extend(this, geoResearcherCount);
|
||||
|
||||
getGeoJsonForMaps();
|
||||
|
||||
|
@ -368,7 +369,7 @@ $(document).ready(function(){
|
|||
|
||||
function getResearcherCount(area) {
|
||||
|
||||
var researcherCount = 0;
|
||||
var researcherCount = this.geoResearcherCount;
|
||||
var areaCount = 0;
|
||||
var text = "";
|
||||
if ( area == "global" ) {
|
||||
|
@ -383,7 +384,6 @@ $(document).ready(function(){
|
|||
|
||||
$.each(researchAreas.features, function() {
|
||||
if ( this.properties.mapType == area ) {
|
||||
researcherCount = researcherCount + this.properties.html ;
|
||||
areaCount = areaCount + 1;
|
||||
}
|
||||
});
|
||||
|
@ -391,10 +391,16 @@ $(document).ready(function(){
|
|||
if ( areaCount == 1 && text == " states.") {
|
||||
text = " " + i18nStrings.stateString;
|
||||
}
|
||||
if ( researcherCount == 1 ) {
|
||||
researcherText = " " + i18nStrings.researcherString + " " + i18nStrings.inString;
|
||||
}
|
||||
else {
|
||||
researcherText = " " + i18nStrings.researcherInString
|
||||
}
|
||||
|
||||
$('div#researcherTotal').html("<font style='font-size:1.05em;color:#167093'>"
|
||||
+ researcherCount.toString().replace(/(\d+)(\d{3})/, '$1'+','+'$2')
|
||||
+ "</font> " + i18nStrings.researchersInString + " <font style='font-size:1.05em;color:#167093'>"
|
||||
+ researcherCount
|
||||
+ "</font> " + researcherText + " <font style='font-size:1.05em;color:#167093'>"
|
||||
+ areaCount + "</font>" + text);
|
||||
}
|
||||
function appendLegendToLeafletContainer() {
|
||||
|
|
|
@ -69,22 +69,25 @@ $(document).ready(function(){
|
|||
location.hash = location.hash.replace(/\s+/g, '');
|
||||
if ( location.hash.indexOf("map") >= 0 ) {
|
||||
// get the name of the group that contains the geographicFocusOf property.
|
||||
var tabName = $('h3#geographicFocusOf').parent('article').parent('div').attr("id");
|
||||
tabName = tabName.replace("Group","");
|
||||
tabNameCapped = tabName.charAt(0).toUpperCase() + tabName.slice(1);
|
||||
// if the name of the first tab section = tabName we don't have to do anything;
|
||||
// otherwise, select the correct tab and deselect the first one
|
||||
var $firstTab = $('li.clickable').first();
|
||||
if ( $firstTab.text() != tabNameCapped ) {
|
||||
// select the correct tab
|
||||
$('li[groupName="' + tabName + '"]').removeClass("nonSelectedGroupTab clickable");
|
||||
$('li[groupName="' + tabName + '"]').addClass("selectedGroupTab clickable");
|
||||
// deselect the first tab
|
||||
$firstTab.removeClass("selectedGroupTab clickable");
|
||||
$firstTab.addClass("nonSelectedGroupTab clickable");
|
||||
$('section.property-group:visible').hide();
|
||||
// show the selected tab section
|
||||
$('section#' + tabName).show();
|
||||
// if it doesn't exist, don't do anything.
|
||||
if ( $('h3#geographicFocusOf').length ) {
|
||||
var tabName = $('h3#geographicFocusOf').parent('article').parent('div').attr("id");
|
||||
tabName = tabName.replace("Group","");
|
||||
tabNameCapped = tabName.charAt(0).toUpperCase() + tabName.slice(1);
|
||||
// if the name of the first tab section = tabName we don't have to do anything;
|
||||
// otherwise, select the correct tab and deselect the first one
|
||||
var $firstTab = $('li.clickable').first();
|
||||
if ( $firstTab.text() != tabNameCapped ) {
|
||||
// select the correct tab
|
||||
$('li[groupName="' + tabName + '"]').removeClass("nonSelectedGroupTab clickable");
|
||||
$('li[groupName="' + tabName + '"]').addClass("selectedGroupTab clickable");
|
||||
// deselect the first tab
|
||||
$firstTab.removeClass("selectedGroupTab clickable");
|
||||
$firstTab.addClass("nonSelectedGroupTab clickable");
|
||||
$('section.property-group:visible').hide();
|
||||
// show the selected tab section
|
||||
$('section#' + tabName).show();
|
||||
}
|
||||
}
|
||||
// if there is a more link, "click" more to show all the researchers
|
||||
// we need the timeout delay so that the more link can get rendered
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,6 +1,6 @@
|
|||
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
|
||||
|
||||
<#-- List of positions for the individual --> <h3>Positions!${core}personInPosition</h3>
|
||||
<#-- List of positions for the individual -->
|
||||
<#assign positions = propertyGroups.pullProperty("${core}personInPosition")!>
|
||||
<#if positions?has_content> <#-- true when the property is in the list, even if not populated (when editing) -->
|
||||
<#assign localName = positions.localName>
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
<#-- List of research areas for the individual -->
|
||||
<#assign researchAreas = propertyGroups.pullProperty("${core}hasResearchArea")!>
|
||||
<#assign concepts = propertyGroups.pullProperty("${core}hasAssociatedConcept")!>
|
||||
<#if concepts?has_content> concepts has content <#else> concepts dont have content</#if>
|
||||
<h2>RESEARCH AREAS: ${core}hasResearchArea</h2>
|
||||
<#if researchAreas?has_content> <#-- true when the property is in the list, even if not populated (when editing) -->
|
||||
<#assign localName = researchAreas.localName>
|
||||
<h2 id="${localName}" class="mainPropGroup">
|
||||
|
@ -14,5 +12,5 @@
|
|||
</h2>
|
||||
<ul id="individual-${localName}" role="list" >
|
||||
<@p.objectProperty researchAreas editable />
|
||||
</ul> <#else> Research areas does not have content
|
||||
</ul>
|
||||
</#if>
|
||||
|
|
|
@ -281,7 +281,7 @@ var addConceptForm = {
|
|||
generateIndividualLabelsDisplay:function(label, altLabels) {
|
||||
var labelDisplay = label;
|
||||
if(altLabels != null && altLabels.length > 0) {
|
||||
labelDisplay += "<br>(" + altLabels + ")";
|
||||
labelDisplay += "<br> [" + altLabels + "]";
|
||||
}
|
||||
return labelDisplay;
|
||||
},
|
||||
|
|
|
@ -205,3 +205,16 @@ var urlsBase = "${urls.base}";
|
|||
</section>
|
||||
</#macro>
|
||||
|
||||
<#-- retrieves a count, the number of researchers with a geographic focus, -->
|
||||
<#-- and saves it as a js variable to be used by the homePageMaps.js file -->
|
||||
<#macro getGeoResearcherCount>
|
||||
<script>
|
||||
|
||||
<#if researcherCountDG?has_content>
|
||||
<#assign theCount = researcherCountDG[0].count />
|
||||
<#else>
|
||||
<#assign theCount = 0 />
|
||||
</#if>
|
||||
var geoResearcherCount = ${theCount};
|
||||
</script>
|
||||
</#macro>
|
||||
|
|
|
@ -6,201 +6,303 @@
|
|||
<rdf:Description rdf:about="http://dbpedia.org/resource/Alabama">
|
||||
<rdf:type rdf:resource="http://vivoweb.org/ontology/core#StateOrProvince"/>
|
||||
<rdfs:label xml:lang="en">Alabama</rdfs:label>
|
||||
<vivo:geographicallyWithin rdf:resource="http://aims.fao.org/aos/geopolitical.owl#United_States_of_America"/>
|
||||
</rdf:Description>
|
||||
<rdf:Description rdf:about="http://dbpedia.org/resource/Alaska">
|
||||
<rdf:type rdf:resource="http://vivoweb.org/ontology/core#StateOrProvince"/>
|
||||
<rdfs:label xml:lang="en">Alaska</rdfs:label>
|
||||
<vivo:geographicallyWithin rdf:resource="http://aims.fao.org/aos/geopolitical.owl#United_States_of_America"/>
|
||||
</rdf:Description>
|
||||
<rdf:Description rdf:about="http://dbpedia.org/resource/Arizona">
|
||||
<rdf:type rdf:resource="http://vivoweb.org/ontology/core#StateOrProvince"/>
|
||||
<rdfs:label xml:lang="en">Arizona</rdfs:label>
|
||||
<vivo:geographicallyWithin rdf:resource="http://aims.fao.org/aos/geopolitical.owl#United_States_of_America"/>
|
||||
</rdf:Description>
|
||||
<rdf:Description rdf:about="http://dbpedia.org/resource/Arkansas">
|
||||
<rdf:type rdf:resource="http://vivoweb.org/ontology/core#StateOrProvince"/>
|
||||
<rdfs:label xml:lang="en">Arkansas</rdfs:label>
|
||||
<vivo:geographicallyWithin rdf:resource="http://aims.fao.org/aos/geopolitical.owl#United_States_of_America"/>
|
||||
</rdf:Description>
|
||||
<rdf:Description rdf:about="http://dbpedia.org/resource/California">
|
||||
<rdf:type rdf:resource="http://vivoweb.org/ontology/core#StateOrProvince"/>
|
||||
<rdfs:label xml:lang="en">California</rdfs:label>
|
||||
<vivo:geographicallyWithin rdf:resource="http://aims.fao.org/aos/geopolitical.owl#United_States_of_America"/>
|
||||
</rdf:Description>
|
||||
<rdf:Description rdf:about="http://dbpedia.org/resource/Colorado">
|
||||
<rdf:type rdf:resource="http://vivoweb.org/ontology/core#StateOrProvince"/>
|
||||
<rdfs:label xml:lang="en">Colorado</rdfs:label>
|
||||
<vivo:geographicallyWithin rdf:resource="http://aims.fao.org/aos/geopolitical.owl#United_States_of_America"/>
|
||||
</rdf:Description>
|
||||
<rdf:Description rdf:about="http://dbpedia.org/resource/Connecticut">
|
||||
<rdf:type rdf:resource="http://vivoweb.org/ontology/core#StateOrProvince"/>
|
||||
<rdfs:label xml:lang="en">Connecticut</rdfs:label>
|
||||
<vivo:geographicallyWithin rdf:resource="http://aims.fao.org/aos/geopolitical.owl#United_States_of_America"/>
|
||||
</rdf:Description>
|
||||
<rdf:Description rdf:about="http://dbpedia.org/resource/Delaware">
|
||||
<rdf:type rdf:resource="http://vivoweb.org/ontology/core#StateOrProvince"/>
|
||||
<rdfs:label xml:lang="en">Delaware</rdfs:label>
|
||||
<vivo:geographicallyWithin rdf:resource="http://aims.fao.org/aos/geopolitical.owl#United_States_of_America"/>
|
||||
</rdf:Description>
|
||||
<rdf:Description rdf:about="http://dbpedia.org/resource/Florida">
|
||||
<rdf:type rdf:resource="http://vivoweb.org/ontology/core#StateOrProvince"/>
|
||||
<rdfs:label xml:lang="en">Florida</rdfs:label>
|
||||
<vivo:geographicallyWithin rdf:resource="http://aims.fao.org/aos/geopolitical.owl#United_States_of_America"/>
|
||||
</rdf:Description>
|
||||
<rdf:Description rdf:about="http://dbpedia.org/resource/Georgia">
|
||||
<rdf:type rdf:resource="http://vivoweb.org/ontology/core#StateOrProvince"/>
|
||||
<rdfs:label xml:lang="en">Georgia</rdfs:label>
|
||||
<vivo:geographicallyWithin rdf:resource="http://aims.fao.org/aos/geopolitical.owl#United_States_of_America"/>
|
||||
</rdf:Description>
|
||||
<rdf:Description rdf:about="http://dbpedia.org/resource/Hawaii">
|
||||
<rdf:type rdf:resource="http://vivoweb.org/ontology/core#StateOrProvince"/>
|
||||
<rdfs:label xml:lang="en">Hawaii</rdfs:label>
|
||||
<vivo:geographicallyWithin rdf:resource="http://aims.fao.org/aos/geopolitical.owl#United_States_of_America"/>
|
||||
</rdf:Description>
|
||||
<rdf:Description rdf:about="http://dbpedia.org/resource/Idaho">
|
||||
<rdf:type rdf:resource="http://vivoweb.org/ontology/core#StateOrProvince"/>
|
||||
<rdfs:label xml:lang="en">Idaho</rdfs:label>
|
||||
<vivo:geographicallyWithin rdf:resource="http://aims.fao.org/aos/geopolitical.owl#United_States_of_America"/>
|
||||
</rdf:Description>
|
||||
<rdf:Description rdf:about="http://dbpedia.org/resource/Illinois">
|
||||
<rdf:type rdf:resource="http://vivoweb.org/ontology/core#StateOrProvince"/>
|
||||
<rdfs:label xml:lang="en">Illinois</rdfs:label>
|
||||
<vivo:geographicallyWithin rdf:resource="http://aims.fao.org/aos/geopolitical.owl#United_States_of_America"/>
|
||||
</rdf:Description>
|
||||
<rdf:Description rdf:about="http://dbpedia.org/resource/Indiana">
|
||||
<rdf:type rdf:resource="http://vivoweb.org/ontology/core#StateOrProvince"/>
|
||||
<rdfs:label xml:lang="en">Indiana</rdfs:label>
|
||||
<vivo:geographicallyWithin rdf:resource="http://aims.fao.org/aos/geopolitical.owl#United_States_of_America"/>
|
||||
</rdf:Description>
|
||||
<rdf:Description rdf:about="http://dbpedia.org/resource/Iowa">
|
||||
<rdf:type rdf:resource="http://vivoweb.org/ontology/core#StateOrProvince"/>
|
||||
<rdfs:label xml:lang="en">Iowa</rdfs:label>
|
||||
<vivo:geographicallyWithin rdf:resource="http://aims.fao.org/aos/geopolitical.owl#United_States_of_America"/>
|
||||
</rdf:Description>
|
||||
<rdf:Description rdf:about="http://dbpedia.org/resource/Kansas">
|
||||
<rdf:type rdf:resource="http://vivoweb.org/ontology/core#StateOrProvince"/>
|
||||
<rdfs:label xml:lang="en">Kansas</rdfs:label>
|
||||
<vivo:geographicallyWithin rdf:resource="http://aims.fao.org/aos/geopolitical.owl#United_States_of_America"/>
|
||||
</rdf:Description>
|
||||
<rdf:Description rdf:about="http://dbpedia.org/resource/Kentucky">
|
||||
<rdf:type rdf:resource="http://vivoweb.org/ontology/core#StateOrProvince"/>
|
||||
<rdfs:label xml:lang="en">Kentucky</rdfs:label>
|
||||
<vivo:geographicallyWithin rdf:resource="http://aims.fao.org/aos/geopolitical.owl#United_States_of_America"/>
|
||||
</rdf:Description>
|
||||
<rdf:Description rdf:about="http://dbpedia.org/resource/Louisiana">
|
||||
<rdf:type rdf:resource="http://vivoweb.org/ontology/core#StateOrProvince"/>
|
||||
<rdfs:label xml:lang="en">Louisiana</rdfs:label>
|
||||
<vivo:geographicallyWithin rdf:resource="http://aims.fao.org/aos/geopolitical.owl#United_States_of_America"/>
|
||||
</rdf:Description>
|
||||
<rdf:Description rdf:about="http://dbpedia.org/resource/Maine">
|
||||
<rdf:type rdf:resource="http://vivoweb.org/ontology/core#StateOrProvince"/>
|
||||
<rdfs:label xml:lang="en">Maine</rdfs:label>
|
||||
<vivo:geographicallyWithin rdf:resource="http://aims.fao.org/aos/geopolitical.owl#United_States_of_America"/>
|
||||
</rdf:Description>
|
||||
<rdf:Description rdf:about="http://dbpedia.org/resource/Maryland">
|
||||
<rdf:type rdf:resource="http://vivoweb.org/ontology/core#StateOrProvince"/>
|
||||
<rdfs:label xml:lang="en">Maryland</rdfs:label>
|
||||
<vivo:geographicallyWithin rdf:resource="http://aims.fao.org/aos/geopolitical.owl#United_States_of_America"/>
|
||||
</rdf:Description>
|
||||
<rdf:Description rdf:about="http://dbpedia.org/resource/Massachusetts">
|
||||
<rdf:type rdf:resource="http://vivoweb.org/ontology/core#StateOrProvince"/>
|
||||
<rdfs:label xml:lang="en">Massachusetts</rdfs:label>
|
||||
<vivo:geographicallyWithin rdf:resource="http://aims.fao.org/aos/geopolitical.owl#United_States_of_America"/>
|
||||
</rdf:Description>
|
||||
<rdf:Description rdf:about="http://dbpedia.org/resource/Michigan">
|
||||
<rdf:type rdf:resource="http://vivoweb.org/ontology/core#StateOrProvince"/>
|
||||
<rdfs:label xml:lang="en">Michigan</rdfs:label>
|
||||
<vivo:geographicallyWithin rdf:resource="http://aims.fao.org/aos/geopolitical.owl#United_States_of_America"/>
|
||||
</rdf:Description>
|
||||
<rdf:Description rdf:about="http://dbpedia.org/resource/Minnesota">
|
||||
<rdf:type rdf:resource="http://vivoweb.org/ontology/core#StateOrProvince"/>
|
||||
<rdfs:label xml:lang="en">Minnesota</rdfs:label>
|
||||
<vivo:geographicallyWithin rdf:resource="http://aims.fao.org/aos/geopolitical.owl#United_States_of_America"/>
|
||||
</rdf:Description>
|
||||
<rdf:Description rdf:about="http://dbpedia.org/resource/Mississipi">
|
||||
<rdf:type rdf:resource="http://vivoweb.org/ontology/core#StateOrProvince"/>
|
||||
<rdfs:label xml:lang="en">Mississipi</rdfs:label>
|
||||
<vivo:geographicallyWithin rdf:resource="http://aims.fao.org/aos/geopolitical.owl#United_States_of_America"/>
|
||||
</rdf:Description>
|
||||
<rdf:Description rdf:about="http://dbpedia.org/resource/Missouri">
|
||||
<rdf:type rdf:resource="http://vivoweb.org/ontology/core#StateOrProvince"/>
|
||||
<rdfs:label xml:lang="en">Missouri</rdfs:label>
|
||||
<vivo:geographicallyWithin rdf:resource="http://aims.fao.org/aos/geopolitical.owl#United_States_of_America"/>
|
||||
</rdf:Description>
|
||||
<rdf:Description rdf:about="http://dbpedia.org/resource/Montana">
|
||||
<rdf:type rdf:resource="http://vivoweb.org/ontology/core#StateOrProvince"/>
|
||||
<rdfs:label xml:lang="en">Montana</rdfs:label>
|
||||
<vivo:geographicallyWithin rdf:resource="http://aims.fao.org/aos/geopolitical.owl#United_States_of_America"/>
|
||||
</rdf:Description>
|
||||
<rdf:Description rdf:about="http://dbpedia.org/resource/Nebraska">
|
||||
<rdf:type rdf:resource="http://vivoweb.org/ontology/core#StateOrProvince"/>
|
||||
<rdfs:label xml:lang="en">Nebraska</rdfs:label>
|
||||
<vivo:geographicallyWithin rdf:resource="http://aims.fao.org/aos/geopolitical.owl#United_States_of_America"/>
|
||||
</rdf:Description>
|
||||
<rdf:Description rdf:about="http://dbpedia.org/resource/Nevada">
|
||||
<rdf:type rdf:resource="http://vivoweb.org/ontology/core#StateOrProvince"/>
|
||||
<rdfs:label xml:lang="en">Nevada</rdfs:label>
|
||||
<vivo:geographicallyWithin rdf:resource="http://aims.fao.org/aos/geopolitical.owl#United_States_of_America"/>
|
||||
</rdf:Description>
|
||||
<rdf:Description rdf:about="http://dbpedia.org/resource/New_Hampshire">
|
||||
<rdf:type rdf:resource="http://vivoweb.org/ontology/core#StateOrProvince"/>
|
||||
<rdfs:label xml:lang="en">New Hampshire</rdfs:label>
|
||||
<vivo:geographicallyWithin rdf:resource="http://aims.fao.org/aos/geopolitical.owl#United_States_of_America"/>
|
||||
</rdf:Description>
|
||||
<rdf:Description rdf:about="http://dbpedia.org/resource/New_Jersey">
|
||||
<rdf:type rdf:resource="http://vivoweb.org/ontology/core#StateOrProvince"/>
|
||||
<rdfs:label xml:lang="en">New Jersey</rdfs:label>
|
||||
<vivo:geographicallyWithin rdf:resource="http://aims.fao.org/aos/geopolitical.owl#United_States_of_America"/>
|
||||
</rdf:Description>
|
||||
<rdf:Description rdf:about="http://dbpedia.org/resource/New_Mexico">
|
||||
<rdf:type rdf:resource="http://vivoweb.org/ontology/core#StateOrProvince"/>
|
||||
<rdfs:label xml:lang="en">New Mexico</rdfs:label>
|
||||
<vivo:geographicallyWithin rdf:resource="http://aims.fao.org/aos/geopolitical.owl#United_States_of_America"/>
|
||||
</rdf:Description>
|
||||
<rdf:Description rdf:about="http://dbpedia.org/resource/New_York">
|
||||
<rdf:type rdf:resource="http://vivoweb.org/ontology/core#StateOrProvince"/>
|
||||
<rdfs:label xml:lang="en">New York</rdfs:label>
|
||||
<vivo:geographicallyWithin rdf:resource="http://aims.fao.org/aos/geopolitical.owl#United_States_of_America"/>
|
||||
</rdf:Description>
|
||||
<rdf:Description rdf:about="http://dbpedia.org/resource/North_Carolina">
|
||||
<rdf:type rdf:resource="http://vivoweb.org/ontology/core#StateOrProvince"/>
|
||||
<rdfs:label xml:lang="en">North Carolina</rdfs:label>
|
||||
<vivo:geographicallyWithin rdf:resource="http://aims.fao.org/aos/geopolitical.owl#United_States_of_America"/>
|
||||
</rdf:Description>
|
||||
<rdf:Description rdf:about="http://dbpedia.org/resource/North_Dakota">
|
||||
<rdf:type rdf:resource="http://vivoweb.org/ontology/core#StateOrProvince"/>
|
||||
<rdfs:label xml:lang="en">North Dakota</rdfs:label>
|
||||
<vivo:geographicallyWithin rdf:resource="http://aims.fao.org/aos/geopolitical.owl#United_States_of_America"/>
|
||||
</rdf:Description>
|
||||
<rdf:Description rdf:about="http://dbpedia.org/resource/Ohio">
|
||||
<rdf:type rdf:resource="http://vivoweb.org/ontology/core#StateOrProvince"/>
|
||||
<rdfs:label xml:lang="en">Ohio</rdfs:label>
|
||||
<vivo:geographicallyWithin rdf:resource="http://aims.fao.org/aos/geopolitical.owl#United_States_of_America"/>
|
||||
</rdf:Description>
|
||||
<rdf:Description rdf:about="http://dbpedia.org/resource/Oklahoma">
|
||||
<rdf:type rdf:resource="http://vivoweb.org/ontology/core#StateOrProvince"/>
|
||||
<rdfs:label xml:lang="en">Oklahoma</rdfs:label>
|
||||
<vivo:geographicallyWithin rdf:resource="http://aims.fao.org/aos/geopolitical.owl#United_States_of_America"/>
|
||||
</rdf:Description>
|
||||
<rdf:Description rdf:about="http://dbpedia.org/resource/Oregon">
|
||||
<rdf:type rdf:resource="http://vivoweb.org/ontology/core#StateOrProvince"/>
|
||||
<rdfs:label xml:lang="en">Oregon</rdfs:label>
|
||||
<vivo:geographicallyWithin rdf:resource="http://aims.fao.org/aos/geopolitical.owl#United_States_of_America"/>
|
||||
</rdf:Description>
|
||||
<rdf:Description rdf:about="http://dbpedia.org/resource/Pennsylvania">
|
||||
<rdf:type rdf:resource="http://vivoweb.org/ontology/core#StateOrProvince"/>
|
||||
<rdfs:label xml:lang="en">Pennsylvania</rdfs:label>
|
||||
<vivo:geographicallyWithin rdf:resource="http://aims.fao.org/aos/geopolitical.owl#United_States_of_America"/>
|
||||
</rdf:Description>
|
||||
<rdf:Description rdf:about="http://dbpedia.org/resource/Rhode_Island">
|
||||
<rdf:type rdf:resource="http://vivoweb.org/ontology/core#StateOrProvince"/>
|
||||
<rdfs:label xml:lang="en">Rhode Island</rdfs:label>
|
||||
<vivo:geographicallyWithin rdf:resource="http://aims.fao.org/aos/geopolitical.owl#United_States_of_America"/>
|
||||
</rdf:Description>
|
||||
<rdf:Description rdf:about="http://dbpedia.org/resource/South_Carolina">
|
||||
<rdf:type rdf:resource="http://vivoweb.org/ontology/core#StateOrProvince"/>
|
||||
<rdfs:label xml:lang="en">South Carolina</rdfs:label>
|
||||
<vivo:geographicallyWithin rdf:resource="http://aims.fao.org/aos/geopolitical.owl#United_States_of_America"/>
|
||||
</rdf:Description>
|
||||
<rdf:Description rdf:about="http://dbpedia.org/resource/South_Dakota">
|
||||
<rdf:type rdf:resource="http://vivoweb.org/ontology/core#StateOrProvince"/>
|
||||
<rdfs:label xml:lang="en">South Dakota</rdfs:label>
|
||||
<vivo:geographicallyWithin rdf:resource="http://aims.fao.org/aos/geopolitical.owl#United_States_of_America"/>
|
||||
</rdf:Description>
|
||||
<rdf:Description rdf:about="http://dbpedia.org/resource/Tennessee">
|
||||
<rdf:type rdf:resource="http://vivoweb.org/ontology/core#StateOrProvince"/>
|
||||
<rdfs:label xml:lang="en">Tennessee</rdfs:label>
|
||||
<vivo:geographicallyWithin rdf:resource="http://aims.fao.org/aos/geopolitical.owl#United_States_of_America"/>
|
||||
</rdf:Description>
|
||||
<rdf:Description rdf:about="http://dbpedia.org/resource/Texas">
|
||||
<rdf:type rdf:resource="http://vivoweb.org/ontology/core#StateOrProvince"/>
|
||||
<rdfs:label xml:lang="en">Texas</rdfs:label>
|
||||
<vivo:geographicallyWithin rdf:resource="http://aims.fao.org/aos/geopolitical.owl#United_States_of_America"/>
|
||||
</rdf:Description>
|
||||
<rdf:Description rdf:about="http://dbpedia.org/resource/Utah">
|
||||
<rdf:type rdf:resource="http://vivoweb.org/ontology/core#StateOrProvince"/>
|
||||
<rdfs:label xml:lang="en">Utah</rdfs:label>
|
||||
<vivo:geographicallyWithin rdf:resource="http://aims.fao.org/aos/geopolitical.owl#United_States_of_America"/>
|
||||
</rdf:Description>
|
||||
<rdf:Description rdf:about="http://dbpedia.org/resource/Vermont">
|
||||
<rdf:type rdf:resource="http://vivoweb.org/ontology/core#StateOrProvince"/>
|
||||
<rdfs:label xml:lang="en">Vermont</rdfs:label>
|
||||
<vivo:geographicallyWithin rdf:resource="http://aims.fao.org/aos/geopolitical.owl#United_States_of_America"/>
|
||||
</rdf:Description>
|
||||
<rdf:Description rdf:about="http://dbpedia.org/resource/Virginia">
|
||||
<rdf:type rdf:resource="http://vivoweb.org/ontology/core#StateOrProvince"/>
|
||||
<rdfs:label xml:lang="en">Virginia</rdfs:label>
|
||||
<vivo:geographicallyWithin rdf:resource="http://aims.fao.org/aos/geopolitical.owl#United_States_of_America"/>
|
||||
</rdf:Description>
|
||||
<rdf:Description rdf:about="http://dbpedia.org/resource/Washington">
|
||||
<rdf:type rdf:resource="http://vivoweb.org/ontology/core#StateOrProvince"/>
|
||||
<rdfs:label xml:lang="en">Washington</rdfs:label>
|
||||
<vivo:geographicallyWithin rdf:resource="http://aims.fao.org/aos/geopolitical.owl#United_States_of_America"/>
|
||||
</rdf:Description>
|
||||
<rdf:Description rdf:about="http://dbpedia.org/resource/West_Virginia">
|
||||
<rdf:type rdf:resource="http://vivoweb.org/ontology/core#StateOrProvince"/>
|
||||
<rdfs:label xml:lang="en">West Virginia</rdfs:label>
|
||||
<vivo:geographicallyWithin rdf:resource="http://aims.fao.org/aos/geopolitical.owl#United_States_of_America"/>
|
||||
</rdf:Description>
|
||||
<rdf:Description rdf:about="http://dbpedia.org/resource/Wisconsin">
|
||||
<rdf:type rdf:resource="http://vivoweb.org/ontology/core#StateOrProvince"/>
|
||||
<rdfs:label xml:lang="en">Wisconsin</rdfs:label>
|
||||
<vivo:geographicallyWithin rdf:resource="http://aims.fao.org/aos/geopolitical.owl#United_States_of_America"/>
|
||||
</rdf:Description>
|
||||
<rdf:Description rdf:about="http://dbpedia.org/resource/Wyoming">
|
||||
<rdf:type rdf:resource="http://vivoweb.org/ontology/core#StateOrProvince"/>
|
||||
<rdfs:label xml:lang="en">Wyoming</rdfs:label>
|
||||
<vivo:geographicallyWithin rdf:resource="http://aims.fao.org/aos/geopolitical.owl#United_States_of_America"/>
|
||||
</rdf:Description>
|
||||
<rdf:Description rdf:about="http://aims.fao.org/aos/geopolitical.owl#United_States_of_America">
|
||||
<vivo:geographicallyContains rdf:resource="http://dbpedia.org/resource/Alabama"/>
|
||||
<vivo:geographicallyContains rdf:resource="http://dbpedia.org/resource/Alaska"/>
|
||||
<vivo:geographicallyContains rdf:resource="http://dbpedia.org/resource/Arizona"/>
|
||||
<vivo:geographicallyContains rdf:resource="http://dbpedia.org/resource/Arkansas"/>
|
||||
<vivo:geographicallyContains rdf:resource="http://dbpedia.org/resource/California"/>
|
||||
<vivo:geographicallyContains rdf:resource="http://dbpedia.org/resource/Colorado"/>
|
||||
<vivo:geographicallyContains rdf:resource="http://dbpedia.org/resource/Connecticut"/>
|
||||
<vivo:geographicallyContains rdf:resource="http://dbpedia.org/resource/Delaware"/>
|
||||
<vivo:geographicallyContains rdf:resource="http://dbpedia.org/resource/Florida"/>
|
||||
<vivo:geographicallyContains rdf:resource="http://dbpedia.org/resource/Georgia"/>
|
||||
<vivo:geographicallyContains rdf:resource="http://dbpedia.org/resource/Hawaii"/>
|
||||
<vivo:geographicallyContains rdf:resource="http://dbpedia.org/resource/Idaho"/>
|
||||
<vivo:geographicallyContains rdf:resource="http://dbpedia.org/resource/Illinois"/>
|
||||
<vivo:geographicallyContains rdf:resource="http://dbpedia.org/resource/Indiana"/>
|
||||
<vivo:geographicallyContains rdf:resource="http://dbpedia.org/resource/Iowa"/>
|
||||
<vivo:geographicallyContains rdf:resource="http://dbpedia.org/resource/Kansas"/>
|
||||
<vivo:geographicallyContains rdf:resource="http://dbpedia.org/resource/Kentucky"/>
|
||||
<vivo:geographicallyContains rdf:resource="http://dbpedia.org/resource/Louisiana"/>
|
||||
<vivo:geographicallyContains rdf:resource="http://dbpedia.org/resource/Maine"/>
|
||||
<vivo:geographicallyContains rdf:resource="http://dbpedia.org/resource/Maryland"/>
|
||||
<vivo:geographicallyContains rdf:resource="http://dbpedia.org/resource/Massachusetts"/>
|
||||
<vivo:geographicallyContains rdf:resource="http://dbpedia.org/resource/Michigan"/>
|
||||
<vivo:geographicallyContains rdf:resource="http://dbpedia.org/resource/Minnesota"/>
|
||||
<vivo:geographicallyContains rdf:resource="http://dbpedia.org/resource/Mississipi"/>
|
||||
<vivo:geographicallyContains rdf:resource="http://dbpedia.org/resource/Missouri"/>
|
||||
<vivo:geographicallyContains rdf:resource="http://dbpedia.org/resource/Montana"/>
|
||||
<vivo:geographicallyContains rdf:resource="http://dbpedia.org/resource/Nebraska"/>
|
||||
<vivo:geographicallyContains rdf:resource="http://dbpedia.org/resource/Nevada"/>
|
||||
<vivo:geographicallyContains rdf:resource="http://dbpedia.org/resource/New_Hampshire"/>
|
||||
<vivo:geographicallyContains rdf:resource="http://dbpedia.org/resource/New_Jersey"/>
|
||||
<vivo:geographicallyContains rdf:resource="http://dbpedia.org/resource/New_Mexico"/>
|
||||
<vivo:geographicallyContains rdf:resource="http://dbpedia.org/resource/New_York"/>
|
||||
<vivo:geographicallyContains rdf:resource="http://dbpedia.org/resource/North_Carolina"/>
|
||||
<vivo:geographicallyContains rdf:resource="http://dbpedia.org/resource/North_Dakota"/>
|
||||
<vivo:geographicallyContains rdf:resource="http://dbpedia.org/resource/Ohio"/>
|
||||
<vivo:geographicallyContains rdf:resource="http://dbpedia.org/resource/Oklahoma"/>
|
||||
<vivo:geographicallyContains rdf:resource="http://dbpedia.org/resource/Oregon"/>
|
||||
<vivo:geographicallyContains rdf:resource="http://dbpedia.org/resource/Pennsylvania"/>
|
||||
<vivo:geographicallyContains rdf:resource="http://dbpedia.org/resource/Rhode_Island"/>
|
||||
<vivo:geographicallyContains rdf:resource="http://dbpedia.org/resource/South_Carolina"/>
|
||||
<vivo:geographicallyContains rdf:resource="http://dbpedia.org/resource/South_Dakota"/>
|
||||
<vivo:geographicallyContains rdf:resource="http://dbpedia.org/resource/Tennessee"/>
|
||||
<vivo:geographicallyContains rdf:resource="http://dbpedia.org/resource/Texas"/>
|
||||
<vivo:geographicallyContains rdf:resource="http://dbpedia.org/resource/Utah"/>
|
||||
<vivo:geographicallyContains rdf:resource="http://dbpedia.org/resource/Vermont"/>
|
||||
<vivo:geographicallyContains rdf:resource="http://dbpedia.org/resource/Virginia"/>
|
||||
<vivo:geographicallyContains rdf:resource="http://dbpedia.org/resource/Washington"/>
|
||||
<vivo:geographicallyContains rdf:resource="http://dbpedia.org/resource/West_Virginia"/>
|
||||
<vivo:geographicallyContains rdf:resource="http://dbpedia.org/resource/Wisconsin"/>
|
||||
<vivo:geographicallyContains rdf:resource="http://dbpedia.org/resource/Wyoming"/>
|
||||
</rdf:Description>
|
||||
</rdf:RDF>
|
|
@ -29,3 +29,23 @@ display:academicDeptsDataGetter
|
|||
|
||||
""" .
|
||||
|
||||
<freemarker:lib-home-page.ftl> display:hasDataGetter display:researcherCountDataGetter .
|
||||
|
||||
display:researcherCountDataGetter
|
||||
a <java:edu.cornell.mannlib.vitro.webapp.utils.dataGetter.SparqlQueryDataGetter> ;
|
||||
display:saveToVar "researcherCountDG" ;
|
||||
display:query """
|
||||
PREFIX geo: <http://aims.fao.org/aos/geopolitical.owl#>
|
||||
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
|
||||
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
|
||||
PREFIX core: <http://vivoweb.org/ontology/core#>
|
||||
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
|
||||
PREFIX vivoc: <http://vivo.library.cornell.edu/ns/0.1#>
|
||||
|
||||
SELECT DISTINCT (COUNT(?person) AS ?count)
|
||||
WHERE {
|
||||
?person rdf:type foaf:Person .
|
||||
FILTER (EXISTS {?person core:geographicFocus ?focus})
|
||||
}
|
||||
|
||||
""" .
|
||||
|
|
|
@ -36,7 +36,7 @@ public class GeoFocusMapLocations extends AbstractAjaxResponder {
|
|||
+ "PREFIX core: <http://vivoweb.org/ontology/core#> \n"
|
||||
+ "PREFIX foaf: <http://xmlns.com/foaf/0.1/> \n"
|
||||
+ "PREFIX vivoc: <http://vivo.library.cornell.edu/ns/0.1#> \n"
|
||||
+ "SELECT DISTINCT ?label ?location (COUNT(?person) AS ?count) \n"
|
||||
+ "SELECT DISTINCT ?label ?location (COUNT(DISTINCT ?person) AS ?count) \n"
|
||||
+ "WHERE { { \n"
|
||||
+ " ?location rdf:type core:GeographicRegion . \n"
|
||||
+ " ?location rdfs:label ?label . \n"
|
||||
|
|
|
@ -16,6 +16,7 @@ import javax.servlet.http.HttpSession;
|
|||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import com.hp.hpl.jena.ontology.OntModel;
|
||||
import com.hp.hpl.jena.rdf.model.Literal;
|
||||
import com.hp.hpl.jena.rdf.model.Model;
|
||||
import com.hp.hpl.jena.vocabulary.RDF;
|
||||
|
@ -27,6 +28,7 @@ import edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty;
|
|||
import edu.cornell.mannlib.vitro.webapp.beans.ObjectPropertyStatement;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.ModelAccess;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationUtils;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationVTwo;
|
||||
|
@ -85,7 +87,7 @@ public class AddAssociatedConceptGenerator extends VivoBaseGenerator implements
|
|||
setTemplate(editConfiguration, vreq);
|
||||
// No validators required here
|
||||
// Add preprocessors
|
||||
addPreprocessors(editConfiguration, vreq.getWebappDaoFactory());
|
||||
addPreprocessors(editConfiguration, ModelAccess.on(vreq).getJenaOntModel());
|
||||
// Adding additional data, specifically edit mode
|
||||
addFormSpecificData(editConfiguration, vreq);
|
||||
// One override for basic functionality, changing url pattern
|
||||
|
@ -174,8 +176,10 @@ public class AddAssociatedConceptGenerator extends VivoBaseGenerator implements
|
|||
private List<String> generateN3Optional() {
|
||||
return list("?conceptNode <" + RDFS.label.getURI() + "> ?conceptLabel .\n" +
|
||||
"?conceptNode <" + RDFS.isDefinedBy.getURI() + "> ?conceptSource .",
|
||||
"?conceptNode <" + VIVOCore + "conceptSemanticType> ?conceptSemanticTypeURI ." +
|
||||
"?conceptSemanticTypeURI <" + RDFS.label.getURI() + "> ?conceptSemanticTypeLabel ."
|
||||
"?conceptNode <" + VIVOCore + "hasConceptSemanticType> ?conceptSemanticTypeURI ." +
|
||||
"?conceptSemanticTypeURI <" + VIVOCore + "isConceptSemanticTypeOf> ?conceptNode ." +
|
||||
"?conceptSemanticTypeURI <" + RDFS.label.getURI() + "> ?conceptSemanticTypeLabel ." +
|
||||
"?conceptSemanticTypeURI <" + RDF.type.getURI() + "> <" + VIVOCore + "ConceptSemanticType> ."
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -190,7 +194,7 @@ public class AddAssociatedConceptGenerator extends VivoBaseGenerator implements
|
|||
//There are no new resources here, the concept node uri doesn't
|
||||
//get created but already exists, and vocab uri should already exist as well
|
||||
//Adding concept semantic type uri just to test - note this isn't really on the form at all
|
||||
//newResources.put("conceptSemanticTypeURI", null);
|
||||
newResources.put("conceptSemanticTypeURI", null);
|
||||
return newResources;
|
||||
}
|
||||
|
||||
|
@ -239,11 +243,11 @@ public class AddAssociatedConceptGenerator extends VivoBaseGenerator implements
|
|||
//The URI of the node that defines the concept
|
||||
urisOnForm.add("conceptNode");
|
||||
urisOnForm.add("conceptSource");
|
||||
// urisOnForm.add("conceptSemanticTypeURI");
|
||||
urisOnForm.add("conceptSemanticTypeURI");
|
||||
editConfiguration.setUrisOnform(urisOnForm);
|
||||
//Also need to add the label of the concept
|
||||
literalsOnForm.add("conceptLabel");
|
||||
// literalsOnForm.add("conceptSemanticTypeLabel");
|
||||
literalsOnForm.add("conceptSemanticTypeLabel");
|
||||
|
||||
editConfiguration.setLiteralsOnForm(literalsOnForm);
|
||||
}
|
||||
|
@ -272,8 +276,8 @@ public class AddAssociatedConceptGenerator extends VivoBaseGenerator implements
|
|||
setConceptNodeField(editConfiguration, vreq);
|
||||
setConceptLabelField(editConfiguration, vreq);
|
||||
setVocabURIField(editConfiguration, vreq);
|
||||
//setConceptSemanticTypeURIField(editConfiguration,vreq);
|
||||
//setConceptSemanticTypeLabelField(editConfiguration,vreq);
|
||||
setConceptSemanticTypeURIField(editConfiguration,vreq);
|
||||
setConceptSemanticTypeLabelField(editConfiguration,vreq);
|
||||
}
|
||||
|
||||
//this field will be hidden and include the concept node URI
|
||||
|
@ -321,11 +325,14 @@ public class AddAssociatedConceptGenerator extends VivoBaseGenerator implements
|
|||
|
||||
//Add preprocessor
|
||||
|
||||
private void addPreprocessors(EditConfigurationVTwo editConfiguration, WebappDaoFactory wadf) {
|
||||
private void addPreprocessors(EditConfigurationVTwo editConfiguration, OntModel ontModel) {
|
||||
//An Edit submission preprocessor for enabling addition of multiple terms for a single search
|
||||
//TODO: Check if this is the appropriate way of getting model
|
||||
|
||||
//Passing model to check for any URIs that are present
|
||||
|
||||
editConfiguration.addEditSubmissionPreprocessor(
|
||||
new AddAssociatedConceptsPreprocessor(editConfiguration, wadf));
|
||||
new AddAssociatedConceptsPreprocessor(editConfiguration, ontModel));
|
||||
|
||||
}
|
||||
|
||||
|
@ -411,13 +418,13 @@ public class AddAssociatedConceptGenerator extends VivoBaseGenerator implements
|
|||
String conceptSemanticTypeURI = null;
|
||||
String conceptSemanticTypeLabel = null;
|
||||
//Can a concept have multiple semantic types? Currently we are only returning the first one
|
||||
/*
|
||||
List<ObjectPropertyStatement> semanticTypeStatements = conceptIndividual.getObjectPropertyStatements(VIVOCore + "conceptSemanticType");
|
||||
|
||||
List<ObjectPropertyStatement> semanticTypeStatements = conceptIndividual.getObjectPropertyStatements(VIVOCore + "hasConceptSemanticType");
|
||||
if(semanticTypeStatements.size() > 0) {
|
||||
conceptSemanticTypeURI = semanticTypeStatements.get(0).getObjectURI();
|
||||
Individual conceptSemanticTypeIndividual = EditConfigurationUtils.getIndividual(vreq, conceptSemanticTypeURI);
|
||||
conceptSemanticTypeLabel = conceptSemanticTypeIndividual.getName();
|
||||
}*/
|
||||
}
|
||||
//get label
|
||||
|
||||
//Assuming this is from an external vocabulary source
|
||||
|
@ -442,8 +449,8 @@ public class AddAssociatedConceptGenerator extends VivoBaseGenerator implements
|
|||
this.vocabURI = inputVocabURI;
|
||||
this.vocabLabel = inputVocabLabel;
|
||||
this.type = inputType;
|
||||
//this.conceptSemanticTypeURI = inputConceptSemanticTypeURI;
|
||||
//this.conceptSemanticTypeLabel = inputConceptSemanticTypeLabel;
|
||||
this.conceptSemanticTypeURI = inputConceptSemanticTypeURI;
|
||||
this.conceptSemanticTypeLabel = inputConceptSemanticTypeLabel;
|
||||
}
|
||||
|
||||
//Getters
|
||||
|
|
|
@ -3,19 +3,29 @@
|
|||
package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.preprocessors;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
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.ResultSet;
|
||||
import com.hp.hpl.jena.rdf.model.Literal;
|
||||
import com.hp.hpl.jena.rdf.model.Resource;
|
||||
import com.hp.hpl.jena.vocabulary.RDF;
|
||||
import com.hp.hpl.jena.vocabulary.RDFS;
|
||||
import com.hp.hpl.jena.vocabulary.XSD;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.BaseEditSubmissionPreprocessorVTwo;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationUtils;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationVTwo;
|
||||
|
@ -27,13 +37,18 @@ public class AddAssociatedConceptsPreprocessor extends
|
|||
|
||||
protected static final Log log = LogFactory
|
||||
.getLog(AddAssociatedConceptsPreprocessor.class.getName());
|
||||
protected WebappDaoFactory wadf = null;
|
||||
|
||||
//TODO: Check if better way to do this?
|
||||
protected OntModel ontModel = null;
|
||||
// Field names/variables names for n3 - these will have numbers added as
|
||||
// suffix if more than one term
|
||||
private static String conceptNodeBase = "conceptNode";
|
||||
private static String sourceBase = "conceptSource";
|
||||
private static String labelBase = "conceptLabel";
|
||||
private static String conceptSemanticTypeLabelBase = "conceptSemanticTypeLabel";
|
||||
private static String conceptSemanticTypeURIBase = "conceptSemanticTypeURI";
|
||||
//keyed off label variable, specifies which uri variable should be used, useful if same label repeated twice
|
||||
private HashMap<String, String> labelVarToUriVarHash = null;
|
||||
private HashMap<String, List<String>> conceptSemanticTypeURIVarToValueMap = null;
|
||||
//Also storing submission values
|
||||
private static String conceptNodeValues = null;
|
||||
private static String conceptLabelValues = null;
|
||||
|
@ -46,9 +61,12 @@ public class AddAssociatedConceptsPreprocessor extends
|
|||
|
||||
// Will be editing the edit configuration as well as edit submission here
|
||||
|
||||
public AddAssociatedConceptsPreprocessor(EditConfigurationVTwo editConfig, WebappDaoFactory wadf) {
|
||||
public AddAssociatedConceptsPreprocessor(EditConfigurationVTwo editConfig, OntModel ontModel) {
|
||||
super(editConfig);
|
||||
this.wadf = wadf;
|
||||
this.ontModel = ontModel;
|
||||
this.labelVarToUriVarHash = new HashMap<String, String>();
|
||||
//Saves values of concept type uris
|
||||
this.conceptSemanticTypeURIVarToValueMap = new HashMap<String, List<String>>();
|
||||
}
|
||||
|
||||
public void preprocess(MultiValueEditSubmission inputSubmission) {
|
||||
|
@ -57,12 +75,14 @@ public class AddAssociatedConceptsPreprocessor extends
|
|||
// as vocab uri (which is based on thge
|
||||
// For query parameters, check whether CUI
|
||||
copySubmissionValues();
|
||||
//This will put the URI value in scope for the first semantic type label
|
||||
//and generate the rest if need be
|
||||
//processConceptSemanticValues();
|
||||
|
||||
|
||||
if (conceptNodeValues != null) {
|
||||
String[] conceptNodes = convertDelimitedStringToArray(conceptNodeValues);
|
||||
int numberConcepts = conceptNodes.length;
|
||||
//This will put the URI value in scope for the first semantic type label
|
||||
//and generate the rest if need be
|
||||
processConceptSemanticValues();
|
||||
if (numberConcepts > 1) {
|
||||
processConceptNodes(numberConcepts);
|
||||
}
|
||||
|
@ -80,6 +100,7 @@ public class AddAssociatedConceptsPreprocessor extends
|
|||
conceptLabelValues = getConceptLabelValues();
|
||||
conceptNodeValues = getConceptNodeValues();
|
||||
conceptSourceValues = getConceptSourceValues();
|
||||
log.debug("concept label values are " + conceptLabelValues);
|
||||
|
||||
}
|
||||
|
||||
|
@ -94,14 +115,11 @@ public class AddAssociatedConceptsPreprocessor extends
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//This is for additional concept nodes (i.e. if user selects more than one concept)
|
||||
private void processConceptNodes(int numberConcepts) {
|
||||
//There are no "new" resources b/c the concept nodes are URIs from external vocabularies
|
||||
//New resources for concept semantic type uris
|
||||
addNewResources(numberConcepts);
|
||||
// Add N3Required
|
||||
addN3Required(numberConcepts);
|
||||
//Add N3 Optional as well
|
||||
|
@ -115,6 +133,42 @@ public class AddAssociatedConceptsPreprocessor extends
|
|||
|
||||
}
|
||||
|
||||
//This is specifically for concept semantic type URIs which may need to be generated
|
||||
private void addNewResources(int numberConcepts) {
|
||||
// TODO Auto-generated method stub
|
||||
addConceptSemanticTypeURIResources(numberConcepts);
|
||||
}
|
||||
|
||||
private void addConceptSemanticTypeURIResources(int numberConcepts) {
|
||||
//Iterate through the labels and get the corresponding uris
|
||||
HashSet<String> urisToAdd = new HashSet<String>();
|
||||
String[] conceptSemanticTypeLabels= convertDelimitedStringToArray(conceptSemanticTypeLabelValues);
|
||||
//the number of existing values may not match up, or at least existing populated ones
|
||||
//Now we can't determine whether all concepts will have semantic types - at some point what if
|
||||
//we ran a search across all external vocabularies? So we can't compare labels to number of concepts
|
||||
//but we can ensure that it isn't greater than then number of concepts
|
||||
if(conceptSemanticTypeLabels != null && conceptSemanticTypeLabels.length <= numberConcepts) {
|
||||
int i;
|
||||
for(i = 0; i < numberConcepts; i++) {
|
||||
int suffix = i + 1;
|
||||
String conceptSemanticTypeLabelVar = conceptSemanticTypeLabelBase + suffix;
|
||||
if(this.labelVarToUriVarHash.containsKey(conceptSemanticTypeLabelVar)) {
|
||||
String newResourceName = this.labelVarToUriVarHash.get(conceptSemanticTypeLabelVar);
|
||||
if(!urisToAdd.contains(newResourceName)) {
|
||||
urisToAdd.add(newResourceName);
|
||||
editConfiguration.addNewResource(newResourceName, null);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} else if(conceptSemanticTypeLabels != null && conceptSemanticTypeLabels.length > numberConcepts){
|
||||
log.error("Number of concept semantic type labels is greater than number of concepts");
|
||||
} else{
|
||||
log.error("Concept semantic type labels returned are null");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//This is where the actual values will be submitted as if they were separate input fields
|
||||
//Each field name will correspond to the names of the fileds/uris on form/literals on form
|
||||
//generated here
|
||||
|
@ -126,7 +180,8 @@ public class AddAssociatedConceptsPreprocessor extends
|
|||
addConceptSourceInputs(numberConcepts);
|
||||
addConceptLabelInputs(numberConcepts);
|
||||
//for concept semantic type labels and uris where they exist
|
||||
//addConceptSemanticTypeLabelInputs(numberConcepts);
|
||||
//TODO: Make into single method as URIs depend on labels
|
||||
addConceptSemanticTypeLabelAndURIInputs(numberConcepts);
|
||||
//addConceptSemanticTypeURIInputs(numberConcepts);
|
||||
|
||||
}
|
||||
|
@ -198,12 +253,73 @@ public class AddAssociatedConceptsPreprocessor extends
|
|||
}
|
||||
}
|
||||
|
||||
private void addConceptSemanticTypeLabelInputs(int numberConcepts) {
|
||||
private void addConceptSemanticTypeLabelAndURIInputs(int numberConcepts) {
|
||||
String[] labels = convertDelimitedStringToArray(conceptSemanticTypeLabelValues);
|
||||
HashSet<String> uniqueLabelValues = new HashSet<String>();
|
||||
if(labels != null && labels.length == numberConcepts) {
|
||||
int i;
|
||||
for(i = 0; i < numberConcepts; i++) {
|
||||
String thisLabel = labels[i];
|
||||
int suffix = i + 1;
|
||||
String labelInputName = conceptSemanticTypeLabelBase + suffix;
|
||||
String[] labelValues = new String[1];
|
||||
labelValues[0] = thisLabel;
|
||||
//TODO: Check if there are no funky typed information also stored
|
||||
//At this point the field should already have been added to edit configuration
|
||||
FieldVTwo labelField = editConfiguration.getField(labelInputName);
|
||||
//TODO: Also check to see whether the label is actually populate or will n3 editing take care of that?
|
||||
if(labelField != null) {
|
||||
submission.addLiteralToForm(editConfiguration, labelField, labelInputName, labelValues);
|
||||
//Associate URI
|
||||
if(!uniqueLabelValues.contains(thisLabel)) {
|
||||
uniqueLabelValues.add(thisLabel);
|
||||
this.addConceptSemanticTypeURIInputForLabel(labelInputName, suffix);
|
||||
}
|
||||
} else {
|
||||
log.error("Corresponding field for " + labelInputName + " was not added to edit configuration");
|
||||
}
|
||||
|
||||
}
|
||||
} else if(labels != null && labels.length != numberConcepts){
|
||||
log.error("Number of concept semantic type labels did not match the number of concepts to be added");
|
||||
} else{
|
||||
log.error("Concept labels returned were null");
|
||||
}
|
||||
}
|
||||
|
||||
private void addConceptSemanticTypeURIInputs(int numberConcepts) {
|
||||
private void addConceptSemanticTypeURIInputForLabel(String conceptSemanticTypeLabel, int suffix) {
|
||||
//String[] conceptSemanticTypeURIs= convertDelimitedStringToArray(conceptSemanticTypeURIValues);
|
||||
|
||||
//Get the semantic type URI variable name associated with this label
|
||||
String uriInputName = this.getConceptSemanticTypeURIFieldName(conceptSemanticTypeLabel, suffix);
|
||||
//List<>
|
||||
if(this.conceptSemanticTypeURIVarToValueMap.containsKey(uriInputName)) {
|
||||
List<String> uriVals = this.conceptSemanticTypeURIVarToValueMap.get(uriInputName);
|
||||
String[] uriValuesArray = uriVals.toArray(new String[uriVals.size()]);
|
||||
submission.addUriToForm(editConfiguration, uriInputName, uriValuesArray);
|
||||
}
|
||||
|
||||
|
||||
//the number of existing values may not match up, or at least existing populated ones
|
||||
/*
|
||||
if(conceptSemanticTypeURIs != null && conceptSemanticTypeURIs.length == numberConcepts) {
|
||||
int i;
|
||||
for(i = 0; i < numberConcepts; i++) {
|
||||
int suffix = i + 1;
|
||||
String conceptInputName = conceptSemanticTypeURIBase + suffix;
|
||||
String[] uriValues = new String[1];
|
||||
uriValues[0] = conceptSemanticTypeURIs[i];
|
||||
//Add value for uri to form
|
||||
//TODO: Check if value is empty in which case don't add to submission
|
||||
submission.addUriToForm(editConfiguration, conceptInputName, uriValues);
|
||||
}
|
||||
} else if(conceptSemanticTypeURIs != null && conceptSemanticTypeURIs.length != numberConcepts){
|
||||
log.error("Number of concept nodes did not match the number of concepts to be added");
|
||||
} else{
|
||||
log.error("Concept nodes returned were null");
|
||||
}
|
||||
|
||||
*/
|
||||
}
|
||||
|
||||
//Fields
|
||||
|
@ -212,16 +328,26 @@ public class AddAssociatedConceptsPreprocessor extends
|
|||
//Clear out all fields in edit configuration first
|
||||
editConfiguration.setFields(new HashMap<String, FieldVTwo>());
|
||||
int index;
|
||||
HashSet<String> conceptSemanticTypeUris = new HashSet<String>();
|
||||
// First one already included in generator so add additional ones here
|
||||
for (index = 1; index <= numberConcepts; index++) {
|
||||
int suffix = index;
|
||||
String conceptNode = conceptNodeBase + suffix;
|
||||
String label = labelBase + suffix;
|
||||
String source = sourceBase + suffix;
|
||||
String conceptSemanticTypeLabel = conceptSemanticTypeLabelBase + suffix;
|
||||
String conceptSemanticTypeURI = this.getConceptSemanticTypeURIFieldName(conceptSemanticTypeLabel, suffix);
|
||||
|
||||
addConceptNodeField(conceptNode);
|
||||
addLabelField(label);
|
||||
addSourceField(source);
|
||||
//Also add fields for concept semantic type label
|
||||
addConceptSemanticTypeLabelField(conceptSemanticTypeLabel);
|
||||
//and concept semantic type URI
|
||||
if(!conceptSemanticTypeUris.contains(conceptSemanticTypeURI)) {
|
||||
conceptSemanticTypeUris.add(conceptSemanticTypeURI);
|
||||
addConceptSemanticTypeURIField(conceptSemanticTypeURI);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -247,6 +373,25 @@ public class AddAssociatedConceptsPreprocessor extends
|
|||
|
||||
}
|
||||
|
||||
//TODO: Do we need to check if label is empty string?
|
||||
private void addConceptSemanticTypeLabelField(String label) {
|
||||
if(label != null) {
|
||||
editConfiguration.addField(new FieldVTwo().
|
||||
setName(label).
|
||||
setRangeDatatypeUri(XSD.xstring.toString())
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void addConceptSemanticTypeURIField(String conceptSemanticTypeURI) {
|
||||
if(conceptSemanticTypeURI != null) {
|
||||
editConfiguration.addField(new FieldVTwo().
|
||||
setName(conceptSemanticTypeURI));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//original literals on form: label, uris on form: conceptNode and conceptSource
|
||||
//This will overwrite the original values in the edit configuration
|
||||
private void addLiteralsAndUrisOnForm(int numberTerms) {
|
||||
|
@ -254,16 +399,24 @@ public class AddAssociatedConceptsPreprocessor extends
|
|||
List<String> literalsOnForm = new ArrayList<String>();
|
||||
|
||||
int index;
|
||||
|
||||
HashSet<String> conceptSemanticTypeURIs = new HashSet<String>();
|
||||
// First one already included so add new ones here
|
||||
for (index = 1; index <= numberTerms; index++) {
|
||||
int suffix = index;
|
||||
String conceptNode = conceptNodeBase + suffix;
|
||||
String label = labelBase + suffix;
|
||||
String source = sourceBase + suffix;
|
||||
String conceptSemanticTypeLabel = conceptSemanticTypeLabelBase + suffix;
|
||||
//String conceptSemanticTypeURI = conceptSemanticTypeURIBase + suffix;
|
||||
String conceptSemanticTypeURI = this.getConceptSemanticTypeURIFieldName(conceptSemanticTypeLabel, suffix);
|
||||
urisOnForm.add(conceptNode);
|
||||
urisOnForm.add(source);
|
||||
if(!conceptSemanticTypeURIs.contains(conceptSemanticTypeURI)) {
|
||||
conceptSemanticTypeURIs.add(conceptSemanticTypeURI);
|
||||
urisOnForm.add(conceptSemanticTypeURI);
|
||||
}
|
||||
literalsOnForm.add(label);
|
||||
literalsOnForm.add(conceptSemanticTypeLabel);
|
||||
}
|
||||
editConfiguration.setUrisOnform(urisOnForm);
|
||||
editConfiguration.setLiteralsOnForm(literalsOnForm);
|
||||
|
@ -279,8 +432,7 @@ public class AddAssociatedConceptsPreprocessor extends
|
|||
List<String> n3Required = new ArrayList<String>();
|
||||
int index;
|
||||
String nodeBase = "?" + conceptNodeBase;
|
||||
String labelVar = "?" + labelBase;
|
||||
String sourceVar = "?" + sourceBase;
|
||||
|
||||
String prefixStr = "@prefix core: <http://vivoweb.org/ontology/core#> .";
|
||||
// First one already included so add new ones here
|
||||
for (index = 1; index <= numberConcepts; index++) {
|
||||
|
@ -293,30 +445,61 @@ public class AddAssociatedConceptsPreprocessor extends
|
|||
editConfiguration.setN3Required(n3Required);
|
||||
}
|
||||
//Add n3 optional
|
||||
|
||||
//TODO: Rewrite optional N3
|
||||
private void addN3Optional(int numberConcepts) {
|
||||
List<String> n3Optional = new ArrayList<String>();
|
||||
int index;
|
||||
String nodeBase = "?" + conceptNodeBase;
|
||||
String labelVar = "?" + labelBase;
|
||||
String sourceVar = "?" + sourceBase;
|
||||
String conceptSemanticTypeLabelVar = "?" + conceptSemanticTypeLabelBase;
|
||||
String prefixStr = "@prefix core: <http://vivoweb.org/ontology/core#> .";
|
||||
// First one already included so add new ones here
|
||||
//We already have a label var to uri var setup
|
||||
for (index = 1; index <= numberConcepts; index++) {
|
||||
int suffix = index;
|
||||
String node = nodeBase + suffix;
|
||||
String label = labelVar + suffix;
|
||||
String source = sourceVar + suffix;
|
||||
String conceptSemanticTypeLabel = conceptSemanticTypeLabelVar + suffix;
|
||||
//get the URI appropriate for the concept semantic type label var
|
||||
String conceptSemanticTypeURI = getConceptSemanticTypeURIVar(conceptSemanticTypeLabelBase + suffix, suffix);
|
||||
//onceptSemanticTypeURIVar + suffix;
|
||||
String n3String = prefixStr;
|
||||
n3String += node + " <" + RDFS.label.getURI() + "> " + label + " .\n" +
|
||||
node + " <" + RDFS.isDefinedBy.getURI() + "> " + source + " .";
|
||||
node + " <" + RDFS.isDefinedBy.getURI() + "> " + source + " .";
|
||||
String n3ConceptTypeString = prefixStr;
|
||||
n3ConceptTypeString += node + " core:hasConceptSemanticType " + conceptSemanticTypeURI + " ." +
|
||||
conceptSemanticTypeURI + " core:isConceptSemanticTypeOf " + node + ". " +
|
||||
conceptSemanticTypeURI + " <" + RDFS.label.getURI() + "> " + conceptSemanticTypeLabel + " .\n" +
|
||||
conceptSemanticTypeURI + " <" + RDF.type.getURI() + "> core:ConceptSemanticType .\n" ;
|
||||
|
||||
n3Optional.add(n3String);
|
||||
//adding separately so their resolution does not depend on each other
|
||||
n3Optional.add(n3ConceptTypeString);
|
||||
|
||||
}
|
||||
//Already have n3 required so need to add to that
|
||||
|
||||
editConfiguration.setN3Optional(n3Optional);
|
||||
}
|
||||
|
||||
//get the URI variable that is associated with this concept type URI, which might not be
|
||||
//the same suffix because the same label value might be repeated and we need to use the same URI
|
||||
//representing that concept semantic type
|
||||
private String getConceptSemanticTypeURIVar(String labelVar, int suffix) {
|
||||
// TODO Auto-generated method stub
|
||||
return "?" + this.getConceptSemanticTypeURIFieldName(labelVar, suffix);
|
||||
}
|
||||
|
||||
private String getConceptSemanticTypeURIFieldName(String labelVar, int suffix) {
|
||||
// TODO Auto-generated method stub
|
||||
if(this.labelVarToUriVarHash.containsKey(labelVar)) {
|
||||
return this.labelVarToUriVarHash.get(labelVar);
|
||||
}
|
||||
return this.conceptSemanticTypeURIBase + suffix;
|
||||
}
|
||||
|
||||
private String[] convertDelimitedStringToArray(String inputString) {
|
||||
String[] inputArray = new String[1];
|
||||
if (inputString.indexOf(",") != -1) {
|
||||
|
@ -357,31 +540,122 @@ public class AddAssociatedConceptsPreprocessor extends
|
|||
//This will either generate or retrieve URIs for the concept semantic type labels if they exist
|
||||
//We will then update the submission to include this
|
||||
private String getConceptSemanticTypeURIValues() {
|
||||
List<String> conceptSemanticTypeURIs = new ArrayList<String>();
|
||||
String[] conceptSemanticTypeLabels = convertDelimitedStringToArray(conceptSemanticTypeLabelValues);
|
||||
//keep track of what label values already exist and to which label variables they map
|
||||
HashMap<String, List<Integer>> labelValueToVarSuffix = new HashMap<String, List<Integer>>();
|
||||
int numberLabels = conceptSemanticTypeLabels.length;
|
||||
String pseudoInputString = "";
|
||||
|
||||
for(int i = 0; i < numberLabels; i++) {
|
||||
String label = conceptSemanticTypeLabels[i];
|
||||
//Make or retrieve URI for this label
|
||||
//The rest of this code is really only relevant for multiple values, so we could break out the old code above
|
||||
//as we don't need to set up hashes etc. if there is only one concept node being added
|
||||
if(numberLabels == 1) {
|
||||
String label = conceptSemanticTypeLabels[0];
|
||||
String uri = getURIForSemanticTypeLabel(label);
|
||||
conceptSemanticTypeURIs.add(uri);
|
||||
}
|
||||
if(uri != "") {
|
||||
String[] urisToAdd = new String[1];
|
||||
urisToAdd[0] = uri;
|
||||
pseudoInputString = uri;
|
||||
log.debug("uris to add" + uri);
|
||||
submission.addUriToForm(this.editConfiguration, "conceptSemanticTypeURI", urisToAdd);
|
||||
}
|
||||
|
||||
//Set uris as string
|
||||
//Essentially this will allow the URI to be put in scope
|
||||
return conceptSemanticTypeURIs.toString();
|
||||
}
|
||||
//if there is more than one concept node, we may have duplicate semantic types
|
||||
//which will need to be referred to by the same semantic type uri
|
||||
else if (numberLabels > 1){
|
||||
|
||||
for(int i = 0; i < numberLabels; i++) {
|
||||
int suffix = i + 1;
|
||||
String label = conceptSemanticTypeLabels[i];
|
||||
String labelVar = this.conceptSemanticTypeLabelBase + suffix;
|
||||
//if label has not already been encountered, create entry for label value
|
||||
//and list with the label variables that would refer to it
|
||||
//for unique values, the uri variable will be the same as label
|
||||
Integer thisSuffix = new Integer(suffix);
|
||||
if(!labelValueToVarSuffix.containsKey(label)) {
|
||||
labelValueToVarSuffix.put(label, new ArrayList<Integer>());
|
||||
//Add suffix to list if not already there
|
||||
labelValueToVarSuffix.get(label).add(thisSuffix);
|
||||
} else {
|
||||
//in this case, the label already exists, get the very first element in the list
|
||||
//and use that as the uri variable
|
||||
List<Integer> suffixList = labelValueToVarSuffix.get(label);
|
||||
if(suffixList != null && suffixList.size() > 0) {
|
||||
thisSuffix = suffixList.get(0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//Now add the uri var to the hash mapping label variable to uri variable
|
||||
String uriVar = this.conceptSemanticTypeURIBase + thisSuffix.intValue();
|
||||
this.labelVarToUriVarHash.put(labelVar, uriVar);
|
||||
|
||||
|
||||
//Make or retrieve URI for this label
|
||||
//TODO: Do we create this string with empty inputs ?
|
||||
String uri = getURIForSemanticTypeLabel(label);
|
||||
if(uri != "") {
|
||||
//uri var shouldn't be repeated?
|
||||
if(!this.conceptSemanticTypeURIVarToValueMap.containsKey(uriVar)) {
|
||||
this.conceptSemanticTypeURIVarToValueMap.put(uriVar, new ArrayList<String>());
|
||||
this.conceptSemanticTypeURIVarToValueMap.get(uriVar).add(uri);
|
||||
}
|
||||
}
|
||||
if(i != 0) {
|
||||
pseudoInputString += ",";
|
||||
}
|
||||
pseudoInputString += uri;
|
||||
|
||||
}
|
||||
|
||||
//Add this string to the uris for the form
|
||||
String[] urisToAdd = new String[1];
|
||||
urisToAdd[0] = pseudoInputString;
|
||||
log.debug("uris to add" + pseudoInputString);
|
||||
submission.addUriToForm(this.editConfiguration, "conceptSemanticTypeURI", urisToAdd);
|
||||
|
||||
}
|
||||
return pseudoInputString;
|
||||
}
|
||||
|
||||
private String getURIForSemanticTypeLabel(String label) {
|
||||
//Check if system has an individual with this URI
|
||||
//
|
||||
List<Individual> individualsWithLabel = this.wadf.getIndividualDao().getIndividualsByDataProperty(RDFS.label.getURI(), label);
|
||||
//We are only interested in concepts
|
||||
return null;
|
||||
String existingURI = this.getExistingSemanticTypeURI(label);
|
||||
if(existingURI != null) {
|
||||
return existingURI;
|
||||
}
|
||||
//if we leave this as null, we should be able to generate a new resource
|
||||
//empty string because there may be more than one value returned for labels
|
||||
else return "";
|
||||
|
||||
}
|
||||
|
||||
private String getExistingSemanticTypeURI(String label) {
|
||||
String queryStr = "SELECT ?semanticType WHERE { ?semanticType <" + RDF.type.getURI() + "> <http://vivoweb.org/ontology/core#ConceptSemanticType> . " +
|
||||
"?semanticType <" + RDFS.label.getURI() + "> \"" + label + "\"^^<http://www.w3.org/2001/XMLSchema#string> . }";
|
||||
QueryExecution qe = null;
|
||||
try{
|
||||
Query query = QueryFactory.create(queryStr);
|
||||
qe = QueryExecutionFactory.create(query, this.ontModel);
|
||||
ResultSet results = null;
|
||||
results = qe.execSelect();
|
||||
|
||||
while( results.hasNext()){
|
||||
QuerySolution qs = results.nextSolution();
|
||||
if(qs.get("semanticType") != null) {
|
||||
Resource semanticTypeURI = qs.getResource("semanticType");
|
||||
log.debug("Semantic Type URI returned " + semanticTypeURI.getURI());
|
||||
return semanticTypeURI.getURI();
|
||||
}
|
||||
}
|
||||
}catch(Exception ex){
|
||||
throw new Error("Error in executing query string: \n" + queryStr + '\n' + ex.getMessage());
|
||||
}finally{
|
||||
if( qe != null)
|
||||
qe.close();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private Object getFirstElement(List inputList) {
|
||||
if(inputList == null || inputList.size() == 0)
|
||||
return null;
|
||||
|
|
|
@ -97,6 +97,7 @@
|
|||
stateString: '${i18n().map_state_string}',
|
||||
statewideLocations: '${i18n().statewide_locations}',
|
||||
researchersInString: '${i18n().researchers_in}',
|
||||
inString: '${i18n().in}',
|
||||
noFacultyFound: '${i18n().no_faculty_found}',
|
||||
placeholderImage: '${i18n().placeholder_image}',
|
||||
viewAllFaculty: '${i18n().view_all_faculty}',
|
||||
|
@ -108,7 +109,7 @@
|
|||
if ( $('input.search-homepage').css('text-align') == "right" ) {
|
||||
$('input.search-homepage').attr("value","${i18n().limit_search} \u2192");
|
||||
}
|
||||
|
||||
</script>
|
||||
<@lh.getGeoResearcherCount/>
|
||||
</body>
|
||||
</html>
|
Loading…
Add table
Reference in a new issue