congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
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
  • runOnUiThread (Activity)
  • getSharedPreferences (Context)
  • onCreateOptionsMenu (Activity)
  • EOFException (java.io)
    Thrown when a program encounters the end of a file or stream during an input operation.
  • InputStreamReader (java.io)
    A class for turning a byte stream into a character stream. Data read from the source input stream is
  • Proxy (java.net)
    This class represents proxy server settings. A created instance of Proxy stores a type and an addres
  • Properties (java.util)
    A Properties object is a Hashtable where the keys and values must be Strings. Each property can have
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement. A servlet is a small Java program that runs within
  • DateTimeFormat (org.joda.time.format)
    Factory that creates instances of DateTimeFormatter from patterns and styles. Datetime formatting i
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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