VIVO-112: updates to handle grant roles correctly
This commit is contained in:
parent
aeac0411d4
commit
e3de41dc64
2 changed files with 51 additions and 8 deletions
|
@ -33,8 +33,15 @@
|
||||||
?activity vitro:mostSpecificType ?subclass
|
?activity vitro:mostSpecificType ?subclass
|
||||||
</collated>
|
</collated>
|
||||||
}
|
}
|
||||||
|
OPTIONAL { ?role core:relates ?activity
|
||||||
|
LET (?activityName := afn:localname(?activity))
|
||||||
|
OPTIONAL { ?activity rdfs:label ?activityLabel }
|
||||||
|
|
||||||
OPTIONAL { ?role core:relatedBy ?activity
|
<collated>
|
||||||
|
?activity vitro:mostSpecificType ?subclass
|
||||||
|
</collated>
|
||||||
|
}
|
||||||
|
OPTIONAL { ?role core:roleContributesTo ?activity
|
||||||
LET (?activityName := afn:localname(?activity))
|
LET (?activityName := afn:localname(?activity))
|
||||||
OPTIONAL { ?activity rdfs:label ?activityLabel }
|
OPTIONAL { ?activity rdfs:label ?activityLabel }
|
||||||
|
|
||||||
|
@ -65,11 +72,27 @@
|
||||||
|
|
||||||
CONSTRUCT {
|
CONSTRUCT {
|
||||||
?subject ?property ?role .
|
?subject ?property ?role .
|
||||||
?role core:relatedBy ?activity .
|
?role core:relates ?activity .
|
||||||
?activity vitro:mostSpecificType ?subclass .
|
?activity vitro:mostSpecificType ?subclass .
|
||||||
} WHERE {
|
} WHERE {
|
||||||
?subject ?property ?role .
|
?subject ?property ?role .
|
||||||
?role core:relatedBy ?activity .
|
?role core:relates ?activity .
|
||||||
|
?activity vitro:mostSpecificType ?subclass
|
||||||
|
}
|
||||||
|
</query-construct>
|
||||||
|
|
||||||
|
<query-construct>
|
||||||
|
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
|
?activity vitro:mostSpecificType ?subclass
|
||||||
}
|
}
|
||||||
</query-construct>
|
</query-construct>
|
||||||
|
@ -105,12 +128,16 @@
|
||||||
?role ?roleProperty ?roleValue
|
?role ?roleProperty ?roleValue
|
||||||
} UNION {
|
} UNION {
|
||||||
?subject ?property ?role .
|
?subject ?property ?role .
|
||||||
?role core:relatedBy ?activity .
|
?role core:relates ?activity .
|
||||||
?activity rdfs:label ?activityName
|
?activity rdfs:label ?activityName
|
||||||
} UNION {
|
} UNION {
|
||||||
?subject ?property ?role .
|
?subject ?property ?role .
|
||||||
?role <http://purl.obolibrary.org/obo/BFO_0000054> ?activity .
|
?role <http://purl.obolibrary.org/obo/BFO_0000054> ?activity .
|
||||||
?activity rdfs:label ?activityName
|
?activity rdfs:label ?activityName
|
||||||
|
} UNION {
|
||||||
|
?subject ?property ?role .
|
||||||
|
?role core:roleContributesTo ?activity .
|
||||||
|
?activity rdfs:label ?activityName
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</query-construct>
|
</query-construct>
|
||||||
|
|
|
@ -22,8 +22,10 @@ public class ModelUtils {
|
||||||
|
|
||||||
private static final String processPropertyURI = "http://purl.obolibrary.org/obo/BFO_0000054";
|
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 processPropertyInverseURI = "http://purl.obolibrary.org/obo/BFO_0000055";
|
||||||
private static final String nonProcessPropertyURI = "http://vivoweb.org/ontology/core#relatedBy";
|
private static final String nonProcessPropertyURI = "http://vivoweb.org/ontology/core#roleContributesTo";
|
||||||
private static final String nonProcessPropertyInverseURI = "http://purl.obolibrary.org/obo/RO_0000052";
|
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<String> processClass = new HashSet<String>();
|
private static Set<String> processClass = new HashSet<String>();
|
||||||
static {
|
static {
|
||||||
|
@ -32,6 +34,10 @@ public class ModelUtils {
|
||||||
processClass.add("http://vivoweb.org/ontology/core#EventSeries");
|
processClass.add("http://vivoweb.org/ontology/core#EventSeries");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static Set<String> grantClass = new HashSet<String>();
|
||||||
|
static {
|
||||||
|
grantClass.add("http://vivoweb.org/ontology/core#Grant");
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
* Given a class URI that represents the type of entity that a Role
|
* 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
|
* 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();
|
ObjectProperty op = new ObjectProperty();
|
||||||
boolean isBFOProcess = false;
|
boolean isBFOProcess = false;
|
||||||
|
boolean isGrantClass = false;
|
||||||
|
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
String superClassURI = iter.next();
|
String superClassURI = iter.next();
|
||||||
|
@ -69,12 +76,21 @@ public class ModelUtils {
|
||||||
isBFOProcess = true;
|
isBFOProcess = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (grantClass.contains(superClassURI)) {
|
||||||
|
isGrantClass = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isBFOProcess) {
|
if (isBFOProcess) {
|
||||||
op.setURI(processPropertyURI);
|
op.setURI(processPropertyURI);
|
||||||
op.setURIInverse(processPropertyInverseURI);
|
op.setURIInverse(processPropertyInverseURI);
|
||||||
} else {
|
}
|
||||||
|
else if (isGrantClass){
|
||||||
|
op.setURI(grantPropertyURI);
|
||||||
|
op.setURIInverse(grantPropertyInverseURI);
|
||||||
|
}
|
||||||
|
else {
|
||||||
op.setURI(nonProcessPropertyURI);
|
op.setURI(nonProcessPropertyURI);
|
||||||
op.setURIInverse(nonProcessPropertyInverseURI);
|
op.setURIInverse(nonProcessPropertyInverseURI);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue