Package org.ontoware.rdf2go

Examples of org.ontoware.rdf2go.ModelFactory


public class Step1 {
 
  public static void main(String[] args) throws Exception {
    // getting a ModelFactory, declaring a model
    ModelFactory modelFactory = RDF2Go.getModelFactory();
    Model model;
   
    // enabling reasoning:
    Reasoning reasoning;
    reasoning = Reasoning.rdfs;
    model = modelFactory.createModel(reasoning);
    model.open();

    // using reasoning (here: assuming RDFS semantics)
    URI A = model.createURI("urn:A");
    URI B = model.createURI("urn:B");
View Full Code Here


  //TODO check if ModelRuntimeException is used in the web tutorial everywhere
  public static void main(String[] args) throws ModelRuntimeException {

    // getting model factory
    ModelFactory modelFactory = RDF2Go.getModelFactory();
   
    // getting model
    Model model = modelFactory.createModel();
    model.open();
    assert model.isOpen();

    // creating URIs
    String foafURI = "http://xmlns.com/foaf/0.1/";
View Full Code Here

    // case ServiceEvent.MODIFIED:
  }
 
  private void handleRegisteredEvent(ServiceEvent event) {
    ServiceReference ref = event.getServiceReference();
    ModelFactory factory = (ModelFactory)this.bc.getService(ref);
    String currClass = getCurrentFactoryClassName();
    String newClass = factory.getClass().getName();
    if(this.currentFactorySR == null) {
      log.debug("Registering " + factory.getClass().getName() + " as default ModelFactory");
      this.currentFactorySR = ref;
      RDF2Go.register(factory);
    } else if(this.defaultFactoryClassName != null
            && !currClass.equals(this.defaultFactoryClassName)
            && newClass.equals(this.defaultFactoryClassName)) {
View Full Code Here

    this.bc.ungetService(ref);
    initalizeListener();
  }
 
  private static String getCurrentFactoryClassName() {
    ModelFactory currFactory = null;
    try {
      currFactory = RDF2Go.getModelFactory();
    } catch(RuntimeException e) {
      // do nothing, this means that no factory has been registered
    }
    return (currFactory == null ? null : currFactory.getClass().getName());
  }
View Full Code Here

  }
 
  @Test
  public void testIsOpen() {
    assert getModelFactory() != null;
    ModelFactory mf = getModelFactory();
    assert mf != null;
    Model model = mf.createModel();
    assert model != null;
    model.open();
    assertNotNull(model);
    assertTrue(model.isOpen());
    model.close();
View Full Code Here

   
    @Test
    public void test() {
        RepositoryModelFactory rmf = new RepositoryModelFactory();
        RDF2Go.register(rmf);
        ModelFactory modelFactory = RDF2Go.getModelFactory();
        Model model = modelFactory.createModel();
        model.open();
        assertTrue(model.isOpen());
    }
View Full Code Here

TOP

Related Classes of org.ontoware.rdf2go.ModelFactory

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.