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

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


    public Iterable<Representation> update(Iterable<Representation> representations) throws YardException, IllegalArgumentException {
        Yard yard = getCacheYard();
        if (yard == null) {
            throw new YardException(String.format("The Yard %s for this cache is currently not available", yardId));
        } else {
            return yard.update(representations);
        }
    }
}
View Full Code Here


    public Representation update(Representation representation) throws YardException, IllegalArgumentException {
        Yard yard = getCacheYard();
        if (yard == null) {
            throw new YardException(String.format("The Yard %s for this cache is currently not available", yardId));
        } else {
            return yard.update(applyCacheMappings(yard, representation));
        }
    }

    /**
     * Applies the mappings defined by the {@link #baseMapper} and the {@link #additionalMapper}
View Full Code Here

        Representation test2 = create(id2, true);
        // change the representations to be sure to force an update even if the
        // implementation checks for changes before updating a representation
        test1.add(field, "test value 1");
        test2.add(field, "test value 2");
        Iterable<Representation> updatedIterable = yard.update(Arrays.asList(test1, test2));
        assertNotNull(updatedIterable);
        Collection<Representation> updated = asCollection(updatedIterable.iterator());
        // test that both the parsed Representations where stored (updated & created)
        assertTrue(updated.remove(test1));
        assertTrue(updated.remove(test2));
View Full Code Here

        String field = "urn:the.field:used.for.this.Test";
        Representation test1 = create(id1, true);
        // change the representations to be sure to force an update even if the
        // implementation checks for changes before updating a representation
        test1.add(field, "test value 1");
        Iterable<Representation> updated = yard.update(Arrays.asList(test1, null));
        assertNotNull(updated);
        Iterator<Representation> updatedIt = updated.iterator();
        assertTrue(updatedIt.hasNext());
        assertEquals(test1, updatedIt.next());
        assertFalse(updatedIt.hasNext());
View Full Code Here

        test1.add(field, "test value 1");
        // create a 2nd Representation by using the ValueFactory (will not add it
        // to the yard!)
        Representation test2 = create(id2, false);
        // now test1 is present and test2 is not.
        Iterable<Representation> updated = yard.update(Arrays.asList(test1, test2));
        // We expect that only test1 is updated and test2 is ignored
        assertNotNull(updated);
        Iterator<Representation> updatedIt = updated.iterator();
        assertTrue(updatedIt.hasNext());
        assertEquals(test1, updatedIt.next());
View Full Code Here

        assertTrue(values.remove(testValue)); // test that it contains the value
        assertTrue(values.isEmpty()); // and that there is only this value
        values = null;
        // now update the stored version with the new state
        stored = null;
        stored = yard.update(test);
        values = asCollection(stored.get(field));
        assertTrue(values.remove(testValue)); // test that it contains the original
        assertTrue(values.remove(testValue2)); // test that it contains the 2nd value
        assertTrue(values.isEmpty()); // and that there are only these two values
        values = null;
View Full Code Here

        test1.addNaturalText(NamespaceEnum.rdfs+"label","expected result","en");
        test2.addNaturalText(NamespaceEnum.rdfs+"label","space","en");
        test2.addNaturalText(NamespaceEnum.rdfs+"comment","URIs with space got separated "
            + "in queries causing parts in URIs after spaces to form full text "
            + "queries instead!","en");
        yard.update(test1);
        yard.update(test2);
        //now try to query for some combination
        assertNull("No Entity with ID 'http://www.example.com/with URIs' expected",
            yard.getRepresentation("http://www.example.com/with URIs"));
        assertNull("No Entity with ID 'http://www.example.com/with' expected",
View Full Code Here

        test2.addNaturalText(NamespaceEnum.rdfs+"label","space","en");
        test2.addNaturalText(NamespaceEnum.rdfs+"comment","URIs with space got separated "
            + "in queries causing parts in URIs after spaces to form full text "
            + "queries instead!","en");
        yard.update(test1);
        yard.update(test2);
        //now try to query for some combination
        assertNull("No Entity with ID 'http://www.example.com/with URIs' expected",
            yard.getRepresentation("http://www.example.com/with URIs"));
        assertNull("No Entity with ID 'http://www.example.com/with' expected",
            yard.getRepresentation("http://www.example.com/with"));
View Full Code Here

        Representation test2 = create(id2, true);
        // change the representations to be sure to force an update even if the
        // implementation checks for changes before updating a representation
        test1.add(field, "This is the text content of a field with value1.");
        test2.add(field, "This is the text content of a field with value2.");
        Iterable<Representation> updatedIterable = yard.update(Arrays.asList(test1, test2));
        assertNotNull(updatedIterable);

        FieldQuery query = yard.getQueryFactory().createFieldQuery();
        query.setConstraint(field, new TextConstraint(Arrays.asList("text content")));
        QueryResultList<Representation> results = yard.find(query);
View Full Code Here

        test2.add(filterfield, "Some other content");

        test3.add(similarityfield, "eeee eeee ffff gggg");
        test3.add(filterfield, "Different content");

        Iterable<Representation> updatedIterable = yard.update(Arrays.asList(test1, test2, test3));
        assertNotNull(updatedIterable);

        // Perform a first similarity query that looks a lot like the first document
        FieldQuery query = yard.getQueryFactory().createFieldQuery();
        query.setConstraint(similarityfield, new SimilarityConstraint("aaaa aaaa aaaa aaaa zzzz yyyy"));
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.