Package org.apache.stanbol.entityhub.servicesapi.yard

Examples of org.apache.stanbol.entityhub.servicesapi.yard.Yard.store()


        // use both ways to add the two Representations (should make no differences,
        // but one never can know ...
        Representation test1 = yard.create(id); // create and add
        Representation test2 = yard.getValueFactory().createRepresentation(id2); // create
        test2.add(field, testValue); // add value
        yard.store(test2);// store
        assertTrue(yard.isRepresentation(test1.getId())); // test if stored
        assertTrue(yard.isRepresentation(test2.getId()));
        yard.remove(Arrays.asList(test1.getId(), test2.getId())); // remove
        assertFalse(yard.isRepresentation(test1.getId())); // test if removed
        assertFalse(yard.isRepresentation(test2.getId()));
View Full Code Here


        Yard yard = getYard();
        // use both ways to add the two Representations (should make no differences,
        // but one never can know ...
        Representation test1 = yard.create(id); // create and add
        test1.add(field, testValue); // add value
        yard.store(test1);// store
        Representation test2 = yard.getValueFactory().createRepresentation(id2); // create
        test2.add(field, testValue); // add value
        yard.store(test2);// store
        assertTrue(yard.isRepresentation(test1.getId())); // test if stored
        assertTrue(yard.isRepresentation(test2.getId()));
View Full Code Here

        Representation test1 = yard.create(id); // create and add
        test1.add(field, testValue); // add value
        yard.store(test1);// store
        Representation test2 = yard.getValueFactory().createRepresentation(id2); // create
        test2.add(field, testValue); // add value
        yard.store(test2);// store
        assertTrue(yard.isRepresentation(test1.getId())); // test if stored
        assertTrue(yard.isRepresentation(test2.getId()));
        yard.removeAll(); // remove
        assertFalse(yard.isRepresentation(test1.getId())); // test if removed
        assertFalse(yard.isRepresentation(test2.getId()));
View Full Code Here

        assertTrue(yard.isRepresentation(test2.getId()));
        yard.removeAll(); // remove
        assertFalse(yard.isRepresentation(test1.getId())); // test if removed
        assertFalse(yard.isRepresentation(test2.getId()));
        //test that Yard is still useable after removeAll
        yard.store(test1);// store
        assertTrue(yard.isRepresentation(test1.getId())); // test if stored
        yard.removeAll(); // remove
        assertFalse(yard.isRepresentation(test1.getId()));
    }
    /**
 
View Full Code Here

        Yard yard = getYard();
        // use the ValueFactory to create the representation to ensure that this
        // instance has nothing to do with the store
        Representation test = create(id, false);
        // now store the empty Representation
        yard.store(test);
        // now add a values
        test.add(field, testValue);
        // now get the representation from the yard
        Representation stored = yard.getRepresentation(id);
        // test if the stored version does not contain the value
View Full Code Here

        Representation stored = yard.getRepresentation(id);
        // test if the stored version does not contain the value
        assertFalse(stored.get(field).hasNext());
        stored = null;
        // now store the updated version
        yard.store(test);
        // now check that the updated value is stored
        stored = yard.getRepresentation(id);
        assertEquals(testValue, stored.getFirst(field));

        // now we need to test if modifications of an Representation returned
View Full Code Here

    @Override
    public void store(Representation representation) throws ManagedSiteException {
        try {
            Yard yard = getYard();
            fieldMapper.applyMappings(representation, representation, yard.getValueFactory());
            yard.store(representation);
        catch (YardException e) {
            throw new ManagedSiteException(e.getMessage(), e);
        }
       
    }
View Full Code Here

    @Override
    public void store(final Iterable<Representation> representations) throws ManagedSiteException {
        try {
            Yard yard = getYard();
            final ValueFactory vf = yard.getValueFactory();
            yard.store(new Iterable<Representation>() {               
                @Override
                public Iterator<Representation> iterator() {
                    return new Iterator<Representation>() {
                        Iterator<Representation> it = representations.iterator();
                        @Override
View Full Code Here

        assertEquals(yard.getClass(), SolrYard.class);
        Representation rep = yard.getValueFactory().createRepresentation("http://www.example.com/entity#123");
        rep.add(NamespaceEnum.rdfs+"label", "test");
        rep.add(NamespaceEnum.rdfs+"description", "Representation to test storage while indexing");
        rep.add(RdfResourceEnum.entityRank.getUri(), Float.valueOf(0.8f));
        yard.store(rep);
        //finalise
        destination.finalise();
        //test the archives
        File expectedSolrArchiveFile =
            new File(config.getDistributionFolder(),config.getName()+".solrindex.zip");
View Full Code Here

        // present within the yard
        String testId = "urn:yard.test.testStoreRepresentation:representation.id1";
        String testId2 = "urn:yard.test.testStoreRepresentation:representation.id2";
        Yard yard = getYard();
        Representation test = create(testId, false);
        Representation added = yard.store(test); // this adds the representation
        assertEquals(test, added);
        Representation test2 = create(testId2, true); // this creates and adds the representation
        // now test that the representation can also be updated
        added = yard.store(test2);
        assertEquals(test2, added);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.