Package org.openrdf.rio

Examples of org.openrdf.rio.RDFHandler


  @Override
  public void removeMatch(Resource subject, URI predicate, Value object, Resource... contexts)
    throws StoreException
  {
    if (archiveContexts.length > 0) {
      RDFHandler handler = new RDFInserter(getDelegate());
      try {
        getDelegate().exportMatch(subject, predicate, object, true, handler, archiveContexts);
      }
      catch (RDFHandlerException e) {
        if (e.getCause() instanceof StoreException) {
View Full Code Here


        return projectDependency;
    }

    private void exportRepositoryToRdf( String fileName )
    {
        RDFHandler rdfxmlWriter;
        try
        {
            File exportFile = new File( localRepository.getParentFile(), fileName );
            rdfxmlWriter = new RDFXMLWriter( new FileOutputStream( exportFile ) );
        }
View Full Code Here

        return dao;
    }

    private void exportRepositoryToRdf( String fileName, File localRepository, Repository rdfRepository )
    {
        RDFHandler rdfxmlWriter;
        try
        {
            File exportFile = new File( localRepository.getParentFile(), fileName );
            rdfxmlWriter = new RDFXMLWriter( new FileOutputStream( exportFile ) );
        }
View Full Code Here

        catch ( RepositoryException e )
        {
            throw new MojoExecutionException( e.getMessage() );
        }

        RDFHandler rdfxmlWriter;
        try
        {
            rdfxmlWriter = new RDFXMLWriter( new FileOutputStream( localRepository+"/rdf-repository-export.xml" ) );
        }
        catch ( IOException e )
View Full Code Here

        try {
            this.commit();
            final SailConnection c = this.rawGraph.getConnection();
            try {
                c.begin();
                RDFHandler h = null == baseGraph
                        ? new SailAdder(c)
                        : new SailAdder(c, new URIImpl(baseGraph));
                if (rdfHandlers != null) {
                    RDFHandler[] handlers = new RDFHandler[rdfHandlers.length + 1];
                    handlers[0] = h;
View Full Code Here

     */
    public GraphSail(final T graph) {
        this(graph, "p,c,pc");

        RDFParser p = Rio.createParser(org.openrdf.rio.RDFFormat.NTRIPLES);
        p.setRDFHandler(new RDFHandler() {
            public void startRDF() throws RDFHandlerException {}
            public void endRDF() throws RDFHandlerException {}
            public void handleNamespace(String s, String s1) throws RDFHandlerException {}
            public void handleStatement(Statement s) throws RDFHandlerException {

View Full Code Here

                           final RDFFormat format) throws Exception {
        try {
            SailConnection sc = sail.getConnection();
            sc.begin();
            try {
                RDFHandler h = new SailAdder(sc);
                RDFParser p = Rio.createParser(format);
                p.setRDFHandler(h);
                p.parse(in, "http://example.org/bogusBaseURI/");
                sc.commit();
            } finally {
View Full Code Here

     * @throws java.io.IOException
     */
    public void saveRepositoryAsN3(String output_file_path) throws RepositoryException, RDFHandlerException, IOException {
        FileWriter outFile = new FileWriter(output_file_path);
        //PrintWriter out = new PrintWriter(outFile);
        RDFHandler n3Writer = new N3Writer(outFile);
        con.export(n3Writer);
        outFile.close();
    }
View Full Code Here

                RepositoryConnection con = response.getTriples().getConnection();
                con.begin();

                ByteArrayOutputStream out = new ByteArrayOutputStream();
                RDFHandler handler = new RDFXMLPrettyWriter(out);
                con.export(handler);

                con.commit();
                con.close();
View Full Code Here

        if(cacheSailProvider.isEnabled()) {
            try {
                ClientResponse response = cacheSailProvider.getLDClient().retrieveResource(uri);

                ByteArrayOutputStream out = new ByteArrayOutputStream();
                RDFHandler handler = new RDFXMLPrettyWriter(out);

                ModelCommons.export(response.getData(), handler);

                return Response.ok().entity( new String(out.toByteArray(), "utf-8")).build();
            } catch (Exception e) {
View Full Code Here

TOP

Related Classes of org.openrdf.rio.RDFHandler

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.