use of com.hp.hpl.jena.ontology.Individual in project hale by halestudio.
the class MdlLineageGenerator method generateLineage.
/**
* @param mismatches the {@link List} of mismatches that should be
* documented in the lineage
* @param f the source Feature, used for gathering provenance information
*/
public void generateLineage(List<Mismatch> mismatches, Feature f) {
URL provenanceLocation = MdlLineageGenerator.class.getResource("provenance.rdf");
OntModel lineage = ModelFactory.createOntologyModel();
lineage.read("" + provenanceLocation);
OntClass dataItemClass = lineage.getOntClass("http://purl.org/net/provenance/ns#DataItem");
for (OntProperty op : dataItemClass.listDeclaredProperties().toList()) {
System.out.println(op.getLocalName());
}
// first, collect information about the original data item (the source feature).
Individual name1individual = dataItemClass.createIndividual(f.getType().getName().getNamespaceURI() + ":" + f.getType().getName().getLocalPart() + ":" + f.getIdentifier().getID());
System.out.println(name1individual.getURI());
// collect information about the transformed feature
// TODO
// attach a precededBy property to the transformed feature, identifying the
// source feature as an earlier version
// TODO
}
use of com.hp.hpl.jena.ontology.Individual in project stanbol by apache.
the class ConversionTester method testResourceJenaToOwlAxiom.
public void testResourceJenaToOwlAxiom() {
JenaToOwlConvert j2o = new JenaToOwlConvert();
OntModel model = ModelFactory.createOntologyModel();
OntClass jenaclass = model.createClass(CLAZZ.toString());
ObjectProperty jenaobprop = model.createObjectProperty(OP.toString());
DatatypeProperty jenadataprop = model.createDatatypeProperty(DP.toString());
Individual jenasub = model.createIndividual(SUBJECT.toString(), jenaclass);
Individual jenaobj = model.createIndividual(OBJECT.toString(), jenaclass);
AnnotationProperty jenaanno = model.createAnnotationProperty(label.toString());
Literal value = model.createTypedLiteral(VALUE, DATATYPE.toString());
model.add(jenasub, jenaobprop, jenaobj);
model.add(jenasub, jenadataprop, value);
model.add(jenasub, jenaanno, "Lucy", "en");
Set<OWLAxiom> owlaxiom = null;
try {
owlaxiom = j2o.ResourceJenaToOwlAxiom(jenasub, RDFXML);
if (owlaxiom == null) {
fail("Some errors occur");
} else {
StmtIterator str = model.listStatements();
int count = 0;
while (str.hasNext()) {
Statement stm = str.next();
Resource subject = stm.getSubject();
if (SUBJECT.toString().equals(subject.getURI()))
count++;
}
if (count == owlaxiom.size()) {
assertEquals(count, owlaxiom.size());
} else {
fail("The number of axioms don't match the number of statement");
}
}
} catch (Exception e) {
e.printStackTrace();
fail("Exception caugth");
} finally {
assertNotNull(owlaxiom);
}
}
Aggregations