Package org.fcrepo.server.storage.types

Examples of org.fcrepo.server.storage.types.TupleArrayTripleIterator


            term = obj.toString();
        } else if (xsdType.equals("xsd:nonNegativeInteger")) {
            term = obj.toString();
        } else if (xsdType.equals("fedora-types:RelationshipTuple")) {
            RelationshipTuple[] tuples = (RelationshipTuple[]) obj;
            TupleArrayTripleIterator iter =
                    new TupleArrayTripleIterator(new ArrayList<RelationshipTuple>(Arrays
                            .asList(tuples)));
            ByteArrayOutputStream os = new ByteArrayOutputStream();
            try {
                iter.toStream(os, RDFFormat.NOTATION_3, false);
            } catch (TrippiException e) {
                e.printStackTrace();
            }
            term = new String(os.toByteArray());
        } else if (javaType != null && javaType.equals("java.lang.String")) {
View Full Code Here


            // assume the subject is the object as denoted by the pid
            subject = PID.toURI(pid);
        }
        try {
            RelationshipTuple[] tuples = m_management.getRelationships(context, subject, predicate);
            TripleIterator it = new TupleArrayTripleIterator(new ArrayList<RelationshipTuple>(Arrays.asList(tuples)));
            ByteArrayOutputStream out = new ByteArrayOutputStream();

            format = format.toLowerCase();
            RDFFormat outputFormat;
            MediaType mediaType;
            if (format.equalsIgnoreCase("xml") || format.equals("rdf/xml")) {
                outputFormat = RDFFormat.RDF_XML;
                mediaType = new MediaType("application", "rdf+xml");
            } else if (format.equals("n-triples") || format.equals("ntriples")) {
                outputFormat = RDFFormat.N_TRIPLES;
                mediaType = MediaType.TEXT_PLAIN_TYPE;
            } else if (format.equals("turtle")) {
                outputFormat = RDFFormat.TURTLE;
                mediaType = new MediaType("application", "x-turtle");
            } else if (format.equals("sparql")) {
                outputFormat = RDFFormat.SPARQL;
                mediaType = new MediaType("application", "sparql-results+xml");
            } else {
                throw new IllegalArgumentException("unknown format: " + format);
            }
            it.toStream(out, outputFormat);
            return Response.ok(out.toString("UTF-8"), mediaType).build();
        } catch (ServerException e) {
            return handleException(e, flash);
        } catch (TrippiException e) {
            return handleException(e, flash);
View Full Code Here

                                                           datatype));
            dataChanged();
        }

        public InputStream serializeAsStream() {
            TupleArrayTripleIterator iter =
                    new TupleArrayTripleIterator(entries);
            ByteArrayOutputStream os = new ByteArrayOutputStream();
            try {
                iter.toStream(os, RDFFormat.RDF_XML, false);
            } catch (TrippiException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            ByteArrayInputStream is =
View Full Code Here

                    new ByteArrayInputStream(os.toByteArray());
            return is;
        }

        public String serializeAsString() {
            TupleArrayTripleIterator iter =
                    new TupleArrayTripleIterator(entries);
            ByteArrayOutputStream os = new ByteArrayOutputStream();
            try {
                iter.toStream(os, RDFFormat.RDF_XML, false);
            } catch (TrippiException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            String results = new String(os.toByteArray());
View Full Code Here

TOP

Related Classes of org.fcrepo.server.storage.types.TupleArrayTripleIterator

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.