Package org.openrdf.rio

Examples of org.openrdf.rio.RDFFormat


        } else {
            acceptedTypes = MarmottaHttpUtils.parseAcceptHeader(request.getHeader("Accept"));
        }
       
        ContentType _bestType = null;
        RDFFormat _format = null;
        for (ContentType ct : acceptedTypes) {
            final RDFFormat f = Rio.getWriterFormatForMIMEType(ct.getMime());
            if (f != null) {
                _bestType = ct;
                _format = f;
                break;
            }
        }
        if (_bestType == null || _format == null) {
            // FIXME: todo
            return Response.status(Status.BAD_REQUEST).entity("Could not determine Format").build();
        }
       
        final RDFFormat format = _format;
        final ContentType returnType = _bestType;
       
        final StreamingOutput entity = new StreamingOutput() {
            @Override
            public void write(OutputStream outputStream) throws IOException,
View Full Code Here


    }

    @Override
    public List<String> parseResponse(final String resourceUri, final String requestUrl, Model triples, InputStream in, final String contentType) throws DataRetrievalException {

        RDFFormat format;
        if (StringUtils.isNotBlank(contentType) && (contentType.contains("text/plain")||contentType.contains("text/turtle"))) {
            format = DEFAULT_RDF_FORMAT;
        } else {
            format = Rio.getWriterFormatForMIMEType(contentType, DEFAULT_RDF_FORMAT);
        }
View Full Code Here

    public static <T extends String, V extends RepositoryConnection> Matcher<T> rdfStringMatches(RDFFormat format, String baseUri, Matcher<V>... matchers) {
        return  RdfStringMatcher.wrap(format, baseUri, CoreMatchers.allOf(matchers));
    }

    public static <T extends String, V extends RepositoryConnection> Matcher<T> rdfStringMatches(String mimeType, String baseUri, Matcher<V> matcher) {
        final RDFFormat format = Rio.getParserFormatForMIMEType(mimeType);
        if (format == null) throw new UnsupportedRDFormatException(mimeType);
        return  RdfStringMatcher.wrap(format, baseUri, matcher);
    }
View Full Code Here

        if (format == null) throw new UnsupportedRDFormatException(mimeType);
        return  RdfStringMatcher.wrap(format, baseUri, matcher);
    }

    public static <T extends String, V extends RepositoryConnection> Matcher<T> rdfStringMatches(String mimeType, String baseUri, Matcher<V> matcher1, Matcher<V> matcher2) {
        final RDFFormat format = Rio.getParserFormatForMIMEType(mimeType);
        if (format == null) throw new UnsupportedRDFormatException(mimeType);
        return  RdfStringMatcher.wrap(format, baseUri, CoreMatchers.allOf(matcher1, matcher2));
    }
View Full Code Here

        return  RdfStringMatcher.wrap(format, baseUri, CoreMatchers.allOf(matcher1, matcher2));
    }

    @SafeVarargs
    public static <T extends String, V extends RepositoryConnection> Matcher<T> rdfStringMatches(String mimeType, String baseUri, Matcher<V>... matchers) {
        final RDFFormat format = Rio.getParserFormatForMIMEType(mimeType);
        if (format == null) throw new UnsupportedRDFormatException(mimeType);
        return  RdfStringMatcher.wrap(format, baseUri, CoreMatchers.allOf(matchers));
    }
View Full Code Here

    public List<String> getTypes(@QueryParam("filename") String filename) {
        if(filename == null)
            return new ArrayList<String>(importService.getAcceptTypes());
        else {
            List<String> result = new ArrayList<String>();
            RDFFormat format = Rio.getParserFormatForFileName(filename);
            if(format != null) {
                result.addAll(format.getMIMETypes());
            }
            return result;
        }
    }
View Full Code Here

        } else {
            fileName = "lmf-export-" + DateUtils.FILENAME_FORMAT.format(new Date());
        }

        if(bestType != null) {
            RDFFormat format = Rio.getWriterFormatForMIMEType(bestType.getMime());
            if(format != null) {
                fileName += "." + format.getDefaultFileExtension();
            }

            URI context = null;
            if(context_string != null) {
                try {
View Full Code Here

     * @throws org.apache.marmotta.platform.core.exception.io.UnsupportedExporterException
     *                             in case there is no matching exporter for the given mime type
     */
    @Override
    public String exportData(URI context, String mimeType) throws UnsupportedExporterException {
        RDFFormat serializer = ioService.getSerializer(mimeType);
        if(serializer == null) {
            log.warn("could not find serializer for MIME type {}",mimeType);
            throw new UnsupportedExporterException("No serializer for mime type "+mimeType);
        }
        try {
View Full Code Here

     *                             in case there is no matching exporter for the given mime type
     * @throws java.io.IOException in case there is an error writing to the output
     */
    @Override
    public void exportData(Writer writer, URI context, String mimeType) throws UnsupportedExporterException, IOException {
        RDFFormat serializer = ioService.getSerializer(mimeType);
        if(serializer == null) {
            log.warn("could not find serializer for MIME type {}",mimeType);
            throw new UnsupportedExporterException("No serializer for mime type "+mimeType);
        }

View Full Code Here

     *                             in case there is no matching exporter for the given mime type
     * @throws java.io.IOException in case there is an error writing to the output
     */
    @Override
    public void exportData(OutputStream outputStream, URI context, String mimeType) throws UnsupportedExporterException, IOException {
        RDFFormat serializer = ioService.getSerializer(mimeType);
        if(serializer == null) {
            log.warn("could not find serializer for MIME type {}",mimeType);
            throw new UnsupportedExporterException("No serializer for mime type "+mimeType);
        }
        // HINT: This method might be executed outside a transaction!
View Full Code Here

TOP

Related Classes of org.openrdf.rio.RDFFormat

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.