diff --git a/productMods/config/listViewConfig-hasRole.xml b/productMods/config/listViewConfig-hasRole.xml index a3383212..b4fe60ff 100644 --- a/productMods/config/listViewConfig-hasRole.xml +++ b/productMods/config/listViewConfig-hasRole.xml @@ -33,8 +33,15 @@ ?activity vitro:mostSpecificType ?subclass } - - OPTIONAL { ?role core:relatedBy ?activity + OPTIONAL { ?role core:relates ?activity + LET (?activityName := afn:localname(?activity)) + OPTIONAL { ?activity rdfs:label ?activityLabel } + + + ?activity vitro:mostSpecificType ?subclass + + } + OPTIONAL { ?role core:roleContributesTo ?activity LET (?activityName := afn:localname(?activity)) OPTIONAL { ?activity rdfs:label ?activityLabel } @@ -65,15 +72,31 @@ CONSTRUCT { ?subject ?property ?role . - ?role core:relatedBy ?activity . + ?role core:relates ?activity . ?activity vitro:mostSpecificType ?subclass . } WHERE { ?subject ?property ?role . - ?role core:relatedBy ?activity . + ?role core:relates ?activity . ?activity vitro:mostSpecificType ?subclass } + + PREFIX core: <http://vivoweb.org/ontology/core#> + PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> + PREFIX vitro: <http://vitro.mannlib.cornell.edu/ns/vitro/0.7#> + + CONSTRUCT { + ?subject ?property ?role . + ?role core:roleContributesTo ?activity . + ?activity vitro:mostSpecificType ?subclass . + } WHERE { + ?subject ?property ?role . + ?role core:roleContributesTo ?activity . + ?activity vitro:mostSpecificType ?subclass + } + + PREFIX core: <http://vivoweb.org/ontology/core#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> @@ -105,12 +128,16 @@ ?role ?roleProperty ?roleValue } UNION { ?subject ?property ?role . - ?role core:relatedBy ?activity . + ?role core:relates ?activity . ?activity rdfs:label ?activityName } UNION { ?subject ?property ?role . ?role <http://purl.obolibrary.org/obo/BFO_0000054> ?activity . ?activity rdfs:label ?activityName + } UNION { + ?subject ?property ?role . + ?role core:roleContributesTo ?activity . + ?activity rdfs:label ?activityName } } diff --git a/src/org/vivoweb/webapp/util/ModelUtils.java b/src/org/vivoweb/webapp/util/ModelUtils.java index a7afab86..b3df1d6b 100644 --- a/src/org/vivoweb/webapp/util/ModelUtils.java +++ b/src/org/vivoweb/webapp/util/ModelUtils.java @@ -22,8 +22,10 @@ public class ModelUtils { private static final String processPropertyURI = "http://purl.obolibrary.org/obo/BFO_0000054"; private static final String processPropertyInverseURI = "http://purl.obolibrary.org/obo/BFO_0000055"; - private static final String nonProcessPropertyURI = "http://vivoweb.org/ontology/core#relatedBy"; - private static final String nonProcessPropertyInverseURI = "http://purl.obolibrary.org/obo/RO_0000052"; + private static final String nonProcessPropertyURI = "http://vivoweb.org/ontology/core#roleContributesTo"; + private static final String nonProcessPropertyInverseURI = "http://vivoweb.org/ontology/core#contributingRole"; + private static final String grantPropertyURI = "http://vivoweb.org/ontology/core#relates"; + private static final String grantPropertyInverseURI = "http://vivoweb.org/ontology/core#relatedBy"; private static Set processClass = new HashSet(); static { @@ -32,6 +34,10 @@ public class ModelUtils { processClass.add("http://vivoweb.org/ontology/core#EventSeries"); } + private static Set grantClass = new HashSet(); + static { + grantClass.add("http://vivoweb.org/ontology/core#Grant"); + } /* * Given a class URI that represents the type of entity that a Role * is in (in, in any of its senses) this method returns the URIs of @@ -61,6 +67,7 @@ public class ModelUtils { ObjectProperty op = new ObjectProperty(); boolean isBFOProcess = false; + boolean isGrantClass = false; while (iter.hasNext()) { String superClassURI = iter.next(); @@ -69,12 +76,21 @@ public class ModelUtils { isBFOProcess = true; break; } + if (grantClass.contains(superClassURI)) { + isGrantClass = true; + break; + } } if (isBFOProcess) { op.setURI(processPropertyURI); op.setURIInverse(processPropertyInverseURI); - } else { + } + else if (isGrantClass){ + op.setURI(grantPropertyURI); + op.setURIInverse(grantPropertyInverseURI); + } + else { op.setURI(nonProcessPropertyURI); op.setURIInverse(nonProcessPropertyInverseURI); }