Examples of removeNaturalText()


Examples of org.apache.stanbol.entityhub.servicesapi.model.Representation.removeNaturalText()

    public void testRemoveNaturalTextWithWrongLanguage() {
        String field = "urn:the.field:used.for.this.Test";
        Representation rep = initNaturalLanguageTest(field);
        // Test removal of natural language
        // remove a specific test, but wrong language -> no effect
        rep.removeNaturalText(field, NL_TEST_en2, "de");
        assertTrue(asCollection(rep.get(field)).size() == NL_TEST_all.size());
    }

    @Test
    public void testRemoveNaturalTextWithWrongNullLanguage() {
View Full Code Here

Examples of org.apache.stanbol.entityhub.servicesapi.model.Representation.removeNaturalText()

    @Test
    public void testRemoveNaturalTextWithWrongNullLanguage() {
        String field = "urn:the.field:used.for.this.Test";
        Representation rep = initNaturalLanguageTest(field);
        // remove a specific text, but with wrong null language -> also no effect
        rep.removeNaturalText(field, NL_TEST_de, (String) null);
        assertTrue(asCollection(rep.get(field)).size() == NL_TEST_all.size());
    }

    @Test
    public void testRemoveNaturalTextWithCorrectAndWrongLanguage() {
View Full Code Here

Examples of org.apache.stanbol.entityhub.servicesapi.model.Representation.removeNaturalText()

    @Test
    public void testRemoveNaturalTextWithCorrectAndWrongLanguage() {
        String field = "urn:the.field:used.for.this.Test";
        Representation rep = initNaturalLanguageTest(field);
        // remove a specific text, parse one correct and one wrong lang
        rep.removeNaturalText(field, NL_TEST_en2, "de", "en");
        Set<String> textSet = new HashSet<String>(NL_TEST_all);
        // remove all remaining values
        for (Iterator<Text> texts = rep.getText(field); texts.hasNext(); textSet.remove(texts.next()
                .getText()))
            ;
View Full Code Here

Examples of org.apache.stanbol.entityhub.servicesapi.model.Representation.removeNaturalText()

        String field = "urn:the.field:used.for.this.Test";
        Representation rep = initNaturalLanguageTest(field);
        Set<String> textSet = new HashSet<String>(NL_TEST_all);

        // remove a string value by parsing the text and null as language
        rep.removeNaturalText(field, NL_TEST_string, (String) null);
        for (Iterator<Text> texts = rep.getText(field); texts.hasNext(); textSet.remove(texts.next()
                .getText()))
            ;
        assertTrue(textSet.size() == 1); // only one element should be removed
        assertTrue(textSet.remove(NL_TEST_string)); // and this should be the stringTest
View Full Code Here

Examples of org.apache.stanbol.entityhub.servicesapi.model.Representation.removeNaturalText()

    public void testRemoveStringValuesByRemovingNaturalLanguageTextsWithNoLanguage() {
        String field = "urn:the.field:used.for.this.Test";
        Representation rep = initNaturalLanguageTest(field);
        Set<String> textSet = new HashSet<String>(NL_TEST_all);
        // remove a string value by parsing only the text
        rep.removeNaturalText(field, NL_TEST_string);
        textSet.addAll(Arrays.asList(NL_TEST_string, NL_TEST_noLang, NL_TEST_en, NL_TEST_en2, NL_TEST_de,
            NL_TEST_de_AT));
        for (Iterator<Text> texts = rep.getText(field); texts.hasNext(); textSet.remove(texts.next()
                .getText()))
            ;
View Full Code Here

Examples of org.apache.stanbol.entityhub.servicesapi.model.Representation.removeNaturalText()

    public void testRemoveStringValuesByRemovingNaturalLanguageTextsWithEmptyLanguageArray() {
        String field = "urn:the.field:used.for.this.Test";
        Representation rep = initNaturalLanguageTest(field);
        Set<String> textSet = new HashSet<String>(NL_TEST_all);
        // remove a string value by parsing an empty list of languages
        rep.removeNaturalText(field, NL_TEST_string, new String[] {});
        textSet.addAll(Arrays.asList(NL_TEST_string, NL_TEST_noLang, NL_TEST_en, NL_TEST_en2, NL_TEST_de,
            NL_TEST_de_AT));
        for (Iterator<Text> texts = rep.getText(field); texts.hasNext(); textSet.remove(texts.next()
                .getText()))
            ;
View Full Code Here

Examples of org.apache.stanbol.entityhub.servicesapi.model.Representation.removeNaturalText()

    public void testRemoveNaturalLanguageValueInMultipleLanguages() {
        String field = "urn:the.field:used.for.this.Test";
        Representation rep = createRepresentation(null);
        // add the same label for multiple languages
        rep.addNaturalText(field, NL_TEST_noLang, "en", "de", null);
        rep.removeNaturalText(field, NL_TEST_noLang, "en", null);
        Iterator<Text> texts = rep.get(field, (String[]) null);
        assertTrue(texts.hasNext());
        Text text = texts.next();
        assertFalse(texts.hasNext());
        assertEquals("de", text.getLanguage());
View Full Code Here

Examples of org.apache.stanbol.entityhub.servicesapi.model.Representation.removeNaturalText()

    }

    @Test(expected = IllegalArgumentException.class)
    public void testEmptyFieldRemoveNaturalText() {
        Representation rep = createRepresentation(null);
        rep.removeNaturalText("", "test");
    }

    @Test(expected = IllegalArgumentException.class)
    public void testEmptyFieldRemoveReference() {
        Representation rep = createRepresentation(null);
View Full Code Here

Examples of org.apache.stanbol.entityhub.servicesapi.model.Representation.removeNaturalText()

        // test removal for texts (with and without language)
        String strText = "test text";
        String strTextLang = "en";
        rep.addNaturalText(field, strText, strTextLang);
        assertTrue(asCollection(rep.getFieldNames()).contains(field));
        rep.removeNaturalText(field, strText, strTextLang);
        assertFalse(asCollection(rep.getFieldNames()).contains(field));

        String strTextNoLang = "test text without lang";
        rep.addNaturalText(field, strTextNoLang);
        assertTrue(asCollection(rep.getFieldNames()).contains(field));
View Full Code Here

Examples of org.apache.stanbol.entityhub.servicesapi.model.Representation.removeNaturalText()

        assertFalse(asCollection(rep.getFieldNames()).contains(field));

        String strTextNoLang = "test text without lang";
        rep.addNaturalText(field, strTextNoLang);
        assertTrue(asCollection(rep.getFieldNames()).contains(field));
        rep.removeNaturalText(field, strTextNoLang);
        assertFalse(asCollection(rep.getFieldNames()).contains(field));

        // there is also the possibility to explicitly parse null as language
        // could internally case differences however externally this is the same
        rep.addNaturalText(field, strTextNoLang, (String) null);
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.