Package com.hp.hpl.jena.ontology.impl

Examples of com.hp.hpl.jena.ontology.impl.OntModelImpl


  public static OntModel createOntModel(String ontUri, boolean asGiven, OntModel model) {
   
    if ( model == null ) {
      model = createDefaultOntModel();
    }
    OntModelImpl newOntModel = new OntModelImpl(model.getSpecification(), model);
    final String ns_ = asGiven ? ontUri : JenaUtil2.appendFragment(ontUri);
    final String base_ = asGiven ? ontUri : JenaUtil2.removeTrailingFragment(ontUri);
   
    // set NS prefixes:
    newOntModel.setNsPrefix("", ns_);
    Map<String, String> preferredPrefixMap = MdHelper.getPreferredPrefixMap();
    for ( String uri : preferredPrefixMap.keySet() ) {
      String prefix = preferredPrefixMap.get(uri);
      newOntModel.setNsPrefix(prefix, uri);
    }

    newOntModel.createOntology(base_);
    if ( log.isDebugEnabled() ) {
      log.debug("New ontology created with namespace " + ns_ + " base " + base_);
    }

    return newOntModel;
View Full Code Here


     * @param base An existing model to treat as an ontology model, or null.
     * @return A new ontology model
     * @see OntModelSpec
     */
    public static OntModel createOntologyModel( OntModelSpec spec, Model base ) {
        return new OntModelImpl( spec, base );
    }
View Full Code Here

    /**
     * Answer a new ontology model constructed according to the specification, which includes
     * a ModelMaker which will create the necessary base model.
    */
    public static OntModel createOntologyModel( OntModelSpec spec )
        { return new OntModelImpl( spec ); }
View Full Code Here

     *  The base model comes from the attached base ModelMaker.</p>
     *  @return an OntModel satisfying this specification
     */
    public Model doCreateModel() {
        Model m = m_baseModelName == null ? maker.createFreshModel() : maker.createModel( m_baseModelName );
        return new OntModelImpl( this, m );
    }
View Full Code Here

     * <p>Create an OntModel according to this model specification.
     * The base model comes from the underlying ModelMaker and is named by the
     *  given name.</p>
     */
    public Model implementCreateModelOver( String name ) {
        return new OntModelImpl( this, maker.createModel( name, false ) );
    }
View Full Code Here

  public static OntModel createOntModel(String ontUri, OntModel model) {
   
    if ( model == null ) {
      model = createDefaultOntModel();
    }
    OntModelImpl newOntModel = new OntModelImpl(model.getSpecification(), model);
    String ns_ = JenaUtil2.appendFragment(ontUri);
    String base_ = JenaUtil2.removeTrailingFragment(ontUri);
   
    // set NS prefixes:
    newOntModel.setNsPrefix("", ns_);
    Map<String, String> preferredPrefixMap = MdHelper.getPreferredPrefixMap();
    for ( String uri : preferredPrefixMap.keySet() ) {
      String prefix = preferredPrefixMap.get(uri);
      newOntModel.setNsPrefix(prefix, uri);
    }

    newOntModel.createOntology(base_);
    if ( log.isDebugEnabled() ) {
      log.debug("New ontology created with namespace " + ns_ + " base " + base_);
    }

    return newOntModel;
View Full Code Here

     * @param base An existing model to treat as an ontology model, or null.
     * @return A new ontology model
     * @see OntModelSpec
     */
    public static OntModel createOntologyModel( OntModelSpec spec, Model base ) {
        return new OntModelImpl( spec, base );
    }
View Full Code Here

    /**
     * Answer a new ontology model constructed according to the specification, which includes
     * a ModelMaker which will create the necessary base model.
    */
    public static OntModel createOntologyModel( OntModelSpec spec )
        { return new OntModelImpl( spec ); }
View Full Code Here

    }

    /** Sync a TDB-backed Model. Do nothing if not TDB-backed. */
    public static void sync(Model model) {
        if ( model instanceof OntModelImpl ) {
            OntModelImpl ontModel = (OntModelImpl)model ;
            sync(ontModel.getBaseGraph()) ;
            return ;
        }
        // This never happens (there is only one OntModel implementation)
        if ( model instanceof OntModel ) {
            OntModel ontModel = (OntModel)model ;
            sync(ontModel.getBaseModel()) ;
            return ;
        }

        sync(model.getGraph()) ;
    }
View Full Code Here

     *  The base model comes from the attached base ModelMaker.</p>
     *  @return an OntModel satisfying this specification
     */
    public Model doCreateModel() {
        Model m = m_baseModelName == null ? maker.createFreshModel() : maker.createModel( m_baseModelName );
        return new OntModelImpl( this, m );
    }
View Full Code Here

TOP

Related Classes of com.hp.hpl.jena.ontology.impl.OntModelImpl

Copyright © 2018 www.massapicom. 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.