Package org.apache.marmotta.client.model.meta

Examples of org.apache.marmotta.client.model.meta.Metadata


           
            // convert Sesame Model into a map to Metadata objects
            Map<String,Metadata> result = new HashMap<String, Metadata>();
           
            for(Resource subject : model.subjects()) {
                Metadata m = new Metadata(subject.stringValue());
                for(org.openrdf.model.URI property : model.filter(subject, null, null).predicates()) {
                    Set<RDFNode> propValue = new HashSet<RDFNode>();
                    for(Value value : model.filter(subject, property, null).objects()) {
                        propValue.add(parseRDFJSONNode(value));
                    }
                    m.put(property.stringValue(),propValue);
                }
                result.put(subject.stringValue(),m);
            }
            return result;
        } catch (IOException e) {
View Full Code Here


        String data = "<http://example.com/resource/r1> <http://example.com/resource/p1> \"Test Data\".";
        client.uploadDataset(data,"text/rdf+n3");

        ResourceClient resourceClient = new ResourceClient(config);
        Metadata m = resourceClient.getResourceMetadata("http://example.com/resource/r1");
        Assert.assertNotNull(m);
        Assert.assertEquals(1,m.size());
        Assert.assertEquals("Test Data", m.getFirst("http://example.com/resource/p1").toString());

        resourceClient.deleteResource("http://example.com/resource/r1");
    }
View Full Code Here

            Map<String,Map<String,Set<Map<String,String>>>> subjects = mapper.readValue(data, new TypeReference<Map<String,Map<String,Set<Map<String,String>>>>>(){});

            // convert "raw" map into a map to Metadata objects
            Map<String,Metadata> result = new HashMap<String, Metadata>();
            for(Map.Entry<String,Map<String,Set<Map<String,String>>>> subject : subjects.entrySet()) {
                Metadata m = new Metadata(subject.getKey());
                result.put(subject.getKey(),m);

                for(Map.Entry<String,Set<Map<String,String>>> property : subject.getValue().entrySet()) {
                    Set<RDFNode> propValue = new HashSet<RDFNode>();
                    for(Map<String,String> value : property.getValue()) {
                        propValue.add(parseRDFJSONNode(value));
                    }
                    m.put(property.getKey(),propValue);
                }
            }
            return result;

        } catch (IOException e) {
View Full Code Here

TOP

Related Classes of org.apache.marmotta.client.model.meta.Metadata

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.