VIVO-928: added microformats to non persons. Typing goes two levels down in some cases for organizations. Some info content entities covered, though many types not covered by schema.org

This commit is contained in:
Tim Worrall 2015-02-10 16:34:12 -05:00
parent 03c894c463
commit 5eb177b8e6
4 changed files with 83 additions and 6 deletions

View file

@ -49,7 +49,7 @@
<h2>${relatedSubject.relatingPredicateDomainPublic} ${i18n().for} ${relatedSubject.name}</h2>
<p><a href="${relatedSubject.url}" title="${i18n().return_to(relatedSubject.name)}">&larr; ${i18n().return_to(relatedSubject.name)}</a></p>
<#else>
<h1 class="vcard foaf-person fn" <#if !editable>style="float:left;border-right:1px solid #A6B1B0;"</#if>>
<h1 itemprop="name" class="vcard foaf-person fn" <#if !editable>style="float:left;border-right:1px solid #A6B1B0;"</#if>>
<#-- Label -->
<@p.label individual editable labelCount localesCount/>
</h1>
@ -64,9 +64,9 @@
</#if>
<#list title.statements as statement>
<#if !editable >
<div id="titleContainer"><span class="display-title-not-editable">${statement.preferredTitle}</span></div>
<div id="titleContainer"><span itemprop="jobTitle" class="display-title-not-editable">${statement.preferredTitle}</span></div>
<#else>
<span class="display-title-editable">${statement.preferredTitle}</span>
<span itemprop="jobTitle" class="display-title-editable">${statement.preferredTitle}</span>
<@p.editingLinks "${title.localName}" "${title.name}" statement editable title.rangeUri />
</#if>
</#list>

View file

@ -60,7 +60,7 @@
<#else>
<#-- Image -->
<div id="photo-wrapper">${individualImage}</div>
<h1 class="vcard foaf-person fn" <#if !editable>style="float:left;border-right:1px solid #A6B1B0;"</#if>>
<h1 itemprop="name" class="vcard foaf-person fn" <#if !editable>style="float:left;border-right:1px solid #A6B1B0;"</#if>>
<#-- Label -->
<@p.label individual editable labelCount localesCount/>
</h1>
@ -75,9 +75,9 @@
</#if>
<#list title.statements as statement>
<#if !editable >
<div id="titleContainer"><span class="display-title-not-editable">${statement.preferredTitle}</span></div>
<div id="titleContainer"><span itemprop="jobTitle" class="display-title-not-editable">${statement.preferredTitle}</span></div>
<#else>
<span class="display-title-editable">${statement.preferredTitle}</span>
<span itemprop="jobTitle" class="display-title-editable">${statement.preferredTitle}</span>
<@p.editingLinks "${title.localName}" "${title.name}" statement editable title.rangeUri />
</#if>
</#list>

View file

@ -0,0 +1,72 @@
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
<#-- Macros used to insert microformats into non-foaf person profiles via the individual-vitro.ftl template. -->
<#macro sectionSchema individual>
<#if individual.organization() >
<#list individual.mostSpecificTypes as type >
<#assign mst = type />
<#break>
</#list>
<@getItemType mst "organization"/>
<#elseif individual.event()>
itemscope itemtype="http://schema.org/Event"
<#elseif individual.infoContentEntity()>
<#list individual.mostSpecificTypes as type >
<#assign mst = type />
<#break>
</#list>
<@getItemType mst "infoContentEntity"/>
</#if>
</#macro>
<#macro getItemType type class >
<#-- The itemscope and full itemtype element and value are included here because Freemarker appends leading
and trailing white space to the returned value. -->
<#switch type>
<#case "Article">
itemscope itemtype="http://schema.org/Article"
<#break>
<#case "Academic Article">
itemscope itemtype="http://schema.org/ScholarlyArticle"
<#break>
<#case "Blog">
itemscope itemtype="http://schema.org/Blog"
<#break>
<#case "Blog Posting">
itemscope itemtype="http://schema.org/BlogPosting"
<#break>
<#case "Book">
itemscope itemtype="http://schema.org/Book"
<#break>
<#case "Dataset">
itemscope itemtype="http://schema.org/Dataset"
<#break>
<#case "Periodical">
itemscope itemtype="http://schema.org/Periodical"
<#break>
<#case "Review">
itemscope itemtype="http://schema.org/Review"
<#break>
<#case "Series">
itemscope itemtype="http://schema.org/Series"
<#break>
<#case "Webpage">
itemscope itemtype="http://schema.org/WebPage"
<#break>
<#case "Website">
itemscope itemtype="http://schema.org/WebSite"
<#break>
<#case "College">
itemscope itemtype="http://schema.org/CollegeOrUniversity"
<#break>
<#case "University">
itemscope itemtype="http://schema.org/CollegeOrUniversity"
<#break>
<#default>
<#if class == "organization" >
itemscope itemtype="http://schema.org/Organization"
<#else>
<#-- don't return anything if the info content entity has no matching subclass -->
</#if>
</#switch>
</#macro>

View file

@ -38,6 +38,7 @@ public class IndividualTemplateModel extends BaseIndividualTemplateModel {
private static final String DTP_CLASS = "http://vivoweb.org/ontology/core#DateTimeValuePrecision";
private static final String ORGANIZATION_CLASS = FOAF + "Organization";
private static final String EVENT_CLASS = "http://purl.org/NET/c4dm/event.owl#Event";
private static final String INFO_CONTENT_ENTITY_CLASS = "http://purl.obolibrary.org/obo/IAO_0000030";
private static final String BASE_VISUALIZATION_URL =
UrlBuilder.getUrl(Route.VISUALIZATION_SHORT.path());
@ -84,6 +85,10 @@ public class IndividualTemplateModel extends BaseIndividualTemplateModel {
return isVClass(EVENT_CLASS);
}
public boolean infoContentEntity() {
return isVClass(INFO_CONTENT_ENTITY_CLASS);
}
public String coAuthorVisUrl() {
String url = BASE_VISUALIZATION_URL + "/" + VisualizationFrameworkConstants.COAUTHORSHIP_VIS_SHORT_URL + "/";
return getVisUrl(url);