Project

General

Profile

« Previous | Next » 

Revision 51663

Nicer json for Actors on the catalogue

View differences:

CatalogueRegistrator.java
10 10
import com.fasterxml.jackson.core.JsonFactory;
11 11
import com.fasterxml.jackson.core.JsonGenerator;
12 12
import com.google.common.base.Joiner;
13
import eu.dnetlib.parthenos.CRM;
13 14
import eu.dnetlib.parthenos.CRMpe;
14 15
import eu.dnetlib.parthenos.jrr.ParthenosRegistryResource;
15 16
import eu.dnetlib.parthenos.publisher.ParthenosPublisherException;
......
18 19
import org.apache.commons.logging.Log;
19 20
import org.apache.commons.logging.LogFactory;
20 21
import org.apache.jena.rdf.model.Resource;
22
import org.apache.jena.rdf.model.StmtIterator;
21 23
import org.springframework.beans.factory.annotation.Autowired;
22 24
import org.springframework.stereotype.Component;
23 25

  
......
207 209
			addExtra(jg, "Parthenos URL", res.getURI());
208 210
		addExtra(jg, "has member", Joiner.on(", ").join(resourceReader.getMemberUrls(res)));
209 211
		addExtra(jg, "is member of", Joiner.on(", ").join(resourceReader.isMemberOf(res)));
210
		addExtra(jg, "has contact point", Joiner.on(", ").join(resourceReader.getResourceDirectContactPoints(res)));
211 212
		addExtra(jg, "provides", Joiner.on(", ").join(resourceReader.getProvidedServiceUrls(res)));
213
		//contact points
214
		//addExtra(jg, "has contact point", Joiner.on(", ").join(resourceReader.getResourceDirectContactPointsURI(res)));
215
		String contactPoints = "";
216
		StmtIterator it = res.listProperties(CRM.P76_has_contact_point);
217
		while(it.hasNext()) {
218
			Resource cp = it.next().getResource();
219
			Resource cpType = cp.getPropertyResourceValue(CRM.P2_has_type);
220
			String cpTypeLabel = resourceReader.getLabel(cpType);
221
			String cpLabel = resourceReader.getLabel(cp);
222
			if (StringUtils.isNotBlank(cpLabel)) {
223
				if (StringUtils.isNotBlank(cpTypeLabel)) {
224
					contactPoints += cpTypeLabel + ": ";
225
				}
226
				contactPoints += cpLabel + "; ";
227
			}
228
		}
229
		addExtra(jg,"contact points", contactPoints );
230
		addExtra(jg, "maintains", Joiner.on(", ").join(resourceReader.getMaintainedUrls(res)));
231

  
212 232
		jg.writeEndArray();
213 233

  
214 234
		jg.writeEndObject();

Also available in: Unified diff