/** * Saves the specified {@link BridgeDefinitions} instance to the specified {@link OntModel}. * * @param bridgeDefinitions * @param ontModel */ public static void saveBridgeDefinitions(BridgeDefinitions bridgeDefinitions, OntModel ontModel) { Resource r = CMSAdapterVocabulary.BRIDGE_DEFINITIONS_RES; String bridges = MappingModelParser.serializeObject(bridgeDefinitions); ontModel.add(r, CMSAdapterVocabulary.BRIDGE_DEFINITIONS_CONTENT_PROP, bridges); }
/** * Saves the specified {@link ConnectionInfo} instance to the specified {@link OntModel}. * * @param connectionInfo * @param ontModel */ public static void saveConnectionInfo(ConnectionInfo connectionInfo, OntModel ontModel) { Resource r = CMSAdapterVocabulary.CONNECTION_INFO_RES; ontModel.add(r, CMSAdapterVocabulary.CONNECTION_TYPE_PROP, connectionInfo.getConnectionType()); ontModel.add(r, CMSAdapterVocabulary.CONNECTION_PASSWORD_PROP, connectionInfo.getPassword()); ontModel.add(r, CMSAdapterVocabulary.CONNECTION_USERNAME_PROP, connectionInfo.getUsername()); ontModel.add(r, CMSAdapterVocabulary.CONNECTION_WORKSPACE_PROP, connectionInfo.getWorkspaceName()); ontModel.add(r, CMSAdapterVocabulary.CONNECTION_WORKSPACE_URL_PROP, connectionInfo.getRepositoryURL()); }
public static OWLKnowledgeBase persistentModelAsOWLKB() { if (null == owlKB) { owlKB = KBWithReasonerBuilder.newKB(); } ObjectOWLSTranslator.owlModelToJenaModel(owlKB).add(persistentModel()); return owlKB; }
protected void populateModel(String workflowRun, Set<String> processRuns) { ontology.loadSchema(); ontModel = ontology.getOntModel(); ontModel.add(metadataService.retrieveGraphModel(workflowRun)); for (String processRun : processRuns) { Model processModel = metadataService.retrieveGraphModel(processRun); if (processModel != null) ontModel.add(processModel); else System.out.println("No model for process run = " + processRun); } }
outputModel.add(ResourceFactory.createStatement( evidenceIndividual, RDF.type, ResourceFactory.createResource(DEFACTO_CLASS_EVIDENCE))); outputModel.add(ResourceFactory.createStatement( evidenceIndividual, RDF.type, ResourceFactory.createResource(PROV_CLASS_ENTITY))); outputModel.add(ResourceFactory.createStatement( evidenceIndividual, ResourceFactory.createProperty(DEFACTO_PROPERTY_EVIDENCE_SCORE), ResourceFactory.createTypedLiteral(evidence.getDeFactoScore()))); outputModel.add(ResourceFactory.createStatement( evidenceIndividual, ResourceFactory.createProperty(TIME_PROPERTY_FROM), ResourceFactory.createTypedLiteral(evidence.defactoTimePeriod.getFrom().toString(), new XSDDatatype("gYear")))); outputModel.add(ResourceFactory.createStatement( evidenceIndividual, ResourceFactory.createProperty(TIME_PROPERTY_TO), outputModel.add(ResourceFactory.createStatement( evidenceIndividual, ResourceFactory.createProperty(DEFACTO_PROPERTY_INPUT_FACT), tripleResource)); outputModel.add(tripleResource,
public static Model toNIF(ComplexProof proof, Evidence evidence, Triple triple) { OntModel model = ModelFactory.createOntologyModel(); model.setNsPrefix("nif", "http://persistence.uni-leipzig.org/nlp2rdf/ontologies/nif-core#"); model.setNsPrefix("prov", PROV_NAMESPACE); WebSite webSite = proof.getWebSite(); String contextString = proof.getProofPhrase(); String text = webSite.getText(); // nif int start = webSite.getText().indexOf(contextString); int end = start + contextString.length(); Individual contextIndividual = nifConverter.createContextIndividual(DEFACTO_NAMESPACE, text, new ContextHashBasedString(), model); Individual cStringIndividual = nifConverter.createCStringIndividual(DEFACTO_NAMESPACE, contextIndividual, new Span(start, end), new ContextHashBasedString(), model); ObjectProperty sourceURL = NIFObjectProperties.sourceUrl.getObjectProperty(model); contextIndividual.addProperty(sourceURL, webSite.getUrl()); // prov model.add(ProvenanceInformationGenerator.generateProvenanceInformation(webSite, triple.getSubject().toString(), triple.getPredicate().toString(), triple.getObject().toString())); return model; }