congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
SharedFongoResource.getDB
Code IndexAdd Tabnine to your IDE (free)

How to use
getDB
method
in
uk.gov.dstl.baleen.resources.SharedFongoResource

Best Java code snippets using uk.gov.dstl.baleen.resources.SharedFongoResource.getDB (Showing top 14 results out of 315)

origin: dstl/baleen

 private void createContent(SharedFongoResource sfr) {
  MongoDatabase db = sfr.getDB();

  MongoCollection<Document> coll = db.getCollection(COLLECTION);
  coll.insertMany(
    Arrays.asList(
      new Document(CONTENT, "Hello World"),
      new Document(CONTENT, "Hello Test"),
      new Document(CONTENT, TEXT)
        .append("key1", "foo")
        .append("key2", "bar")
        .append("key3", Arrays.asList("howdy", "hey"))));
 }
}
origin: dstl/baleen

@BeforeClass
public static void beforeClass() throws ResourceInitializationException {
 sfr = new SharedFongoResource();
 MongoDatabase db = sfr.getDB();
 MongoCollection<Document> coll = db.getCollection("gazetteer");
 coll.insertMany(
   Arrays.asList(
     new Document(VALUE, EN_HELLO2),
     new Document(VALUE, Arrays.asList("hi", EN_HELLO, "heya")),
     new Document(VALUE, Arrays.asList("konnichiwa", JP_HELLO)).append(LANGUAGE, "jp"),
     new Document(VALUE, Arrays.asList(DE_HELLO))
       .append(LANGUAGE, "de")
       .append(TRANSLATION, "good day"),
     new Document(VALUE, Arrays.asList("hej")).append(LANGUAGE, "se")));
}
origin: dstl/baleen

@Before
public void beforeMongoRecordConsumerTest()
  throws ResourceInitializationException, ResourceAccessException {
 mongoExternalResourceDescription =
   ExternalResourceFactory.createExternalResourceDescription(
     MONGO, SharedFongoResource.class, "fongo.collection", "test", "fongo.data", "[]");
 analysisEngine =
   getAnalysisEngine("mongo", mongoExternalResourceDescription, "collection", "test");
 SharedFongoResource sfr =
   (SharedFongoResource) analysisEngine.getUimaContext().getResourceObject(MONGO);
 recordsCollection = sfr.getDB().getCollection("records");
}
origin: dstl/baleen

 @Test
 public void test()
   throws ResourceInitializationException, AnalysisEngineProcessException, IOException,
     ResourceAccessException {
  final File file = File.createTempFile("test", "uimt");
  Files.asCharSink(file, StandardCharsets.UTF_8)
    .write("Type,SubType\nMOVEMENT,went,source,target,went,VERB,gone");

  final AnalysisEngine ae =
    create(UploadInteractionsToMongo.class, "mongo", fongoErd, "input", file);
  execute(ae);

  final SharedFongoResource sfr =
    (SharedFongoResource) ae.getUimaContext().getResourceObject("mongo");
  final MongoCollection<Document> relationTypes = sfr.getDB().getCollection("relationTypes");
  assertTrue(relationTypes.count() > 0);
  final MongoCollection<Document> interactions = sfr.getDB().getCollection("interactions");
  assertTrue(interactions.count() > 0);
 }
}
origin: dstl/baleen

 private void createAnalysisEngine(String textBlockType)
   throws ResourceInitializationException, ResourceAccessException {

  AnalysisEngineDescription aed =
    AnalysisEngineFactory.createEngineDescription(
      MongoEvents.class,
      MONGO,
      erd,
      "collection",
      "test",
      MongoEvents.PARAM_TEXT_BLOCK_EXTRACTED_FROM,
      textBlockType,
      MongoEvents.PARAM_OUTPUT_HISTORY,
      true);

  ae = AnalysisEngineFactory.createEngine(aed);
  ae.initialize(new CustomResourceSpecifier_impl(), Collections.emptyMap());
  SharedFongoResource sfr = (SharedFongoResource) ae.getUimaContext().getResourceObject(MONGO);

  events = sfr.getDB().getCollection("test");

  assertEquals(0L, events.count());
 }
}
origin: dstl/baleen

history = (BaleenHistory) ae.getUimaContext().getResourceObject(PipelineBuilder.BALEEN_HISTORY);
entities = sfr.getDB().getCollection("entities");
documents = sfr.getDB().getCollection("documents");
relations = sfr.getDB().getCollection("relations");
origin: dstl/baleen

@Before
public void setUp() throws ResourceInitializationException, ResourceAccessException {
 // Create a description of an external resource - a fongo instance, in the same way we would
 // have created a shared mongo resource
 ExternalResourceDescription erd =
   ExternalResourceFactory.createExternalResourceDescription(
     MONGO, SharedFongoResource.class, "fongo.collection", "test", "fongo.data", "[]");
 // Create the analysis engine
 AnalysisEngineDescription aed =
   AnalysisEngineFactory.createEngineDescription(
     MongoRelations.class, MONGO, erd, "collection", "test");
 ae = AnalysisEngineFactory.createEngine(aed);
 ae.initialize(new CustomResourceSpecifier_impl(), Collections.emptyMap());
 SharedFongoResource sfr = (SharedFongoResource) ae.getUimaContext().getResourceObject(MONGO);
 relations = sfr.getDB().getCollection("test");
 // Ensure we start with no data!
 assertEquals(0L, relations.count());
}
origin: dstl/baleen

  (SharedFongoResource) ae.getUimaContext().getResourceObject(MONGO);
final MongoDatabase db = sfr.getDB();
documentCollection = db.getCollection(Mongo.DEFAULT_DOCUMENTS_COLLECTION);
entityCollection = db.getCollection(Mongo.DEFAULT_ENTITY_COLLECTION);
origin: dstl/baleen

@Test
public void testMalformedDocuments() {
 MongoCollection<Document> collection = fongo.getDB().getCollection(HISTORY2);
origin: dstl/baleen

  (SharedFongoResource)
    ae.getUimaContext().getResourceObject(SharedMongoResource.RESOURCE_KEY);
patternsCollection = sfr.getDB().getCollection(RENOUN_PATTERNS);
scoredFactsCollection = sfr.getDB().getCollection(RENOUN_SCORED_FACTS);
origin: dstl/baleen

facts = sfr.getDB().getCollection(RENOUN_FACTS);
origin: dstl/baleen

try {
 sfr = (SharedFongoResource) ae.getUimaContext().getResourceObject(MONGO);
 output = sfr.getDB().getCollection("renoun_patterns");
} catch (ResourceAccessException e) {
 throw new ResourceInitializationException(e);
origin: dstl/baleen

final MongoCollection<Document> collection = sfr.getDB().getCollection("test");
Assert.assertEquals(1, collection.count());
origin: dstl/baleen

final MongoCollection<Document> collection = sfr.getDB().getCollection("test");
Assert.assertEquals(1, collection.count());
uk.gov.dstl.baleen.resourcesSharedFongoResourcegetDB

Popular methods of SharedFongoResource

  • <init>
  • getMonitor

Popular in Java

  • Reactive rest calls using spring rest template
  • getResourceAsStream (ClassLoader)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • runOnUiThread (Activity)
  • String (java.lang)
  • URL (java.net)
    A Uniform Resource Locator that identifies the location of an Internet resource as specified by RFC
  • Date (java.util)
    A specific moment in time, with millisecond precision. Values typically come from System#currentTime
  • Map (java.util)
    A Map is a data structure consisting of a set of keys and values in which each key is mapped to a si
  • AtomicInteger (java.util.concurrent.atomic)
    An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
  • Reference (javax.naming)
  • Top 15 Vim Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now