當前位置: 首頁>>代碼示例>>Java>>正文


Java DataFactory類代碼示例

本文整理匯總了Java中org.lappsgrid.core.DataFactory的典型用法代碼示例。如果您正苦於以下問題:Java DataFactory類的具體用法?Java DataFactory怎麽用?Java DataFactory使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


DataFactory類屬於org.lappsgrid.core包,在下文中一共展示了DataFactory類的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getMetadata

import org.lappsgrid.core.DataFactory; //導入依賴的package包/類
public String getMetadata()
{
	try
	{
		return service.getMetadata();
	}
	catch(Exception e)
	{
		//e.printStackTrace();
		return DataFactory.error(e.getMessage());
	}
}
 
開發者ID:lapps,項目名稱:org.lappsgrid.client,代碼行數:13,代碼來源:AbstractClient.java

示例2: execute

import org.lappsgrid.core.DataFactory; //導入依賴的package包/類
public String execute(String input)
{
   Document document = null;
   try
   {
      document = doExecute(input);
   }
   catch (Exception e)
   {
      return DataFactory.error("Unable to execute the Tagger.", e);
   }
   if (document == null)
   {
      return DataFactory.error("This was unexpected...");
   }
   String producer = this.getClass().getName() + "_" + Version.getVersion();
   FeatureMap features = document.getFeatures();
   Integer step = (Integer) features.get("lapps:step");
   if (step == null) {
      step = 1;
   }
   features.put("lapps:step", step + 1);
   features.put("lapps:pos", step + " " + producer + " " + Contents.TagSets.GATE);
   String result = DataFactory.gateDocument(document.toXml());
   Factory.deleteResource(document);
   return result;
}
 
開發者ID:oanc,項目名稱:org.anc.lapps.gate,代碼行數:28,代碼來源:Tagger.java

示例3: execute

import org.lappsgrid.core.DataFactory; //導入依賴的package包/類
@Override
   public String execute(String json)
   {
      Document document = null;
      try
      {
         document = doExecute(json);
      }
      catch (Exception e)
      {
         return DataFactory.error("Unable to execute the Coreferencer.", e);
      }
      if (document == null)
      {
         return DataFactory.error(UNEXPECTED);
      }
      String producer = this.getClass().getName() + "_" + Version.getVersion();
      FeatureMap features = document.getFeatures();
      Integer step = (Integer) features.get("lapps:step");
      if (step == null) {
         step = 1;
      }
      features.put("lapps:step", step + 1);
      features.put("lapps:PRONOMINAL_CORREFERNCE", step + " " + producer + " coref:gate");
//      features.put(Metadata.Contains.TYPE, "coref:gate");
//      features.put(Metadata.Contains.PRODUCER, producer);
//      features.put("annotation", Annotations.COREFERENCE);
      String result = DataFactory.gateDocument(document.toXml());
      Factory.deleteResource(document);
      return result;
   }
 
開發者ID:oanc,項目名稱:org.anc.lapps.gate,代碼行數:32,代碼來源:Coreferencer.java

示例4: execute

import org.lappsgrid.core.DataFactory; //導入依賴的package包/類
public String execute(String input)
{
   Document document = null;
   try
   {
      document = doExecute(input);
   }
   catch (Exception e)
   {
      return DataFactory.error("Unable to execute the Tokenizer.", e);
   }
   if (document == null)
   {
      return DataFactory.error(BUSY);
   }
   String producer = this.getClass().getName() + "_" + Version.getVersion();

   FeatureMap features = document.getFeatures();
   Integer step = (Integer) features.get("lapps:step");
   if (step == null) {
      step = 1;
   }
   features.put("lapps:step", step + 1);
   features.put("lapps:" + Annotations.TOKEN, step + " " + producer + " " + Contents.Tokenizations.ANNIE);

   String result = DataFactory.gateDocument(document.toXml());
   Factory.deleteResource(document);
   return result;
}
 
開發者ID:oanc,項目名稱:org.anc.lapps.gate,代碼行數:30,代碼來源:Tokenizer.java

示例5: execute

import org.lappsgrid.core.DataFactory; //導入依賴的package包/類
public String execute(String input)
{
   Document document;
   try
   {
      document = doExecute(input);
   }
   catch (Exception e)
   {
      return DataFactory.error("Unable to execute the Sentence Splitter.", e);
   }
   if (document == null)
   {
      return DataFactory.error("This was unexpected...");
   }
   String producer = this.getClass().getName() + "_" + Version.getVersion();
   FeatureMap features = document.getFeatures();
   Integer step = (Integer) features.get("lapps:step");
   if (step == null) {
      step = 1;
   }
   features.put("lapps:step", step + 1);
   features.put("lapps:" + Annotations.SENTENCE, step + " " + producer + " " + Contents.Chunks.SENTENCES);
   String result = DataFactory.gateDocument(document.toXml());
   Factory.deleteResource(document);
   return result;
}
 
開發者ID:oanc,項目名稱:org.anc.lapps.gate,代碼行數:28,代碼來源:SentenceSplitter.java

示例6: execute

import org.lappsgrid.core.DataFactory; //導入依賴的package包/類
public String execute(String input)
{
   Document document = null;
   try
   {
      document = doExecute(input);
   }
   catch (Exception e)
   {
      return DataFactory.error("Unable to execute the Gazetteer.", e);
   }
   if (document == null)
   {
      return DataFactory.error(BUSY);
   }
   String producer = this.getClass().getName() + "_" + Version.getVersion();
   FeatureMap features = document.getFeatures();
   Integer step = (Integer) features.get("lapps:step");
   if (step == null) {
      step = 1;
   }
   features.put("lapps:step", step + 1);
   features.put("lapps:lookup", step + " " + producer + " lookup:gate");
   String result = DataFactory.gateDocument(document.toXml());
   Factory.deleteResource(document);
   return result;
}
 
開發者ID:oanc,項目名稱:org.anc.lapps.gate,代碼行數:28,代碼來源:Gazetteer.java

示例7: execute

import org.lappsgrid.core.DataFactory; //導入依賴的package包/類
public String execute(String input)
{
   Document document = null;
   try
   {
      document = doExecute(input);
   }
   catch (Exception e)
   {
      return DataFactory.error("Unable to execute the OrthoMatcher.", e);
   }
   if (document == null)
   {
      return DataFactory.error("This was unexpected...");
   }
   String producer = this.getClass().getName() + "_" + Version.getVersion();
   FeatureMap features = document.getFeatures();
   Integer step = (Integer) features.get("lapps:step");
   if (step == null) {
      step = 1;
   }
   features.put("lapps:step", step + 1);
   features.put("lapps:coref", step + " " + producer + " coref:annie");
   String result = DataFactory.gateDocument(document.toXml());
   Factory.deleteResource(document);
   return result;
}
 
開發者ID:oanc,項目名稱:org.anc.lapps.gate,代碼行數:28,代碼來源:OrthoMatcher.java

示例8: execute

import org.lappsgrid.core.DataFactory; //導入依賴的package包/類
public String execute(String input)
{
   Document document = null;
   try
   {
      document = doExecute(input);
   }
   catch (Exception e)
   {
      return DataFactory.error("Unable to execute the NounPhraseChunker.", e);
   }
   if (document == null)
   {
      return DataFactory.error("This was unexpected.");
   }
   String producer = this.getClass().getName() + "_" + Version.getVersion();
   FeatureMap features = document.getFeatures();
   Integer step = (Integer) features.get("lapps:step");
   if (step == null) {
      step = 1;
   }
   features.put("lapps:step", step + 1);
   features.put("lapps:nchunk", step + " " + producer + " chunk:annie");
   String result = DataFactory.gateDocument(document.toXml());
   Factory.deleteResource(document);
   return result;
}
 
開發者ID:oanc,項目名稱:org.anc.lapps.gate,代碼行數:28,代碼來源:NounPhraseChunker.java

示例9: execute

import org.lappsgrid.core.DataFactory; //導入依賴的package包/類
public String execute(String input)
{
   Document document = null;
   try
   {
      document = doExecute(input);
   }
   catch (Exception e)
   {
      return DataFactory.error("Unable to execute the Verb Phrase Chunker.", e);
   }
   if (document == null)
   {
      return DataFactory.error(BUSY);
   }
   String producer = this.getClass().getName() + "_" + Version.getVersion();
   FeatureMap features = document.getFeatures();
   Integer step = (Integer) features.get("lapps:step");
   if (step == null) {
      step = 1;
   }
   features.put("lapps:step", step + 1);
   features.put("lapps:vchunk", step + producer + " " + Contents.Chunks.VERBS);
   String result = DataFactory.gateDocument(document.toXml());
   Factory.deleteResource(document);
   return result;
}
 
開發者ID:oanc,項目名稱:org.anc.lapps.gate,代碼行數:28,代碼來源:VerbPhraseChunker.java

示例10: execute

import org.lappsgrid.core.DataFactory; //導入依賴的package包/類
@Override
   public String execute(String input)
   {
		String result;
      Data<String> data = Serializer.parse(input, Data.class);
      if (!Uri.GATE.equals(data.getDiscriminator()))
      {
         return DataFactory.error("Invalid discriminator type: " + data.getDiscriminator());
      }
      String payload = data.getPayload();
      if (payload == null)
      {
         return DataFactory.error("Payload is empty");
      }
      Document document = null;
      try
      {
         logger.info("Converting document to JSON");
         document = Factory.newDocument(payload);
         logger.debug("Gate document created.");
         result = GateSerializer.toJson(document);
         logger.debug("Document serialized to JSON.");
//         result = new Data(Uri.JSON, json);
      }
//		catch (NullPointerException e)
      catch (NullPointerException | ResourceInstantiationException e)
      {
         logger.error("Unable to convert document.", e);
         result = DataFactory.error(e.getMessage());
      }
      finally
      {
         Factory.deleteResource(document);
      }
      return result;
   }
 
開發者ID:oanc,項目名稱:org.anc.lapps.gate.converter-service,代碼行數:37,代碼來源:GateToJsonConverter.java

示例11: execute

import org.lappsgrid.core.DataFactory; //導入依賴的package包/類
public String execute(String input)
{
	Document document = null;
	try
	{
		document = super.doExecute(input);
	}
	catch (Exception e)
	{
		return DataFactory.error("Unable to execute the Named Entity Recognizer.", e);
	}

	if (document == null)
	{
		return DataFactory.error("This was unexpected... the GATE NER component returned a NULL document.");
	}

	String producer = this.getClass().getName() + "_" + Version.getVersion();
	FeatureMap features = document.getFeatures();
	Integer step = (Integer) features.get("lapps:step");
	if (step == null)
	{
		step = 1;
	}
	AnnotationSet set = document.getAnnotations();
	Iterator<Annotation> iterator = set.iterator();
	boolean hasLocation = false;
	boolean hasPerson = false;
	boolean hasOrganization = false;
	// Counter so we know to stop searching once we've found all three
	// annotation types
	int found = 0;
	while (iterator.hasNext() && found < 3)
	{
		Annotation annotation = iterator.next();
		String type = annotation.getType();
		if ("Location".equals(type) && !hasLocation)
		{
			++found;
			hasLocation = true;
		} else if ("Organization".equals(type) && !hasOrganization)
		{
			++found;
			hasOrganization = true;
		} else if ("Person".equals(type) && !hasPerson)
		{
			++found;
			hasPerson = true;
		}
	}
	features.put("lapps:step", step + 1);

	// TODO The Annotations class has changed and the feature values added should be rolled
	// back to what they were originally.
	if (hasLocation)
	{
		features.put("lapps:" + Annotations.LOCATION, step + " " + producer + " ner:annie");
	}
	if (hasPerson)
	{
		features.put("lapps:" + Annotations.PERSON, step + " " + producer + " ner:annie");
	}
	if (hasOrganization)
	{
		features.put("lapps:" + Annotations.ORGANIZATION, step + " " + producer + " ner:annie");
	}
	String result = DataFactory.gateDocument(document.toXml());
	Factory.deleteResource(document);
	return result;
}
 
開發者ID:oanc,項目名稱:org.anc.lapps.gate,代碼行數:71,代碼來源:NamedEntityRecognizer.java

示例12: setup

import org.lappsgrid.core.DataFactory; //導入依賴的package包/類
@Before
public void setup() throws IOException
{
	xml = ResourceLoader.loadString("GateTokens.xml");
	json = DataFactory.gateDocument(xml);
}
 
開發者ID:oanc,項目名稱:org.anc.lapps.gate.converter-service,代碼行數:7,代碼來源:SerializerTests.java

示例13: list

import org.lappsgrid.core.DataFactory; //導入依賴的package包/類
/**
* Sends LIST request (<a href="http://vocab.lappsgrid.org/ns/action/list">http://vocab.lappsgrid.org/ns/action/list</a>)
* with {@code start} and {@code end} offsets to the data source and parse the result into a {@link java.util.List}
* of strings.
*
* @return A list of document ID values.
*/
 public List<String> list(int start, int end)
 {
String json = service.execute(DataFactory.list(start, end));
Data<List<String>> data = Serializer.parse(json, Data.class);
return data.getPayload();
 }
 
開發者ID:lapps,項目名稱:org.lappsgrid.client,代碼行數:14,代碼來源:DataSourceClient.java

示例14: get

import org.lappsgrid.core.DataFactory; //導入依賴的package包/類
/**
* Retrieves a single document from the datasource.
*
* @param key a document ID.
* @return the document from the data source.  Typically this will be a LIF container
* inside a Data object.
*/
 public String get(String key)
 {
    return service.execute(DataFactory.get(key));
 }
 
開發者ID:lapps,項目名稱:org.lappsgrid.client,代碼行數:12,代碼來源:DataSourceClient.java


注:本文中的org.lappsgrid.core.DataFactory類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。