Examples of Ontology


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

 
 
  private static OntModel setOrAddProperties(OntModel ontModel, boolean doSet, Map<String, String> values) {
    ExtendedIterator<Ontology> iter = ontModel.listOntologies();
    if ( iter.hasNext() ) {
      Ontology ont = (Ontology) iter.next();
      for ( String uri : values.keySet() ) {
        String value = values.get(uri);
        if ( value.trim().length() > 0 ) {
          Property prop = ResourceFactory.createProperty(uri);
          if ( doSet  &&  ont.getPropertyValue(prop) != null ) {
            ont.removeAll(prop);
          }
          ont.addProperty(prop, value.trim());
        }
      }
    }
    return ontModel;
  }
View Full Code Here

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

  public static String getDefaultNamespace(OntModel model, File file, Errorable baseResult) {

    // See issues #213, #174
   
    // try the first ontology resource, if any:
    Ontology ont = JenaUtil2.getOntology(model);
    if ( ont != null ) {
      String namespace = ont.getURI()
      return namespace;
    }
   
    // try namespace of the empty prefix, if any:
    String namespace = model.getNsPrefixURI("");
View Full Code Here

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

   */
  public static OntologyType determineType(OntModel ontModel, String ontologyUri,
      Set<Property> dtProps
  ) throws Exception {
   
    Ontology ont = _getOntology(ontModel, ontologyUri);
   
    // mapping?
    if ( _isMapping(ontModel, ont) ) {
      return OntologyType.MAPPING;
    }
   
    // vocabulary?
    if ( _isVocabulary(ontModel, ont, dtProps) ) {
      return OntologyType.VOCABULARY;
    }
   
    if ( log.isDebugEnabled() ) {
      // 2011-03-24: while updating CF vocabulary with new version (17) released today,
      // a NPE was exposed here: ont might be null; so check for that:
      String ontUriMsg = "ontUri=" +(ont != null ? ont.getURI() : "(ont is null)")+ " ontologyUri=" +ontologyUri;
      log.debug("determineType: " +ontUriMsg + " --> other" );
    }
   
    return OntologyType.OTHER;
  }
View Full Code Here

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

    for ( String uri : preferredPrefixMap.keySet() ) {
      String prefix = preferredPrefixMap.get(uri);
      newOntModel.setNsPrefix(prefix, uri);
    }
   
    Ontology ont = newOntModel.createOntology(base_);
    log.info("New ontology created with namespace " + ns_ + " base " + base_);

    // Indicate Voc2RDF as the engineering tool:
    ont.addProperty(Omv.usedOntologyEngineeringTool, OmvMmi.voc2rdf);

   
    Map<String, Property> uriPropMap = MdHelper.getUriPropMap();
    for ( String uri : values.keySet() ) {
      String value = values.get(uri).trim();
      if ( value.length() > 0 ) {
        Property prop = uriPropMap.get(uri);
        if ( prop == null ) {
          log.warn("No property found for uri='" +uri+ "'");
          continue;
        }
        //log.debug("adding property " + prop + " = " + value);
        ont.addProperty(prop, value);
      }
    }
   
    // set Omv.uri from final
    ont.addProperty(Omv.uri, finalUri);
   
    // set Omv.acronym from primaryClass
    ont.addProperty(Omv.acronym, primaryClass);
   
    String classUri = values.get("classUri");
    if ( classUri != null ) {
      ont.addProperty(OmvMmi.shortNameUri, classUri);
    }
   
    // fixed issue #120: "title doesn't get carried forward"
    // problem was that Omv.name was assigned BOTH the class name and the fulltitle.
    // Only the fullTitle is now assigned.
//    ont.addProperty(Omv.name,
//    setFirstUpperCase(cleanStringforID(primaryClass)) + " Vocabulary");
    String fullTitle = values.get("fullTitle");
    if ( fullTitle != null ) {
      ont.addProperty(Omv.name, fullTitle);
    }
   
    String creator = values.get("creator");
    if ( creator != null ) {
      ont.addProperty(Omv.hasCreator, creator);
    }
   
    String briefDescription = values.get("briefDescription");
    if ( briefDescription != null ) {
      ont.addProperty(Omv.description, briefDescription);
    }
   
    if ( orgAbbreviation != null && orgAbbreviation.trim().length() > 0 ) {
      ont.addProperty(OmvMmi.origMaintainerCode, orgAbbreviation.trim());
    }
   
    createOntologIndividuals();
  }
View Full Code Here

Examples of org.biojava.ontology.Ontology

   */
  public Ontology parse(BufferedReader in, OntologyFactory of)
  throws IOException, OntologyException {
    String name = "";
    String description = "";
    Ontology onto = null;

    for(
      String line = in.readLine();
      line != null;
      line = in.readLine()
View Full Code Here

Examples of org.biojava.ontology.Ontology

            )
  throws ParseException, IOException {
   
     try {
       OntologyFactory factory = OntoTools.getDefaultFactory();
       Ontology ontology = factory.createOntology(ontoName, ontoDescription);
      
           OboFileParser parser = new OboFileParser();
          
           OboFileEventListener handler = new OboFileHandler(ontology);
          
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.