Examples of OntModel


Examples of com.hp.hpl.jena.ontology.OntModel

 
  private static OntModel createDefaultOntModel() {
    OntModelSpec spec = new OntModelSpec(OntModelSpec.OWL_MEM);
    OntDocumentManager docMang = new OntDocumentManager();
    spec.setDocumentManager(docMang);
    OntModel model = ModelFactory.createOntologyModel(spec, null);
    // removeNotNeccesaryNamespaces(model);

    return model;
  }
View Full Code Here

Examples of com.hp.hpl.jena.ontology.OntModel

      }
    }
   

    if ( model instanceof OntModel ) {
      OntModel ontModel = (OntModel) model;
      ExtendedIterator<Individual> iter = ontModel.listIndividuals(termRes);
      if ( iter.hasNext() ) {
        while ( iter.hasNext() ) {
          Resource idv = (Resource) iter.next();

          termModel.add(idv, RDF.type, termRes);
View Full Code Here

Examples of com.hp.hpl.jena.ontology.OntModel

  }

  private void _loadOntology(OntologyInfo ontology, String full_path) {
    final Model model2update = _getEffectiveModel(_getInfModel() != null);
    if ( USE_UNVERSIONED ) {
      OntModel model = JenaUtil2.loadModel("file:" +full_path, false);

      if ( OntUtil.isOntResolvableUri(ontology.getUri()) ) {
        MmiUri mmiUri;
        try {
          mmiUri = new MmiUri(ontology.getUri());
          OntModel unversionedModel = UnversionedConverter.getUnversionedModel(model, mmiUri);
          model2update.add(unversionedModel);
        }
        catch (URISyntaxException e) {
          log.error("shouldn't happen", e);
          return;
View Full Code Here

Examples of com.hp.hpl.jena.ontology.OntModel

  private void _loadOntology(_Conn _conn, OntologyInfo ontology, String graphId, String full_path, boolean clearGraphFirst) {
   
    String graphUri;
   
    String ontologyUri = ontology.getUri();
    OntModel model;
   
    if ( USE_UNVERSIONED ) {
      model = JenaUtil2.loadModel("file:" +full_path, false);

      if ( OntUtil.isOntResolvableUri(ontologyUri) ) {
View Full Code Here

Examples of com.hp.hpl.jena.ontology.OntModel

    }
   
   
    String uriFile = file.toURI().toString();
    try {
      OntModel model = _loadModel(uriFile, lang, false);
      return model;
    }
    catch ( Throwable jenaExc ) {
      // XML parse exception?
      String errorMessage = getXmlParseExceptionErrorMessage(jenaExc);
View Full Code Here

Examples of com.hp.hpl.jena.ontology.OntModel

   
  }
 
  private static OntModel _loadModel(String uriModel, String lang, boolean processImports) {

    OntModel model = null;
    uriModel = JenaUtil2.removeTrailingFragment(uriModel);
    model = _createDefaultOntModel();
    model.setDynamicImports(false);
    model.getDocumentManager().setProcessImports(processImports);
    if ( log.isDebugEnabled() ) {
      log.debug("loading model " + uriModel + "  LANG=" +lang);
    }
    model.read(uriModel, lang);
    return model;
  }
View Full Code Here

Examples of com.hp.hpl.jena.ontology.OntModel

  }
  private static OntModel _createDefaultOntModel() {
    OntModelSpec spec = new OntModelSpec(OntModelSpec.OWL_MEM);
    OntDocumentManager docMang = new OntDocumentManager();
    spec.setDocumentManager(docMang);
    OntModel model = ModelFactory.createOntologyModel(spec, null);
    // removeNotNeccesaryNamespaces(model);

    return model;
  }
View Full Code Here

Examples of com.hp.hpl.jena.ontology.OntModel

      );
    }

    // original model:
    final String uriFile = file.toURI().toString();
    final OntModel originalModel = JenaUtil2.loadModel(uriFile, false);

    if ( originalModel == null ) {
      // This should not happen.
      return new InternalErrorResponse(
          file.getAbsolutePath()+ ": internal error: uploaded file "
          + "cannot be read as an ontology model. "
          + "Please, report this bug."
      );
    }

    // corresponding unversioned model in case is requested:
    OntModel unversionedModel = null;
   
    if ( unversionedRequest ) {

      unversionedModel = UnversionedConverter.getUnversionedModel(originalModel, ontReq.mmiUri);
     
      if ( unversionedModel != null ) {
        if ( log.isDebugEnabled() ) {
          log.debug("_getResponseForMmiUri: obtained unversioned model");
        }
      }
      else {
        // error in conversion to unversioned version.
        // this is unexpected.
        // Continue with original model, if necessary; see below.
        log.error("_getResponseForMmiUri: unexpected: error in conversion to unversioned version.  But continuing with original model");
      }
    }

    String term = ontReq.mmiUri.getTerm();
   
    OntModel model = unversionedModel != null ? unversionedModel : originalModel;

    if ( term.length() == 0 ) {
      return new OntologyResponse(model);
    }
    else {
View Full Code Here

Examples of com.hp.hpl.jena.ontology.OntModel

      resp = new InternalErrorResponse(error);
    }
    else {
      // original model:
      final String uriFile = file.toURI().toString();
      final OntModel originalModel = JenaUtil2.loadModel(uriFile, false);

      if ( originalModel == null ) {
        // This should not happen.
        String error = file.getAbsolutePath()+ ": internal error: uploaded file "
          + "cannot be read as an ontology model. "
          + "Please, report this bug."
        ;
        log.warn(error);
        resp = new InternalErrorResponse(error);
      }
      else {
        OntModel model = originalModel;

        // no explicit version requested and it's an unversioned MmiUri?
        if ( ontReq.version == null && ontReq.mmiUri != null && ontReq.mmiUri.getVersion() == null ) {
          model = UnversionedConverter.getUnversionedModel(originalModel, ontReq.mmiUri);
        }
View Full Code Here

Examples of com.hp.hpl.jena.ontology.OntModel

      }
    }
   

    if ( model instanceof OntModel ) {
      OntModel ontModel = (OntModel) model;
      ExtendedIterator<Individual> iter = ontModel.listIndividuals(termRes);
      if ( iter.hasNext() ) {
        out.println("<br/>");
        out.println("<table class=\"inline\" width=\"100%\">");
        out.printf("<tr>%n");
        out.printf("<th>Individuals</th>");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.