Package org.ontoware.rdf2go.model.node

Examples of org.ontoware.rdf2go.model.node.URI


    naoModel.close();
   
    ModelSet mainRepository = RDF2Go.getModelFactory().createModelSet();
    mainRepository.open();
   
    URI rdfModelURI = new URIImpl("ontology:rdf");
    URI naoModelURI = new URIImpl("ontology:nao");
   
    Model model = mainRepository.getModel(rdfModelURI);
    model.open();
    rdfModel.open();
    model.addAll(rdfModel.iterator());
View Full Code Here


    assertFalse(this.modelset.containsStatements(a, blankNode, RDF.object, object));
    assertFalse(this.modelset.containsStatements(a, blankNode, RDF.type, RDF.Statement));
   
    // test also the method where the resource is passed
    stmt = this.modelset.createStatement(a, subject, predicate, object);
    URI u = this.modelset.newRandomUniqueURI();
    Resource reified = this.modelset.addReificationOf(stmt, u);
    assertEquals(u, reified);
    assertTrue(this.modelset.containsStatements(a, u, RDF.subject, subject));
    assertTrue(this.modelset.containsStatements(a, u, RDF.predicate, predicate));
    assertTrue(this.modelset.containsStatements(a, u, RDF.object, object));
View Full Code Here

    assertTrue(this.modelset.isLocked());
  }
 
  @Test
  public void testNewRandomUniqueURI() {
    URI newRandomUniqueURI = this.modelset.newRandomUniqueURI();
    assertTrue(this.modelset.isValidURI(newRandomUniqueURI.toString()));
  }
View Full Code Here

public class ReportedBugsTests {

  @Test
  public void testVocabulary() {
    URI three = RDF.li(3);
    assertEquals("http://www.w3.org/1999/02/22-rdf-syntax-ns#_3", three
        .toString());
  }
View Full Code Here

   * @param replacement - Map of BlankNode/URI pairs
   * @param counter
   * @return URI generated for the BlankNode
   */
  private static URI bnodeToUri(BlankNode blankNode, Map<BlankNode,URI> replacement, long counter) {
    URI result = replacement.get(blankNode);
    if(result == null) {
      result = new URIImpl("blank://" + counter);
      // TODO BlankNode identity might be too weak
      replacement.put(blankNode, result);
    }
View Full Code Here

                try {
                    fileName = MimeUtility.decodeWord(fileName);
                } catch (MessagingException e) {
                    // happens on unencoded file names! so just ignore it and leave the file name as it is
                }
                URI attachURI = URIGenerator.createNewRandomUniqueURI();
                rdf.add(NMO.hasAttachment, attachURI);
                Model m = rdf.getModel();
                m.addStatement(attachURI, RDF.type, NFO.Attachment);
                m.addStatement(attachURI, NFO.fileName, fileName);
                if (handler != null) {
View Full Code Here

        } catch (InitializationException e) {
            throw new ExtractorException("Could not initialize HtmlExtractor: " + e.getMessage());
        }
        InputStream stream = new ByteArrayInputStream(string.getBytes());
        RDFContainerFactory containerFactory = new RDFContainerFactoryImpl();
        URI id = rdf.getDescribedUri();
        RDFContainer result = containerFactory.getRDFContainer(id);
        extractor.extract(id, charset, stream, result);
        Model meta = result.getModel();
       
        // append metadata and full-text to a string buffer
View Full Code Here

       
        RDFContainerFactory rdfFactory = new RDFContainerFactoryImpl();
        for (int i = argv; i < args.length; ++i) {
            File file = new File(args[i]);
            InputStream in = new FileInputStream(file);
            URI uri = new URIImpl(file.toURI().toString());
            RDFContainer rdfContainer = rdfFactory.getRDFContainer(uri);
            extractor.extract(uri, in, null, null, rdfContainer);
            Model model = rdfContainer.getModel();
            model.writeTo(System.out, Syntax.RdfXml);
            model.close();
View Full Code Here

        Model remove = RDF2Go.getModelFactory().createModel();
        remove.open();
        for (Statement stmt : model) {
            Resource subj = stmt.getSubject();
            URI pred = stmt.getPredicate();
            Node obj = stmt.getObject();
            boolean match = false;
            if (subj instanceof BlankNode) {
                match = true;
                URI newSubj = nodeMap.get(subj);
                if (newSubj == null) {
                    newSubj = URIGenerator.createNewRandomUniqueURI();
                    nodeMap.put(subj.asBlankNode(), newSubj);
                }
                subj = newSubj;
            }
            if (obj instanceof BlankNode) {
                match = true;
                URI newObj = nodeMap.get(obj);
                if (newObj == null) {
                    newObj = URIGenerator.createNewRandomUniqueURI();
                    nodeMap.put(obj.asBlankNode(), newObj);
                }
                obj = newObj;
View Full Code Here

        for (int i = argv; i < args.length; ++i) {
            File file = new File(args[i]);
            InputStream input = new FileInputStream(file);
            Charset charset = Charset.forName("UTF-8");
            String mimeType = "text/html";
            URI uri = new URIImpl(file.toURI().toString());
            RDFContainer container = rdfFactory.getRDFContainer(uri);
            inst.extract(uri, input, charset, mimeType, container);
            System.out.println("Model for " + args[i]);
            container.getModel().writeTo(System.out);
            System.out.println();
View Full Code Here

TOP

Related Classes of org.ontoware.rdf2go.model.node.URI

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.