Package com.github.jsonldjava.core

Examples of com.github.jsonldjava.core.RDFDataset


                + subject.getClass().getName());
    }

    @Override
    public RDFDataset parse(Object input) throws JsonLdError {
        final RDFDataset result = new RDFDataset();
        if (input instanceof Statement) {
            handleStatement(result, (Statement) input);
        } else if (input instanceof Graph) {
            if (input instanceof Model) {
                final Set<Namespace> namespaces = ((Model) input).getNamespaces();
View Full Code Here


            // opts.skipExpansion = false;
            opts.setCompactArrays(true);
            // opts.keepFreeFloatingNodes = false;
            final JsonLdApi api = new JsonLdApi(opts);
            final JenaRDFParser parser = new JenaRDFParser();
            final RDFDataset result = parser.parse(dataset);
            Object obj = api.fromRDF(result);
            final Map<String, Object> localCtx = new HashMap<String, Object>();
            localCtx.put("@context", ctx);

            // TODO: How/when to do simplify vs compact?
View Full Code Here

        }
    }

    @Override
    public RDFDataset parse(Object input) throws JsonLdError {
        final RDFDataset result = new RDFDataset();

        // empty dataset if no input given
        if (input == null) {
            return result;
        }
View Full Code Here

        model.add(resource, property, "Test");

        final JsonLdOptions options = new JsonLdOptions();
        options.format = "application/ld+json";
        final JenaRDFParser parser = new JenaRDFParser();
        final RDFDataset dataset = parser.parse(model);
        final Object json = new JsonLdApi(options).fromRDF(dataset);
        final String jsonStr = JSONUtils.toPrettyString(json);
        // System.out.println(jsonStr);
        assertTrue(jsonStr.contains("@id"));
        assertTrue(jsonStr.contains("http://example.com/test"));
View Full Code Here

        model.add(resource, property, "Test");

        final JsonLdOptions options = new JsonLdOptions();
        options.format = "application/ld+json";
        final JsonLdApi api = new JsonLdApi(options);
        final RDFDataset dataset = new RDFDataset(api);
        final Object json = api.fromRDF(dataset);
        final String jsonStr = JSONUtils.toPrettyString(json);
        System.out.println(jsonStr);
        // [ {
        // "@id" : "http://example.com/test",
View Full Code Here

TOP

Related Classes of com.github.jsonldjava.core.RDFDataset

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.