Search in sources :

Example 1 with NodeProxy

use of com.graphaware.nlp.util.NodeProxy in project neo4j-nlp by graphaware.

the class ConceptRequestUnitTest method testRequestThrowsFriendlyMessageWithAlmostGoodConfigKey.

@Test(expected = RuntimeException.class)
public void testRequestThrowsFriendlyMessageWithAlmostGoodConfigKey() {
    Map<String, Object> map = new HashMap<>();
    map.put("node", new NodeProxy());
    map.put("language", "en");
    map.put("admittedRelationship", new ArrayList<>());
    ConceptRequest request = ConceptRequest.fromMap(map);
}
Also used : HashMap(java.util.HashMap) ConceptRequest(com.graphaware.nlp.dsl.request.ConceptRequest) NodeProxy(com.graphaware.nlp.util.NodeProxy) Test(org.junit.Test)

Example 2 with NodeProxy

use of com.graphaware.nlp.util.NodeProxy in project neo4j-nlp by graphaware.

the class ConceptRequestUnitTest method testRequestWithLimitLongCanBeCaster.

@Test
public void testRequestWithLimitLongCanBeCaster() {
    Map<String, Object> map = new HashMap<>();
    map.put("tag", new NodeProxy());
    map.put("admittedRelationships", Arrays.asList("IsA", "PartOf"));
    map.put("admittedPos", Arrays.asList("NNS", "NN"));
    map.put("language", "en");
    map.put("splitTag", true);
    map.put("limit", 50L);
    ConceptRequest request = ConceptRequest.fromMap(map);
    assertEquals(50, request.getResultsLimit());
}
Also used : HashMap(java.util.HashMap) ConceptRequest(com.graphaware.nlp.dsl.request.ConceptRequest) NodeProxy(com.graphaware.nlp.util.NodeProxy) Test(org.junit.Test)

Example 3 with NodeProxy

use of com.graphaware.nlp.util.NodeProxy in project neo4j-nlp by graphaware.

the class ConceptRequestUnitTest method testConceptRequestFromMap.

@Test
public void testConceptRequestFromMap() {
    Map<String, Object> map = new HashMap<>();
    map.put("tag", new NodeProxy());
    map.put("admittedRelationships", Arrays.asList("IsA", "PartOf"));
    map.put("admittedPos", Arrays.asList("NNS", "NN"));
    map.put("splitTag", true);
    map.put("relDirection", "out");
    ConceptRequest request = ConceptRequest.fromMap(map);
    assertEquals(2, request.getAdmittedRelationships().size());
    assertTrue(request.getAdmittedRelationships().contains("IsA"));
    assertEquals(2, request.getAdmittedPos().size());
    assertEquals("out", request.getRelDirection());
}
Also used : HashMap(java.util.HashMap) ConceptRequest(com.graphaware.nlp.dsl.request.ConceptRequest) NodeProxy(com.graphaware.nlp.util.NodeProxy) Test(org.junit.Test)

Aggregations

ConceptRequest (com.graphaware.nlp.dsl.request.ConceptRequest)3 NodeProxy (com.graphaware.nlp.util.NodeProxy)3 HashMap (java.util.HashMap)3 Test (org.junit.Test)3