Package com.hp.hpl.jena.rdf.model

Examples of com.hp.hpl.jena.rdf.model.RDFReader


    private Model parseToModelNTriples(String string)
    {
        StringReader r = new StringReader(string) ;
        Model model = ModelFactory.createDefaultModel() ;
        RDFReader reader = new JenaReaderNTriples2() ;
        reader.read(model, r, null) ;
        return model ;
    }
View Full Code Here


    private Model parseToModelRdfJson(String string)
    {
        StringReader r = new StringReader(string) ;
        Model model = ModelFactory.createDefaultModel() ;
        RDFReader reader = new JenaReaderRdfJson() ;
        reader.read(model, r, null) ;
        return model ;
    }
View Full Code Here

    }
   
    private void testJenaReaderRdfJson()
    {
        Model model = ModelFactory.createDefaultModel() ;
        RDFReader t = new JenaReaderRdfJson() ;
        try {
            if ( baseIRI != null )
            {
                InputStream in =  FileManager.get().open(input) ;
                Reader r = PeekReader.makeUTF8(in) ;
                t.read(model, r, baseIRI) ;
            }
            else
                t.read(model, input)

            Model results = FileManager.get().loadModel(output) ;

            boolean b = model.isIsomorphicWith(results) ;
            if ( !b )
View Full Code Here

        ByteArrayOutputStream baos = new ByteArrayOutputStream() ;
        writer.write(results, baos, baseIRI) ;

        InputStream in = new ByteArrayInputStream(baos.toByteArray()) ;
        Model model = ModelFactory.createDefaultModel() ;
        RDFReader reader = new JenaReaderRdfJson() ;
        try {
            if ( baseIRI != null )
            {
                Reader r = PeekReader.makeUTF8(in) ;
                reader.read(model, r, baseIRI) ;
            }
            else
                reader.read(model, in, null)

            boolean b = model.isIsomorphicWith(results) ;
            if ( !b )
            {
              write ( model, results ) ;
View Full Code Here

//        System.err.print("+");
//        System.err.flush();
    Model grddl[] = new Model[prop==null?2:3];
    for (int i=0;i<grddl.length;i++) {
      grddl[i] = ModelFactory.createDefaultModel();
      RDFReader rdr = grddl[i].getReader("GRDDL");
      switch (i) {
      case 1:
        rdr.setProperty("header.negotiate", "*");
        break;
      case 2:
        rdr.setProperty(prop, val);
        break;
      }
          rdr.read(grddl[i], base);
    }
    int matched = 0, used = 0;
    for (int i=0; i<outCount;i++) {
      Model out = ModelFactory.createDefaultModel();
      out.read(outputs[i].getURI(),base,"RDF/XML");
View Full Code Here

        { super( name ); }
   
    public void testArpOption() {
      eCnt = 0;
      Model m = createMemModel();
      RDFReader r = m.getReader("GRDDL");
      r.setErrorHandler(this);
      r.setProperty("WARN_UNQUALIFIED_ATTRIBUTE", "EM_IGNORE");
        r.read(m, "http://jena.sourceforge.net/test/grddl/warn.html");
        assertEquals("Warning not suppressed",0,eCnt);
        Model m2 = createMemModel();
        m2.read("http://jena.sourceforge.net/test/grddl/warn.rdf",
            "http://jena.sourceforge.net/test/grddl/warn.html",
            "RDF/XML");
View Full Code Here

        assertIsoModels(m2, m);
    }
    public void testWarningGiven() {
      eCnt = 0;
      Model m = createMemModel();
      RDFReader r = m.getReader("GRDDL");
      r.setErrorHandler(this);
      r.read( m, "http://jena.sourceforge.net/test/grddl/warn.html");
        assertEquals("Warning not given",1,eCnt);
        Model m2 = createMemModel();
        m2.read("http://jena.sourceforge.net/test/grddl/warn.rdf",
            "http://jena.sourceforge.net/test/grddl/warn.html",
            "RDF/XML");
View Full Code Here

    Model m1 = ModelFactory.createDefaultModel();
    Model m2 = ModelFactory.createDefaultModel();
    if (option==null)
      m1.read(input, "GRDDL");
    else {
      RDFReader rdr = m1.getReader("GRDDL");
      rdr.setProperty(option, value);
      rdr.read(m1, input);
    }
     
    URLConnection conn = new URL(output).openConnection();
    conn
        .setRequestProperty(
View Full Code Here

    public GrddlSpecificTest( String name )
        { super( name ); }
   
    public void testRDFa() {
      Model m = createMemModel();
      RDFReader r = m.getReader("GRDDL");
      r.setProperty("grddl.rdfa", "true");
        r.read(m, "http://www.w3.org/2001/sw/grddl-wg/td/hCardFabien-RDFa.html");
        Model m2 = createMemModel();
        m2.read("http://www.w3.org/2001/sw/grddl-wg/td/hCardFabien-output.rdf",
            "http://www.w3.org/2001/sw/grddl-wg/td/hCardFabien-RDFa.html",
            "RDF/XML");
        assertIsoModels(m2, m);
View Full Code Here

  {
        Model model = ModelFactory.createDefaultModel() ;
      IRIFactory f = ARPOptions.getIRIFactoryGlobal() ;
      try {
          ARPOptions.setIRIFactoryGlobal(IRIFactory.iriImplementation()) ;
          RDFReader r =  model.getReader("RDF/XML") ;
            expected = new int[] { WARN_MALFORMED_URI , WARN_MALFORMED_URI };
          r.setErrorHandler(this);
          r.read(model, new StringReader(RDF_TEXT), "http://example/") ;
      } finally { ARPOptions.setIRIFactoryGlobal(f) ; }
        checkExpected() ;
  }         
View Full Code Here

TOP

Related Classes of com.hp.hpl.jena.rdf.model.RDFReader

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.