Project

General

Profile

« Previous | Next » 

Revision 8710

Add xpointer FragmentSelectors to each annotation.
Split attribute label into tokens to attempt matching to OBOE concepts.

View differences:

src/edu/ucsb/nceas/metacat/annotation/DatapackageSummarizer.java
100 100
		ObjectProperty hasBodyProperty = m.getObjectProperty(oa + "hasBody");
101 101
		ObjectProperty hasTargetProperty = m.getObjectProperty(oa + "hasTarget");
102 102
		ObjectProperty hasSourceProperty = m.getObjectProperty(oa + "hasSource");
103
		ObjectProperty hasSelectorProperty = m.getObjectProperty(oa + "hasSelector");
103 104
		ObjectProperty annotatedByProperty = m.getObjectProperty(oa + "annotatedBy");
104 105
		Property identifierProperty = m.getProperty(dcterms + "identifier");
106
		Property conformsToProperty = m.getProperty(dcterms + "conformsTo");
105 107
		Property nameProperty = m.getProperty(foaf + "name");
108
		Property rdfValue = m.getProperty(rdf + "value");
106 109
		
107 110
		ObjectProperty ofCharacteristic = m.getObjectProperty(oboe_core + "ofCharacteristic");
108 111
		ObjectProperty usesStandard = m.getObjectProperty(oboe_core + "usesStandard");
......
114 117
		
115 118
		Resource annotationClass =  m.getOntClass(oa + "Annotation");
116 119
		Resource specificResourceClass =  m.getOntClass(oa + "SpecificResource");
120
		Resource fragmentSelectorClass =  m.getOntClass(oa + "FragmentSelector");
117 121
		Resource entityClass =  m.getResource(prov + "Entity");
118 122
		Resource personClass =  m.getResource(prov + "Person");
119 123
		
120
		int cnt = 0;
124
		int cnt = 1;
121 125

  
122 126
		// these apply to every attribute annotation
123 127
		Individual meta1 = m.createIndividual(ont.getURI() + "#meta" + cnt, entityClass);
......
131 135
			String entityName = entity.getName();
132 136
			logMetacat.debug("Entity name: " + entityName);
133 137
			Attribute[] attributes = entity.getAttributeList().getAttributes();
138
			int attributeCount = 1;
134 139
			for (Attribute attribute: attributes) {
135 140
				
136 141
				String attributeName = attribute.getName();
......
161 166
					Individual m1 = m.createIndividual(ont.getURI() + "#measurement" + cnt, measurementClass);
162 167
					Individual a1 = m.createIndividual(ont.getURI() + "#annotation" + cnt, annotationClass);
163 168
					Individual t1 = m.createIndividual(ont.getURI() + "#target" + cnt, specificResourceClass);
169
					String xpointer = "xpointer(/eml/dataSet/" + cnt + "/attributeList/" + attributeCount + ")";
170
					Individual s1 = m.createIndividual(ont.getURI() + "#" + xpointer, fragmentSelectorClass);
171
					s1.addLiteral(rdfValue, xpointer);
172
					s1.addProperty(conformsToProperty, "http://www.w3.org/TR/xptr/");
164 173
					
165 174
					// statements about the annotation
166 175
					a1.addProperty(hasBodyProperty, m1);
167 176
					a1.addProperty(hasTargetProperty, t1);
168 177
					t1.addProperty(hasSourceProperty, meta1);
178
					t1.addProperty(hasSelectorProperty, s1);
169 179
					a1.addProperty(annotatedByProperty, p1);
170 180
					
171 181
					// describe the measurement in terms of restrictions
......
195 205
	private Resource lookupStandard(OntClass standardClass, Attribute attribute) {
196 206
		// what's our unit?
197 207
		String unit = attribute.getUnit().toLowerCase();
208
		List<String> tokens = Arrays.asList(unit.split(" "));
209

  
198 210
		boolean found = false;
199 211
		ExtendedIterator iter = standardClass.listSubClasses(false);
200 212
		if (randomize) {
......
208 220
			OntClass subclass = (OntClass) iter.next();
209 221
			String subclassName = subclass.getLocalName().toLowerCase();
210 222
			logMetacat.debug("subclass: " + subclassName);
211
			if (subclassName.equals(unit)) {
223
			if (tokens.contains(subclassName)) {
212 224
				found = true;
213 225
			}
214 226
			if (subclass.hasLabel(unit, null)) {
......
224 236
	private Resource lookupCharacteristic(OntClass characteristicClass, Attribute attribute) {
225 237
		// what's our label?
226 238
		String label = attribute.getLabel().toLowerCase();
239
		List<String> tokens = Arrays.asList(label.split(" "));
240
		
227 241
		boolean found = false;
228 242
		// find something that matches
229 243
		ExtendedIterator iter = characteristicClass.listSubClasses();
......
238 252
			OntClass subclass = (OntClass) iter.next();
239 253
			String subclassName = subclass.getLocalName().toLowerCase();
240 254
			logMetacat.debug("subclass: " + subclassName);
241
			if (subclassName.equals(label)) {
255
			if (tokens.contains(subclassName)) {
242 256
				found = true;
243 257
			}
244 258
			if (subclass.hasLabel(label, null)) {

Also available in: Unified diff