Search in sources :

Example 86 with Representation

use of org.apache.stanbol.entityhub.servicesapi.model.Representation in project stanbol by apache.

the class RepresentationTest method testGetNaturalTextWithLanguagesWithoutValues.

@Test
public void testGetNaturalTextWithLanguagesWithoutValues() {
    String field = "urn:the.field:used.for.this.Test";
    Representation rep = initNaturalLanguageTest(field);
    // test not present language
    Iterator<Text> esTexts = rep.get(field, "es");
    assertNotNull(esTexts);
    assertFalse(esTexts.hasNext());
    // test multiple not present languages
    Iterator<Text> frItTexts = rep.get(field, "fr", "it");
    assertNotNull(frItTexts);
    assertFalse(frItTexts.hasNext());
}
Also used : Representation(org.apache.stanbol.entityhub.servicesapi.model.Representation) Text(org.apache.stanbol.entityhub.servicesapi.model.Text) Test(org.junit.Test)

Example 87 with Representation

use of org.apache.stanbol.entityhub.servicesapi.model.Representation in project stanbol by apache.

the class RepresentationTest method testNullFieldGet.

@Test(expected = IllegalArgumentException.class)
public void testNullFieldGet() {
    Representation rep = createRepresentation(null);
    rep.get(null);
}
Also used : Representation(org.apache.stanbol.entityhub.servicesapi.model.Representation) Test(org.junit.Test)

Example 88 with Representation

use of org.apache.stanbol.entityhub.servicesapi.model.Representation in project stanbol by apache.

the class RepresentationTest method testEmptyFieldRemoveNaturalText.

@Test(expected = IllegalArgumentException.class)
public void testEmptyFieldRemoveNaturalText() {
    Representation rep = createRepresentation(null);
    rep.removeNaturalText("", "test");
}
Also used : Representation(org.apache.stanbol.entityhub.servicesapi.model.Representation) Test(org.junit.Test)

Example 89 with Representation

use of org.apache.stanbol.entityhub.servicesapi.model.Representation in project stanbol by apache.

the class RepresentationTest method testEmptyFieldGet.

@Test(expected = IllegalArgumentException.class)
public void testEmptyFieldGet() {
    Representation rep = createRepresentation(null);
    rep.get("");
}
Also used : Representation(org.apache.stanbol.entityhub.servicesapi.model.Representation) Test(org.junit.Test)

Example 90 with Representation

use of org.apache.stanbol.entityhub.servicesapi.model.Representation in project stanbol by apache.

the class RepresentationTest method testNullFieldRemoveReference.

@Test(expected = IllegalArgumentException.class)
public void testNullFieldRemoveReference() {
    Representation rep = createRepresentation(null);
    rep.removeReference(null, "urn:test");
}
Also used : Representation(org.apache.stanbol.entityhub.servicesapi.model.Representation) Test(org.junit.Test)

Aggregations

Representation (org.apache.stanbol.entityhub.servicesapi.model.Representation)198 Test (org.junit.Test)117 Text (org.apache.stanbol.entityhub.servicesapi.model.Text)32 HashSet (java.util.HashSet)31 Yard (org.apache.stanbol.entityhub.servicesapi.yard.Yard)25 Entity (org.apache.stanbol.entityhub.servicesapi.model.Entity)16 YardException (org.apache.stanbol.entityhub.servicesapi.yard.YardException)15 ValueFactory (org.apache.stanbol.entityhub.servicesapi.model.ValueFactory)14 Reference (org.apache.stanbol.entityhub.servicesapi.model.Reference)12 FieldQuery (org.apache.stanbol.entityhub.servicesapi.query.FieldQuery)12 ArrayList (java.util.ArrayList)11 RdfRepresentation (org.apache.stanbol.entityhub.model.sesame.RdfRepresentation)10 IOException (java.io.IOException)9 IRI (org.apache.clerezza.commons.rdf.IRI)9 ResponseBuilder (javax.ws.rs.core.Response.ResponseBuilder)8 Graph (org.apache.clerezza.commons.rdf.Graph)8 IndexedGraph (org.apache.stanbol.commons.indexedgraph.IndexedGraph)8 RdfRepresentation (org.apache.stanbol.entityhub.model.clerezza.RdfRepresentation)8 RdfValueFactory (org.apache.stanbol.entityhub.model.clerezza.RdfValueFactory)8 EntityhubException (org.apache.stanbol.entityhub.servicesapi.EntityhubException)8