117 |
117 |
|
118 |
118 |
ObjectProperty ofCharacteristic = m.getObjectProperty(oboe_core + "ofCharacteristic");
|
119 |
119 |
ObjectProperty usesStandard = m.getObjectProperty(oboe_core + "usesStandard");
|
|
120 |
ObjectProperty ofEntity = m.getObjectProperty(oboe_core + "ofEntity");
|
|
121 |
ObjectProperty hasMeasurement = m.getObjectProperty(oboe_core + "hasMeasurement");
|
120 |
122 |
|
121 |
123 |
// classes
|
|
124 |
OntClass entityClass = m.getOntClass(oboe_core + "Entity");
|
|
125 |
OntClass observationClass = m.getOntClass(oboe_core + "Observation");
|
122 |
126 |
OntClass measurementClass = m.getOntClass(oboe_core + "Measurement");
|
123 |
127 |
OntClass characteristicClass = m.getOntClass(oboe_core + "Characteristic");
|
124 |
128 |
OntClass standardClass = m.getOntClass(oboe_core + "Standard");
|
... | ... | |
126 |
130 |
Resource annotationClass = m.getOntClass(oa + "Annotation");
|
127 |
131 |
Resource specificResourceClass = m.getOntClass(oa + "SpecificResource");
|
128 |
132 |
Resource fragmentSelectorClass = m.getOntClass(oa + "FragmentSelector");
|
129 |
|
Resource entityClass = m.getResource(prov + "Entity");
|
|
133 |
Resource provEntityClass = m.getResource(prov + "Entity");
|
130 |
134 |
Resource personClass = m.getResource(prov + "Person");
|
131 |
135 |
|
132 |
136 |
// these apply to every attribute annotation
|
133 |
|
Individual meta1 = m.createIndividual(ont.getURI() + "#meta", entityClass);
|
|
137 |
Individual meta1 = m.createIndividual(ont.getURI() + "#meta", provEntityClass);
|
134 |
138 |
meta1.addProperty(identifierProperty, metadataPid.getValue());
|
135 |
139 |
|
136 |
140 |
// decide who should be credited with the package
|
... | ... | |
163 |
167 |
if (entities != null) {
|
164 |
168 |
for (Entity entity: entities) {
|
165 |
169 |
String entityName = entity.getName();
|
|
170 |
|
|
171 |
Individual o1 = m.createIndividual(ont.getURI() + "#observation" + entityCount, observationClass);
|
|
172 |
Resource entityConcept = lookupEntity(entityClass, entity);
|
|
173 |
if (entityConcept != null) {
|
|
174 |
AllValuesFromRestriction avfr = m.createAllValuesFromRestriction(null, ofEntity, entityConcept);
|
|
175 |
o1.addOntClass(avfr);
|
|
176 |
}
|
|
177 |
|
166 |
178 |
logMetacat.debug("Entity name: " + entityName);
|
167 |
179 |
Attribute[] attributes = entity.getAttributeList().getAttributes();
|
168 |
180 |
int attributeCount = 1;
|
... | ... | |
221 |
233 |
AllValuesFromRestriction avfr = m.createAllValuesFromRestriction(null, ofCharacteristic, characteristic);
|
222 |
234 |
m1.addOntClass(avfr);
|
223 |
235 |
}
|
|
236 |
|
|
237 |
// attach to the observation
|
|
238 |
// TODO: evaluate whether the measurement can apply to the given observed entity
|
|
239 |
o1.addProperty(hasMeasurement, m1);
|
224 |
240 |
}
|
225 |
241 |
attributeCount++;
|
226 |
242 |
|
... | ... | |
306 |
322 |
|
307 |
323 |
}
|
308 |
324 |
|
|
325 |
private Resource lookupEntity(OntClass entityClass, Entity entity) {
|
|
326 |
// what's our description like?
|
|
327 |
String name = entity.getName();
|
|
328 |
String definition = entity.getDefinition();
|
|
329 |
|
|
330 |
// try to look it up if we got this far
|
|
331 |
return BioPortalService.lookupAnnotationClass(entityClass, definition, OBOE_SBC);
|
|
332 |
|
|
333 |
}
|
|
334 |
|
309 |
335 |
private DataPackage getDataPackage(Identifier pid) throws Exception {
|
310 |
336 |
// for using the MN API as the MN itself
|
311 |
337 |
MockHttpServletRequest request = new MockHttpServletRequest(null, null, null);
|
... | ... | |
434 |
460 |
|
435 |
461 |
public static void testGenerate() throws Exception {
|
436 |
462 |
Identifier metadataPid = new Identifier();
|
437 |
|
metadataPid.setValue("doi:10.5072/FK2445ZN4");
|
|
463 |
metadataPid.setValue("tao.1.4");
|
438 |
464 |
DatapackageSummarizer ds = new DatapackageSummarizer();
|
439 |
465 |
String rdfString = ds.generateAnnotation(metadataPid);
|
440 |
466 |
logMetacat.info("RDF annotation: \n" + rdfString);
|
include BioPortal lookup for Entity matches using the data table description. TODO: only associate measurements to the entity observation if they apply.