Search in sources :

Example 1 with SKOSDatasetImpl

use of uk.ac.manchester.cs.skos.SKOSDatasetImpl in project opentheso by miledrousset.

the class ImportSkosHelper method readFile.

/**
 * Cette fonction a été modifié pour pouvoir lire un fichier SKOS en passant par un
 * InputStream, l'API standard SKOSAPI n'a pas de constructeur adapté
 * cette fonction permet de lire tout type de fichier SKOS-OWL en s'appuyant
 * sur l'api (OWLAPI-SKOSAPI)
 *
 * @param streamFilename
 * @param fileName
 * @return
 * @throws OWLOntologyCreationException
 * @throws SKOSCreationException
 */
public boolean readFile(InputStream streamFilename, String fileName) throws OWLOntologyCreationException, SKOSCreationException {
    try {
        sKOSManager = new SKOSManager();
        onto = ontologieManager.loadOntologyFromOntologyDocument(streamFilename);
        SKOSDatasetImpl voc = new SKOSDatasetImpl(sKOSManager, onto);
        if (voc.getURI() != null) {
            String theso = "";
            for (SKOSConceptScheme scheme : voc.getSKOSConceptSchemes()) {
                theso = theso + " " + scheme.getURI();
            }
            message = "new ontology loaded: " + theso;
            // voc.getAsOWLOntology().getOntologyID();
            // System.out.println("new ontology loaded: " + voc.getAsOWLOntology().getOntologyID());
            skosVocabularies.put(voc.getURI(), voc);
            dataSet = voc;
            return true;
        }
    } catch (SKOSCreationException ex) {
        Logger.getLogger(ImportSkosHelper.class.getName()).log(Level.SEVERE, null, ex);
        message = ex.getMessage();
    }
    return false;
}
Also used : SKOSDatasetImpl(uk.ac.manchester.cs.skos.SKOSDatasetImpl) SKOSConceptScheme(org.semanticweb.skos.SKOSConceptScheme) SKOSManager(org.semanticweb.skosapibinding.SKOSManager) SKOSCreationException(org.semanticweb.skos.SKOSCreationException)

Example 2 with SKOSDatasetImpl

use of uk.ac.manchester.cs.skos.SKOSDatasetImpl in project opentheso by miledrousset.

the class SKOSManager method loadDatasetFromInputStream.

public SKOSDataset loadDatasetFromInputStream(InputStream uri) throws SKOSCreationException {
    OWLOntology onto = null;
    try {
        onto = man.loadOntologyFromOntologyDocument(uri);
    } catch (OWLOntologyCreationException e) {
        throw new SKOSCreationException(e);
    }
    SKOSDatasetImpl voc;
    // voc;
    return null;
}
Also used : OWLOntologyCreationException(org.semanticweb.owlapi.model.OWLOntologyCreationException) SKOSDatasetImpl(uk.ac.manchester.cs.skos.SKOSDatasetImpl) OWLOntology(org.semanticweb.owlapi.model.OWLOntology) SKOSCreationException(org.semanticweb.skos.SKOSCreationException)

Aggregations

SKOSCreationException (org.semanticweb.skos.SKOSCreationException)2 SKOSDatasetImpl (uk.ac.manchester.cs.skos.SKOSDatasetImpl)2 OWLOntology (org.semanticweb.owlapi.model.OWLOntology)1 OWLOntologyCreationException (org.semanticweb.owlapi.model.OWLOntologyCreationException)1 SKOSConceptScheme (org.semanticweb.skos.SKOSConceptScheme)1 SKOSManager (org.semanticweb.skosapibinding.SKOSManager)1