Package org.ontoware.rdf2go.model.node.impl

Examples of org.ontoware.rdf2go.model.node.impl.URIImpl


      FileInputStream fis = new FileInputStream(file);
      byte[] bytes = new byte[mimeTypeIdentifier.getMinArrayLength()];
      fis.read(bytes);
      mimeType = mimeTypeIdentifier.identify(bytes, file.getPath(),
              new URIImpl(rawDocument.getUrl(),false)) ;
      if (mimeType == null || mimeType.length() == 0) {
        mimeType = "application/x-unknown-mime-type";
      }

      mLog.debug("Detected mimetype cylcle 1: " + mimeType + ". " + rawDocument.getUrl());
      if (mimeType.equalsIgnoreCase("application/zip")) {
        // some new files like MS Office documents are zip files
        // so rewrite the URL for the correct mimetype detection
        mimeType = mimeTypeIdentifier.identify(bytes, null,
                new URIImpl("zip:mime:file:" + rawDocument.getUrl()));
        mLog.debug("Detected mimetype cylcle 2: " + mimeType + ". " + "zip:mime:file:" + rawDocument.getUrl());
      }
    } catch (Exception exc) {
      errorLogger.logError("Determine mime-type of " + rawDocument.getUrl() +
                              " failed", exc, false);
View Full Code Here


  public void testRemoveAll() throws Exception {
    Repository repo = new SailRepository(new MemoryStore());
    repo.initialize();
    RepositoryModelSet modelSet = new RepositoryModelSet(repo);
    modelSet.open();
    URI context1 = new URIImpl("uri:context1");
    URI context2 = new URIImpl("uri:context2");
    modelSet.addStatement(context1, new URIImpl("uri:r1"), new URIImpl(
        "uri:p1"), new URIImpl("uri:r2"));
    modelSet.addStatement(context1, new URIImpl("uri:r1"), new URIImpl(
        "uri:p1"), new URIImpl("uri:r3"));
    modelSet.addStatement(context2, new URIImpl("uri:r4"), new URIImpl(
        "uri:p2"), new URIImpl("uri:r5"));
    modelSet.addStatement(context2, new URIImpl("uri:r4"), new URIImpl(
        "uri:p2"), new URIImpl("uri:r6"));
    Model model1 = modelSet.getModel(context1);
    model1.open();
    Model model2 = modelSet.getModel(context2);
    model2.open();
    assertEquals(4, modelSet.size());
View Full Code Here

   * @throws ModelRuntimeException if URI syntax is wrong
   *
   *             [Generated from RDFReactor template rule #c7]
   */
  public Property(Model model, String uriString, boolean write) throws ModelRuntimeException {
    super(model, RDFS_CLASS, new URIImpl(uriString, false), write);
  }
View Full Code Here

 
  @Test
  public void testDataTypeEqualness() throws Exception {
   
    // die erste DatenTyp URI
    URI testA = new URIImpl("test://somedata-A", false);
    // die zweite DatenTyp URI
    URI testB = new URIImpl("test://somedata-B", false);
   
    // der erste BaseDatatype wird von der ersten DatenTyp URI erzeugt
    BaseDatatype BDtestA1 = new BaseDatatype(testA + "");
    // der zweite BaseDatatype ebenso
    BaseDatatype BDtestA2 = new BaseDatatype(testA + "");
View Full Code Here

      return this.underlying.hasNext();
    }

    @Override
    public URI next() {
      return new URIImpl(this.underlying.next());
    }
View Full Code Here

    // wieder nicht.
   
    // L�sung siehe Funktion testDataTypesWithUnknownType()
   
    // die erste DatenTyp URI
    URI testA = new URIImpl("test://somedata-A", false);
    // die zweite DatenTyp URI
    URI testB = new URIImpl("test://somedata-B", false);
   
    // der erste BaseDatatype wird von der ersten DatenTyp URI erzeugt
    GeneralDataType BDtestA1 = new GeneralDataType(testA + "");
    // der zweite BaseDatatype ebenso
    GeneralDataType BDtestA2 = new GeneralDataType(testA + "");
View Full Code Here

 
  @Test
  public void testNewToJenaNode() throws ModelRuntimeException {
    com.hp.hpl.jena.rdf.model.Model model = ModelFactory.createDefaultModel();
   
    DatatypeLiteralImpl l1 = new DatatypeLiteralImpl("test", new URIImpl("test:funky", false));
    DatatypeLiteralImpl l2 = new DatatypeLiteralImpl("test", new URIImpl("test:funky", false));
   
    Node n1 = TypeConversion.toJenaNode(l1, model);
    Node n2 = TypeConversion.toJenaNode(l2, model);
   
    assertTrue(n1.equals(n2));
   
    Object o1 = TypeConversion.toRDF2Go(n1);
    Object o2 = TypeConversion.toRDF2Go(n2);
   
    assertTrue(o1 instanceof DatatypeLiteral);
    assertTrue(o2 instanceof DatatypeLiteral);
   
    DatatypeLiteralImpl new1 = (DatatypeLiteralImpl)o1;
    DatatypeLiteralImpl new2 = (DatatypeLiteralImpl)o2;
   
    assertTrue(new1.getValue().equals("test"));
    assertTrue(new2.getValue().equals("test"));
    assertTrue(new1.getDatatype().equals(new URIImpl("test:funky", false)));
    assertTrue(new2.getDatatype().equals(new URIImpl("test:funky", false)));
  }
View Full Code Here

    RepositoryModelFactory repositoryModelFactory = new RepositoryModelFactory();
    Model model = repositoryModelFactory.createModel();
    model.open();

    URI a = new URIImpl("urn:test:a");
    URI b = new URIImpl("urn:test:b");
    List list = new List(model, "urn:test:list", true);
   
    //assertTrue( list instanceof URI );  --> fails

    model.addStatement(a, b, list.asURI() );
View Full Code Here

     * @throws ModelRuntimeException if URI syntax is wrong
     *
     *             [Generated from RDFReactor template rule #c7]
     */
    public Resource(Model model, String uriString, boolean write) throws ModelRuntimeException {
        super(model, RDFS_CLASS, new URIImpl(uriString, false), write);
    }
View Full Code Here

    // solution.
    if(n == null)
      return null;
   
    if(n.isURI())
      return new URIImpl(n.getURI());
   
    if(n.isVariable())
      throw new RuntimeException("Cannot convert a Jena variable to an RDF2Go node");
   
    if(n.isLiteral()) {
      LiteralLabel lit = n.getLiteral();
      // datatype
      if(lit.getDatatypeURI() != null) {
        return new DatatypeLiteralImpl(lit.getLexicalForm(), new URIImpl(
                lit.getDatatypeURI()));
      }
     
      // language tagged
      if(lit.language() != null && !lit.language().equals(""))
View Full Code Here

TOP

Related Classes of org.ontoware.rdf2go.model.node.impl.URIImpl

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.