Skip to content

Commit

Permalink
Don't forget foaf:Person!
Browse files Browse the repository at this point in the history
  • Loading branch information
stain committed May 24, 2013
1 parent b6f91eb commit 490760f
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@

import com.hp.hpl.jena.ontology.DatatypeProperty;
import com.hp.hpl.jena.ontology.Individual;
import com.hp.hpl.jena.ontology.OntClass;
import com.hp.hpl.jena.ontology.OntModel;
import com.hp.hpl.jena.ontology.Ontology;
import com.hp.hpl.jena.rdf.model.ModelFactory;
Expand All @@ -57,7 +58,8 @@ public class RDFMessageBodyWriter implements MessageBodyWriter<OrcidMessage> {
private Ontology foaf;
private DatatypeProperty foafName;
private DatatypeProperty foafGivenName;
private DatatypeProperty familyName;
private DatatypeProperty foafFamilyName;
private OntClass foafPerson;

/**
* Ascertain if the MessageBodyWriter supports a particular type.
Expand Down Expand Up @@ -158,7 +160,7 @@ public void writeTo(OrcidMessage xml, Class<?> type, Type genericType, Annotatio
try {


Individual person = m.createIndividual(profileUri, m.getOntClass(FOAF_0_1 + "Person"));
Individual person = m.createIndividual(profileUri, foafPerson);
PersonalDetails personalDetails = orcidProfile.getOrcidBio().getPersonalDetails();

if (personalDetails.getCreditName() != null) {
Expand All @@ -169,7 +171,7 @@ public void writeTo(OrcidMessage xml, Class<?> type, Type genericType, Annotatio
person.addProperty(foafGivenName, personalDetails.getGivenNames().getContent());
}
if (personalDetails.getFamilyName() != null) {
person.addProperty(familyName, personalDetails.getFamilyName().getContent());
person.addProperty(foafFamilyName, personalDetails.getFamilyName().getContent());
}

MediaType rdfXml = new MediaType("application", "rdf+xml");
Expand Down Expand Up @@ -211,8 +213,9 @@ protected synchronized void loadFoaf() {
// foaf = ontModel.getOntology(FOAF_0_1);

// properties from foaf
foafPerson = ontModel.getOntClass(FOAF_0_1 + "Person");
foafName = ontModel.getDatatypeProperty(FOAF_0_1 + "name");
foafGivenName = ontModel.getDatatypeProperty(FOAF_0_1 + "givenName");
familyName = ontModel.getDatatypeProperty(FOAF_0_1 + "familyName");
foafFamilyName = ontModel.getDatatypeProperty(FOAF_0_1 + "familyName");
}
}

0 comments on commit 490760f

Please sign in to comment.