You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by to...@apache.org on 2010/02/17 13:06:20 UTC
svn commit: r910938 [2/18] - in
/incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src: main/java/org/
main/java/org/apache/ main/java/org/apache/uima/
main/java/org/apache/uima/alchemy/
main/java/org/apache/uima/alchemy/annotator/ main/java/org/apache/...
Added: incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/domain/LanguageDetectionResults.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/domain/LanguageDetectionResults.java?rev=910938&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/domain/LanguageDetectionResults.java (added)
+++ incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/domain/LanguageDetectionResults.java Wed Feb 17 12:06:17 2010
@@ -0,0 +1,83 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.uima.alchemy.digester.domain;
+
+public class LanguageDetectionResults extends Results {
+
+ private String iso6391;
+
+ private String iso6392;
+
+ private String iso6393;
+
+ private String ethnologue;
+
+ private String nativeSpeakers;
+
+ private String wikipedia;
+
+ public String getIso6391() {
+ return iso6391;
+ }
+
+ public void setIso6391(String iso6391) {
+ this.iso6391 = iso6391;
+ }
+
+ public String getIso6392() {
+ return iso6392;
+ }
+
+ public void setIso6392(String iso6392) {
+ this.iso6392 = iso6392;
+ }
+
+ public String getIso6393() {
+ return iso6393;
+ }
+
+ public void setIso6393(String iso6393) {
+ this.iso6393 = iso6393;
+ }
+
+ public String getEthnologue() {
+ return ethnologue;
+ }
+
+ public void setEthnologue(String ethnologue) {
+ this.ethnologue = ethnologue;
+ }
+
+ public String getNativeSpeakers() {
+ return nativeSpeakers;
+ }
+
+ public void setNativeSpeakers(String nativeSpeakers) {
+ this.nativeSpeakers = nativeSpeakers;
+ }
+
+ public String getWikipedia() {
+ return wikipedia;
+ }
+
+ public void setWikipedia(String wikipedia) {
+ this.wikipedia = wikipedia;
+ }
+
+}
Propchange: incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/domain/LanguageDetectionResults.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/domain/Microformat.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/domain/Microformat.java?rev=910938&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/domain/Microformat.java (added)
+++ incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/domain/Microformat.java Wed Feb 17 12:06:17 2010
@@ -0,0 +1,43 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.uima.alchemy.digester.domain;
+
+public class Microformat {
+
+ private String fieldName;
+
+ private String fieldData;
+
+ public void setFieldName(String fieldName) {
+ this.fieldName = fieldName;
+ }
+
+ public String getFieldName() {
+ return fieldName;
+ }
+
+ public void setFieldData(String fieldData) {
+ this.fieldData = fieldData;
+ }
+
+ public String getFieldData() {
+ return fieldData;
+ }
+
+}
Propchange: incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/domain/Microformat.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/domain/MicroformatsResults.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/domain/MicroformatsResults.java?rev=910938&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/domain/MicroformatsResults.java (added)
+++ incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/domain/MicroformatsResults.java Wed Feb 17 12:06:17 2010
@@ -0,0 +1,40 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.uima.alchemy.digester.domain;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class MicroformatsResults extends Results {
+
+ private List<Microformat> microformats = new ArrayList<Microformat>();
+
+ public void setMicroformats(List<Microformat> microformats) {
+ this.microformats = microformats;
+ }
+
+ public List<Microformat> getMicroformats() {
+ return microformats;
+ }
+
+ public void addMicroformat(Microformat microformat) {
+ this.microformats.add(microformat);
+ }
+
+}
Propchange: incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/domain/MicroformatsResults.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/domain/Quotations.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/domain/Quotations.java?rev=910938&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/domain/Quotations.java (added)
+++ incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/domain/Quotations.java Wed Feb 17 12:06:17 2010
@@ -0,0 +1,40 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.uima.alchemy.digester.domain;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class Quotations {
+
+ private List<String> quotations = new ArrayList<String>();
+
+ public void setQuotations(List<String> quotations) {
+ this.quotations = quotations;
+ }
+
+ public List<String> getQuotations() {
+ return quotations;
+ }
+
+ public void setQuotation(String quotation) {
+ this.quotations.add(quotation);
+ }
+
+}
Propchange: incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/domain/Quotations.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/domain/Results.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/domain/Results.java?rev=910938&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/domain/Results.java (added)
+++ incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/domain/Results.java Wed Feb 17 12:06:17 2010
@@ -0,0 +1,53 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.uima.alchemy.digester.domain;
+
+public class Results {
+
+ private String status;
+
+ private String language;
+
+ private String url;
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+
+ public String getLanguage() {
+ return language;
+ }
+
+ public void setLanguage(String language) {
+ this.language = language;
+ }
+
+ public String getUrl() {
+ return url;
+ }
+
+ public void setUrl(String url) {
+ this.url = url;
+ }
+
+}
Propchange: incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/domain/Results.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/entity/annotated/AnnotatedEntityDigesterProvider.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/entity/annotated/AnnotatedEntityDigesterProvider.java?rev=910938&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/entity/annotated/AnnotatedEntityDigesterProvider.java (added)
+++ incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/entity/annotated/AnnotatedEntityDigesterProvider.java Wed Feb 17 12:06:17 2010
@@ -0,0 +1,38 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.uima.alchemy.digester.entity.annotated;
+
+import org.apache.commons.lang.Validate;
+import org.apache.uima.alchemy.digester.DigesterProvider;
+import org.apache.uima.alchemy.digester.OutputDigester;
+import org.apache.uima.alchemy.digester.exception.UnsupportedResultFormatException;
+
+public class AnnotatedEntityDigesterProvider implements DigesterProvider {
+
+ public OutputDigester getDigester(String type) throws UnsupportedResultFormatException {
+ Validate.notEmpty(type);
+ OutputDigester digester = null;
+ if (type.equals("xml")) {
+ digester = new XMLAnnotatedEntityExtractionDigester();
+ } else
+ throw new UnsupportedResultFormatException(type);
+ return digester;
+ }
+
+}
Propchange: incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/entity/annotated/AnnotatedEntityDigesterProvider.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/entity/annotated/XMLAnnotatedEntityExtractionDigester.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/entity/annotated/XMLAnnotatedEntityExtractionDigester.java?rev=910938&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/entity/annotated/XMLAnnotatedEntityExtractionDigester.java (added)
+++ incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/entity/annotated/XMLAnnotatedEntityExtractionDigester.java Wed Feb 17 12:06:17 2010
@@ -0,0 +1,47 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.uima.alchemy.digester.entity.annotated;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URISyntaxException;
+
+import org.apache.commons.digester.Digester;
+import org.apache.uima.alchemy.digester.OutputDigester;
+import org.apache.uima.alchemy.digester.domain.AnnotatedResults;
+import org.apache.uima.alchemy.digester.domain.Results;
+import org.xml.sax.SAXException;
+
+public class XMLAnnotatedEntityExtractionDigester implements OutputDigester {
+
+ public Results parseAlchemyXML(InputStream stream) throws IOException, SAXException,
+ URISyntaxException {
+ Digester digester = new Digester();
+ digester.setValidating(false);
+
+ digester.addObjectCreate("results", AnnotatedResults.class);
+ digester.addBeanPropertySetter("results/status", "status");
+ digester.addBeanPropertySetter("results/language", "language");
+ digester.addBeanPropertySetter("results/text", "text");
+ digester.addBeanPropertySetter("results/url", "url");
+ digester.addBeanPropertySetter("results/annotatedText", "annotatedText");
+ return (Results) digester.parse(stream);
+ }
+
+}
Propchange: incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/entity/annotated/XMLAnnotatedEntityExtractionDigester.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/entity/ranked/JsonTextRankedEntityExtractionDigester.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/entity/ranked/JsonTextRankedEntityExtractionDigester.java?rev=910938&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/entity/ranked/JsonTextRankedEntityExtractionDigester.java (added)
+++ incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/entity/ranked/JsonTextRankedEntityExtractionDigester.java Wed Feb 17 12:06:17 2010
@@ -0,0 +1,74 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.uima.alchemy.digester.entity.ranked;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URISyntaxException;
+
+import org.apache.commons.digester.Digester;
+import org.apache.uima.alchemy.digester.OutputDigester;
+import org.apache.uima.alchemy.digester.domain.Disambiguated;
+import org.apache.uima.alchemy.digester.domain.EntitiesResults;
+import org.apache.uima.alchemy.digester.domain.Entity;
+import org.apache.uima.alchemy.digester.domain.Quotations;
+import org.apache.uima.alchemy.digester.domain.Results;
+import org.xml.sax.SAXException;
+
+import org.apache.uima.alchemy.digester.json.JsonDigester;
+
+public class JsonTextRankedEntityExtractionDigester implements OutputDigester {
+
+ public Results parseAlchemyXML(InputStream stream) throws IOException, SAXException,
+ URISyntaxException {
+
+ Digester digester = new JsonDigester();
+ digester.setValidating(false);
+ digester.addObjectCreate("$", EntitiesResults.class);
+ digester.addBeanPropertySetter("$/status");
+ digester.addBeanPropertySetter("$/url");
+ digester.addBeanPropertySetter("$/language");
+ digester.addObjectCreate("$/entities", Entity.class);
+ digester.addBeanPropertySetter("$/entities/type");
+ digester.addBeanPropertySetter("$/entities/relevance");
+ digester.addBeanPropertySetter("$/entities/count");
+ digester.addBeanPropertySetter("$/entities/text");
+ digester.addObjectCreate("$/entities/disambiguated", Disambiguated.class);
+ digester.addBeanPropertySetter("$/entities/disambiguated/name", "name");
+ digester.addBeanPropertySetter("$/entities/disambiguated/subType", "subType");
+ digester.addBeanPropertySetter("$/entities/disambiguated/website", "website");
+ digester.addBeanPropertySetter("$/entities/disambiguated/geo", "geo");
+ digester.addBeanPropertySetter("$/entities/disambiguated/dbpedia", "dbpedia");
+ digester.addBeanPropertySetter("$/entities/disambiguated/yago", "yago");
+ digester.addBeanPropertySetter("$/entities/disambiguated/opencyc", "opencyc");
+ digester.addBeanPropertySetter("$/entities/disambiguated/umbel", "umbel");
+ digester.addBeanPropertySetter("$/entities/disambiguated/freebase", "freebase");
+ digester.addBeanPropertySetter("$/entities/disambiguated/ciaFactbook", "ciaFactbook");
+ digester.addBeanPropertySetter("$/entities/disambiguated/census", "census");
+ digester.addBeanPropertySetter("$/entities/disambiguated/geonames", "geonames");
+ digester.addBeanPropertySetter("$/entities/disambiguated/musicBrainz", "musicBrainz");
+ digester.addSetNext("$/entities/disambiguated", "setDisambiguated");
+ digester.addObjectCreate("$/entities/quotations", Quotations.class);
+ digester.addBeanPropertySetter("$/entities/quotations/quotation", "quotation");
+ digester.addSetNext("$/entities/quotations", "setQuotations");
+ digester.addSetNext("$/entities", "addEntity");
+ return (Results) digester.parse(stream);
+ }
+
+}
Propchange: incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/entity/ranked/JsonTextRankedEntityExtractionDigester.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/entity/ranked/RankedEntityDigesterProvider.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/entity/ranked/RankedEntityDigesterProvider.java?rev=910938&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/entity/ranked/RankedEntityDigesterProvider.java (added)
+++ incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/entity/ranked/RankedEntityDigesterProvider.java Wed Feb 17 12:06:17 2010
@@ -0,0 +1,38 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.uima.alchemy.digester.entity.ranked;
+
+import org.apache.commons.lang.Validate;
+import org.apache.uima.alchemy.digester.DigesterProvider;
+import org.apache.uima.alchemy.digester.OutputDigester;
+import org.apache.uima.alchemy.digester.exception.UnsupportedResultFormatException;
+
+public class RankedEntityDigesterProvider implements DigesterProvider {
+
+ public OutputDigester getDigester(String type) throws UnsupportedResultFormatException {
+ Validate.notEmpty(type);
+ OutputDigester digester = null;
+ if (type.equals("xml")) {
+ digester = new XMLRankedEntityExtractionDigester();
+ } else
+ throw new UnsupportedResultFormatException(type);
+ return digester;
+ }
+
+}
Propchange: incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/entity/ranked/RankedEntityDigesterProvider.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/entity/ranked/XMLRankedEntityExtractionDigester.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/entity/ranked/XMLRankedEntityExtractionDigester.java?rev=910938&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/entity/ranked/XMLRankedEntityExtractionDigester.java (added)
+++ incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/entity/ranked/XMLRankedEntityExtractionDigester.java Wed Feb 17 12:06:17 2010
@@ -0,0 +1,78 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.uima.alchemy.digester.entity.ranked;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URISyntaxException;
+
+import org.apache.commons.digester.Digester;
+import org.apache.uima.alchemy.digester.OutputDigester;
+import org.apache.uima.alchemy.digester.domain.Disambiguated;
+import org.apache.uima.alchemy.digester.domain.Entities;
+import org.apache.uima.alchemy.digester.domain.EntitiesResults;
+import org.apache.uima.alchemy.digester.domain.Entity;
+import org.apache.uima.alchemy.digester.domain.Quotations;
+import org.apache.uima.alchemy.digester.domain.Results;
+import org.xml.sax.SAXException;
+
+public class XMLRankedEntityExtractionDigester implements OutputDigester {
+
+ public Results parseAlchemyXML(InputStream stream) throws IOException, SAXException,
+ URISyntaxException {
+ Digester digester = new Digester();
+ digester.setValidating(false);
+
+ digester.addObjectCreate("results", EntitiesResults.class);
+ digester.addBeanPropertySetter("results/status", "status");
+ digester.addBeanPropertySetter("results/language", "language");
+ digester.addBeanPropertySetter("results/url", "url");
+ digester.addObjectCreate("results/entities", Entities.class);
+ digester.addObjectCreate("results/entities/entity", Entity.class);
+ digester.addBeanPropertySetter("results/entities/entity/type", "type");
+ digester.addBeanPropertySetter("results/entities/entity/relevance", "relevance");
+ digester.addBeanPropertySetter("results/entities/entity/count", "count");
+ digester.addBeanPropertySetter("results/entities/entity/text", "text");
+ digester.addObjectCreate("results/entities/entity/disambiguated", Disambiguated.class);
+ digester.addBeanPropertySetter("results/entities/entity/disambiguated/name", "name");
+ digester.addBeanPropertySetter("results/entities/entity/disambiguated/subType", "subType");
+ digester.addBeanPropertySetter("results/entities/entity/disambiguated/website", "website");
+ digester.addBeanPropertySetter("results/entities/entity/disambiguated/geo", "geo");
+ digester.addBeanPropertySetter("results/entities/entity/disambiguated/dbpedia", "dbpedia");
+ digester.addBeanPropertySetter("results/entities/entity/disambiguated/yago", "yago");
+ digester.addBeanPropertySetter("results/entities/entity/disambiguated/opencyc", "opencyc");
+ digester.addBeanPropertySetter("results/entities/entity/disambiguated/umbel", "umbel");
+ digester.addBeanPropertySetter("results/entities/entity/disambiguated/freebase", "freebase");
+ digester.addBeanPropertySetter("results/entities/entity/disambiguated/ciaFactbook",
+ "ciaFactbook");
+ digester.addBeanPropertySetter("results/entities/entity/disambiguated/census", "census");
+ digester.addBeanPropertySetter("results/entities/entity/disambiguated/geonames", "geonames");
+ digester.addBeanPropertySetter("results/entities/entity/disambiguated/musicBrainz",
+ "musicBrainz");
+ digester.addSetNext("results/entities/entity/disambiguated", "setDisambiguated");
+ digester.addObjectCreate("results/entities/entity/quotations", Quotations.class);
+ digester.addBeanPropertySetter("results/entities/entity/quotations/quotation", "quotation");
+ digester.addSetNext("results/entities/entity/quotations", "setQuotations");
+ digester.addSetNext("results/entities/entity", "addEntity");
+ digester.addSetNext("results/entities", "setEntities");
+
+ return (Results) digester.parse(stream);
+ }
+
+}
Propchange: incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/entity/ranked/XMLRankedEntityExtractionDigester.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/exception/ResultDigestingException.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/exception/ResultDigestingException.java?rev=910938&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/exception/ResultDigestingException.java (added)
+++ incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/exception/ResultDigestingException.java Wed Feb 17 12:06:17 2010
@@ -0,0 +1,32 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.uima.alchemy.digester.exception;
+
+public class ResultDigestingException extends Exception {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ public ResultDigestingException(Exception e) {
+ super(e);
+ }
+
+}
Propchange: incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/exception/ResultDigestingException.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/exception/UnsupportedResultFormatException.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/exception/UnsupportedResultFormatException.java?rev=910938&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/exception/UnsupportedResultFormatException.java (added)
+++ incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/exception/UnsupportedResultFormatException.java Wed Feb 17 12:06:17 2010
@@ -0,0 +1,36 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.uima.alchemy.digester.exception;
+
+public class UnsupportedResultFormatException extends Exception {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ public UnsupportedResultFormatException(Throwable e) {
+ super(e);
+ }
+
+ public UnsupportedResultFormatException(String type) {
+ super(type + " outputs not suppoted");
+ }
+
+}
Propchange: incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/exception/UnsupportedResultFormatException.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/json/JsonDigester.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/json/JsonDigester.java?rev=910938&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/json/JsonDigester.java (added)
+++ incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/json/JsonDigester.java Wed Feb 17 12:06:17 2010
@@ -0,0 +1,37 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.uima.alchemy.digester.json;
+
+import org.apache.commons.digester.Digester;
+
+/**
+ * A proper Digester to parse JSON documents.
+ *
+ */
+public final class JsonDigester extends Digester {
+
+ public JsonDigester() {
+ this(null);
+ }
+
+ public JsonDigester(final String customRootElementName) {
+ super(new JsonXMLReader(customRootElementName));
+ }
+
+}
Propchange: incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/json/JsonDigester.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/json/JsonXMLReader.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/json/JsonXMLReader.java?rev=910938&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/json/JsonXMLReader.java (added)
+++ incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/json/JsonXMLReader.java Wed Feb 17 12:06:17 2010
@@ -0,0 +1,146 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.uima.alchemy.digester.json;
+
+import java.io.IOException;
+
+import org.xml.sax.ContentHandler;
+import org.xml.sax.DTDHandler;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXNotRecognizedException;
+import org.xml.sax.SAXNotSupportedException;
+import org.xml.sax.XMLReader;
+
+/**
+ * JSON parser that throws XML events.
+ *
+ */
+final class JsonXMLReader implements XMLReader {
+
+ private final String customRootElementName;
+
+ private ContentHandler contentHandler;
+
+ public ContentHandler getContentHandler() {
+ return contentHandler;
+ }
+
+ public void setContentHandler(ContentHandler contentHandler) {
+ this.contentHandler = contentHandler;
+ }
+
+ public EntityResolver getEntityResolver() {
+ return entityResolver;
+ }
+
+ public void setEntityResolver(EntityResolver entityResolver) {
+ this.entityResolver = entityResolver;
+ }
+
+ public ErrorHandler getErrorHandler() {
+ return errorHandler;
+ }
+
+ public void setErrorHandler(ErrorHandler errorHandler) {
+ this.errorHandler = errorHandler;
+ }
+
+ private EntityResolver entityResolver;
+
+ private ErrorHandler errorHandler;
+
+ private DTDHandler dtdHandler;
+
+ public JsonXMLReader(final String customRootElementName) {
+ this.customRootElementName = customRootElementName;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean getFeature(final String name) throws SAXNotRecognizedException,
+ SAXNotSupportedException {
+ throw new SAXNotSupportedException();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Object getProperty(final String name) throws SAXNotRecognizedException,
+ SAXNotSupportedException {
+ throw new SAXNotSupportedException();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public DTDHandler getDTDHandler() {
+ return this.dtdHandler;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void setDTDHandler(DTDHandler handler) {
+ this.dtdHandler = handler;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void parse(final InputSource input) throws IOException, SAXException {
+ JsonParser jsonParser = new JsonParser(input.getByteStream());
+ if (this.customRootElementName != null && this.customRootElementName.length() > 0) {
+ jsonParser.setRootElementName(this.customRootElementName);
+ }
+ jsonParser.setContentHandler(this.contentHandler);
+ try {
+ jsonParser.json();
+ } catch (ParseException e) {
+ throw new SAXException("An error occurred while parsing JSON", e);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void parse(final String systemId) throws IOException, SAXException {
+ // not used
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void setFeature(final String name, final boolean value) throws SAXNotRecognizedException,
+ SAXNotSupportedException {
+ throw new SAXNotSupportedException();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void setProperty(final String name, final Object value) throws SAXNotRecognizedException,
+ SAXNotSupportedException {
+ throw new SAXNotSupportedException();
+ }
+
+}
Propchange: incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/json/JsonXMLReader.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/json/package-info.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/json/package-info.java?rev=910938&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/json/package-info.java (added)
+++ incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/json/package-info.java Wed Feb 17 12:06:17 2010
@@ -0,0 +1,24 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/**
+ * This package contains the JSON support for digester.
+ *
+ */
+package org.apache.uima.alchemy.digester.json;
+
Propchange: incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/json/package-info.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/keyword/KeywordDigesterProvider.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/keyword/KeywordDigesterProvider.java?rev=910938&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/keyword/KeywordDigesterProvider.java (added)
+++ incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/keyword/KeywordDigesterProvider.java Wed Feb 17 12:06:17 2010
@@ -0,0 +1,38 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.uima.alchemy.digester.keyword;
+
+import org.apache.commons.lang.Validate;
+import org.apache.uima.alchemy.digester.DigesterProvider;
+import org.apache.uima.alchemy.digester.OutputDigester;
+import org.apache.uima.alchemy.digester.exception.UnsupportedResultFormatException;
+
+public class KeywordDigesterProvider implements DigesterProvider {
+
+ public OutputDigester getDigester(String type) throws UnsupportedResultFormatException {
+ Validate.notEmpty(type);
+ OutputDigester digester = null;
+ if (type.equals("xml")) {
+ digester = new XMLTextKeywordExctractionDigester();
+ } else
+ throw new UnsupportedResultFormatException(type);
+ return digester;
+ }
+
+}
Propchange: incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/keyword/KeywordDigesterProvider.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/keyword/XMLTextKeywordExctractionDigester.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/keyword/XMLTextKeywordExctractionDigester.java?rev=910938&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/keyword/XMLTextKeywordExctractionDigester.java (added)
+++ incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/keyword/XMLTextKeywordExctractionDigester.java Wed Feb 17 12:06:17 2010
@@ -0,0 +1,49 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.uima.alchemy.digester.keyword;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URISyntaxException;
+
+import org.apache.commons.digester.Digester;
+import org.apache.uima.alchemy.digester.OutputDigester;
+import org.apache.uima.alchemy.digester.domain.Keyword;
+import org.apache.uima.alchemy.digester.domain.KeywordResults;
+import org.apache.uima.alchemy.digester.domain.Results;
+import org.xml.sax.SAXException;
+
+public class XMLTextKeywordExctractionDigester implements OutputDigester {
+
+ public Results parseAlchemyXML(InputStream xmlReader) throws IOException, SAXException,
+ URISyntaxException {
+ Digester digester = new Digester();
+ digester.setValidating(false);
+
+ digester.addObjectCreate("results", KeywordResults.class);
+ digester.addBeanPropertySetter("results/status", "status");
+ digester.addBeanPropertySetter("results/url", "url");
+ digester.addBeanPropertySetter("results/language", "language");
+ digester.addObjectCreate("results/keywords/keyword", Keyword.class);
+ digester.addBeanPropertySetter("results/keywords/keyword", "text");
+ digester.addSetNext("results/keywords/keyword", "addKeyword");
+ return (Results) digester.parse(xmlReader);
+ }
+
+}
Propchange: incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/keyword/XMLTextKeywordExctractionDigester.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/language/LanguageDetectionDigesterProvider.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/language/LanguageDetectionDigesterProvider.java?rev=910938&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/language/LanguageDetectionDigesterProvider.java (added)
+++ incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/language/LanguageDetectionDigesterProvider.java Wed Feb 17 12:06:17 2010
@@ -0,0 +1,38 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.uima.alchemy.digester.language;
+
+import org.apache.commons.lang.Validate;
+import org.apache.uima.alchemy.digester.DigesterProvider;
+import org.apache.uima.alchemy.digester.OutputDigester;
+import org.apache.uima.alchemy.digester.exception.UnsupportedResultFormatException;
+
+public class LanguageDetectionDigesterProvider implements DigesterProvider {
+
+ public OutputDigester getDigester(String type) throws UnsupportedResultFormatException {
+ Validate.notEmpty(type);
+ OutputDigester digester = null;
+ if (type.equals("xml")) {
+ digester = new XMLLanguageDigester();
+ } else
+ throw new UnsupportedResultFormatException(type);
+ return digester;
+ }
+
+}
Propchange: incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/language/LanguageDetectionDigesterProvider.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/language/XMLLanguageDigester.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/language/XMLLanguageDigester.java?rev=910938&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/language/XMLLanguageDigester.java (added)
+++ incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/language/XMLLanguageDigester.java Wed Feb 17 12:06:17 2010
@@ -0,0 +1,51 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.uima.alchemy.digester.language;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URISyntaxException;
+
+import org.apache.commons.digester.Digester;
+import org.apache.uima.alchemy.digester.OutputDigester;
+import org.apache.uima.alchemy.digester.domain.LanguageDetectionResults;
+import org.apache.uima.alchemy.digester.domain.Results;
+import org.xml.sax.SAXException;
+
+public class XMLLanguageDigester implements OutputDigester {
+
+ public Results parseAlchemyXML(InputStream responseStream) throws IOException, SAXException,
+ URISyntaxException {
+ Digester digester = new Digester();
+ digester.setValidating(false);
+
+ digester.addObjectCreate("results", LanguageDetectionResults.class);
+ digester.addBeanPropertySetter("results/status", "status");
+ digester.addBeanPropertySetter("results/url", "url");
+ digester.addBeanPropertySetter("results/language", "language");
+ digester.addBeanPropertySetter("results/iso-639-1", "iso6391");
+ digester.addBeanPropertySetter("results/iso-639-2", "iso6392");
+ digester.addBeanPropertySetter("results/iso-639-3", "iso6393");
+ digester.addBeanPropertySetter("results/ethnologue", "ethnologue");
+ digester.addBeanPropertySetter("results/native-speakers", "nativeSpeakers");
+ digester.addBeanPropertySetter("results/wikipedia", "wikipedia");
+ return (Results) digester.parse(responseStream);
+ }
+
+}
Propchange: incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/language/XMLLanguageDigester.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/microformats/MicroformatsDigesterProvider.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/microformats/MicroformatsDigesterProvider.java?rev=910938&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/microformats/MicroformatsDigesterProvider.java (added)
+++ incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/microformats/MicroformatsDigesterProvider.java Wed Feb 17 12:06:17 2010
@@ -0,0 +1,38 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.uima.alchemy.digester.microformats;
+
+import org.apache.commons.lang.Validate;
+import org.apache.uima.alchemy.digester.DigesterProvider;
+import org.apache.uima.alchemy.digester.OutputDigester;
+import org.apache.uima.alchemy.digester.exception.UnsupportedResultFormatException;
+
+public class MicroformatsDigesterProvider implements DigesterProvider {
+
+ public OutputDigester getDigester(String type) throws UnsupportedResultFormatException {
+ Validate.notEmpty(type);
+ OutputDigester digester = null;
+ if (type.equals("xml")) {
+ digester = new XMLMicroformatsDigester();
+ } else
+ throw new UnsupportedResultFormatException(type);
+ return digester;
+ }
+
+}
Propchange: incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/microformats/MicroformatsDigesterProvider.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/microformats/XMLMicroformatsDigester.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/microformats/XMLMicroformatsDigester.java?rev=910938&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/microformats/XMLMicroformatsDigester.java (added)
+++ incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/microformats/XMLMicroformatsDigester.java Wed Feb 17 12:06:17 2010
@@ -0,0 +1,50 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.uima.alchemy.digester.microformats;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URISyntaxException;
+
+import org.apache.commons.digester.Digester;
+import org.apache.uima.alchemy.digester.OutputDigester;
+import org.apache.uima.alchemy.digester.domain.Microformat;
+import org.apache.uima.alchemy.digester.domain.MicroformatsResults;
+import org.apache.uima.alchemy.digester.domain.Results;
+import org.xml.sax.SAXException;
+
+public class XMLMicroformatsDigester implements OutputDigester {
+
+ public Results parseAlchemyXML(InputStream responseStream) throws IOException, SAXException,
+ URISyntaxException {
+ Digester digester = new Digester();
+ digester.setValidating(false);
+
+ digester.addObjectCreate("results", MicroformatsResults.class);
+ digester.addBeanPropertySetter("results/status", "status");
+ digester.addBeanPropertySetter("results/url", "url");
+ digester.addObjectCreate("results/microformats/microformat", Microformat.class);
+ digester.addBeanPropertySetter("results/microformats/microformat/field", "fieldName");
+ digester.addBeanPropertySetter("results/microformats/microformat/data", "fieldData");
+ digester.addSetNext("results/microformats/microformat", "addMicroformat");
+
+ return (Results) digester.parse(responseStream);
+ }
+
+}
Propchange: incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/digester/microformats/XMLMicroformatsDigester.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/ts/categorization/Category.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/ts/categorization/Category.java?rev=910938&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/ts/categorization/Category.java (added)
+++ incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/ts/categorization/Category.java Wed Feb 17 12:06:17 2010
@@ -0,0 +1,133 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/* First created by JCasGen Wed Nov 04 23:56:01 CET 2009 */
+package org.apache.uima.alchemy.ts.categorization;
+
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.JCasRegistry;
+import org.apache.uima.jcas.cas.TOP;
+import org.apache.uima.jcas.cas.TOP_Type;
+
+/**
+ * Updated by JCasGen Wed Nov 04 23:56:24 CET 2009 XML source:
+ * /Users/tommaso/Documents/workspaces/uima_ws
+ * /alchemy-annotator/src/main/resources/TextCategorizationAEDescriptor.xml
+ *
+ * @generated
+ */
+public class Category extends TOP {
+ /**
+ * @generated
+ * @ordered
+ */
+ public final static int typeIndexID = JCasRegistry.register(Category.class);
+
+ /**
+ * @generated
+ * @ordered
+ */
+ public final static int type = typeIndexID;
+
+ /** @generated */
+ public int getTypeIndexID() {
+ return typeIndexID;
+ }
+
+ /**
+ * Never called. Disable default constructor
+ *
+ * @generated
+ */
+ protected Category() {
+ }
+
+ /**
+ * Internal - constructor used by generator
+ *
+ * @generated
+ */
+ public Category(int addr, TOP_Type type) {
+ super(addr, type);
+ readObject();
+ }
+
+ /** @generated */
+ public Category(JCas jcas) {
+ super(jcas);
+ readObject();
+ }
+
+ /**
+ * <!-- begin-user-doc --> Write your own initialization here <!-- end-user-doc -->
+ *
+ * @generated modifiable
+ */
+ private void readObject() {
+ }
+
+ // *--------------*
+ // * Feature: score
+
+ /**
+ * getter for score - gets
+ *
+ * @generated
+ */
+ public String getScore() {
+ if (Category_Type.featOkTst && ((Category_Type) jcasType).casFeat_score == null)
+ jcasType.jcas.throwFeatMissing("score", "org.apache.uima.alchemy.ts.categorization.Category");
+ return jcasType.ll_cas.ll_getStringValue(addr, ((Category_Type) jcasType).casFeatCode_score);
+ }
+
+ /**
+ * setter for score - sets
+ *
+ * @generated
+ */
+ public void setScore(String v) {
+ if (Category_Type.featOkTst && ((Category_Type) jcasType).casFeat_score == null)
+ jcasType.jcas.throwFeatMissing("score", "org.apache.uima.alchemy.ts.categorization.Category");
+ jcasType.ll_cas.ll_setStringValue(addr, ((Category_Type) jcasType).casFeatCode_score, v);
+ }
+
+ // *--------------*
+ // * Feature: text
+
+ /**
+ * getter for text - gets
+ *
+ * @generated
+ */
+ public String getText() {
+ if (Category_Type.featOkTst && ((Category_Type) jcasType).casFeat_text == null)
+ jcasType.jcas.throwFeatMissing("text", "org.apache.uima.alchemy.ts.categorization.Category");
+ return jcasType.ll_cas.ll_getStringValue(addr, ((Category_Type) jcasType).casFeatCode_text);
+ }
+
+ /**
+ * setter for text - sets
+ *
+ * @generated
+ */
+ public void setText(String v) {
+ if (Category_Type.featOkTst && ((Category_Type) jcasType).casFeat_text == null)
+ jcasType.jcas.throwFeatMissing("text", "org.apache.uima.alchemy.ts.categorization.Category");
+ jcasType.ll_cas.ll_setStringValue(addr, ((Category_Type) jcasType).casFeatCode_text, v);
+ }
+}
Propchange: incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/ts/categorization/Category.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/ts/categorization/Category_Type.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/ts/categorization/Category_Type.java?rev=910938&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/ts/categorization/Category_Type.java (added)
+++ incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/ts/categorization/Category_Type.java Wed Feb 17 12:06:17 2010
@@ -0,0 +1,129 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/* First created by JCasGen Wed Nov 04 23:56:01 CET 2009 */
+package org.apache.uima.alchemy.ts.categorization;
+
+import org.apache.uima.cas.Feature;
+import org.apache.uima.cas.FeatureStructure;
+import org.apache.uima.cas.Type;
+import org.apache.uima.cas.impl.CASImpl;
+import org.apache.uima.cas.impl.FSGenerator;
+import org.apache.uima.cas.impl.FeatureImpl;
+import org.apache.uima.cas.impl.TypeImpl;
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.JCasRegistry;
+import org.apache.uima.jcas.cas.TOP_Type;
+
+/**
+ * Updated by JCasGen Wed Nov 04 23:56:24 CET 2009
+ *
+ * @generated
+ */
+public class Category_Type extends TOP_Type {
+ /** @generated */
+ protected FSGenerator getFSGenerator() {
+ return fsGenerator;
+ }
+
+ /** @generated */
+ private final FSGenerator fsGenerator = new FSGenerator() {
+ public FeatureStructure createFS(int addr, CASImpl cas) {
+ if (Category_Type.this.useExistingInstance) {
+ // Return eq fs instance if already created
+ FeatureStructure fs = Category_Type.this.jcas.getJfsFromCaddr(addr);
+ if (null == fs) {
+ fs = new Category(addr, Category_Type.this);
+ Category_Type.this.jcas.putJfsFromCaddr(addr, fs);
+ return fs;
+ }
+ return fs;
+ } else
+ return new Category(addr, Category_Type.this);
+ }
+ };
+
+ /** @generated */
+ public final static int typeIndexID = Category.typeIndexID;
+
+ /**
+ * @generated
+ * @modifiable
+ */
+ public final static boolean featOkTst = JCasRegistry
+ .getFeatOkTst("org.apache.uima.alchemy.ts.categorization.Category");
+
+ /** @generated */
+ final Feature casFeat_score;
+
+ /** @generated */
+ final int casFeatCode_score;
+
+ /** @generated */
+ public String getScore(int addr) {
+ if (featOkTst && casFeat_score == null)
+ jcas.throwFeatMissing("score", "org.apache.uima.alchemy.ts.categorization.Category");
+ return ll_cas.ll_getStringValue(addr, casFeatCode_score);
+ }
+
+ /** @generated */
+ public void setScore(int addr, String v) {
+ if (featOkTst && casFeat_score == null)
+ jcas.throwFeatMissing("score", "org.apache.uima.alchemy.ts.categorization.Category");
+ ll_cas.ll_setStringValue(addr, casFeatCode_score, v);
+ }
+
+ /** @generated */
+ final Feature casFeat_text;
+
+ /** @generated */
+ final int casFeatCode_text;
+
+ /** @generated */
+ public String getText(int addr) {
+ if (featOkTst && casFeat_text == null)
+ jcas.throwFeatMissing("text", "org.apache.uima.alchemy.ts.categorization.Category");
+ return ll_cas.ll_getStringValue(addr, casFeatCode_text);
+ }
+
+ /** @generated */
+ public void setText(int addr, String v) {
+ if (featOkTst && casFeat_text == null)
+ jcas.throwFeatMissing("text", "org.apache.uima.alchemy.ts.categorization.Category");
+ ll_cas.ll_setStringValue(addr, casFeatCode_text, v);
+ }
+
+ /**
+ * initialize variables to correspond with Cas Type and Features
+ *
+ * @generated
+ */
+ public Category_Type(JCas jcas, Type casType) {
+ super(jcas, casType);
+ casImpl.getFSClassRegistry().addGeneratorForType((TypeImpl) this.casType, getFSGenerator());
+
+ casFeat_score = jcas.getRequiredFeatureDE(casType, "score", "uima.cas.String", featOkTst);
+ casFeatCode_score = (null == casFeat_score) ? JCas.INVALID_FEATURE_CODE
+ : ((FeatureImpl) casFeat_score).getCode();
+
+ casFeat_text = jcas.getRequiredFeatureDE(casType, "text", "uima.cas.String", featOkTst);
+ casFeatCode_text = (null == casFeat_text) ? JCas.INVALID_FEATURE_CODE
+ : ((FeatureImpl) casFeat_text).getCode();
+
+ }
+}
Propchange: incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/ts/categorization/Category_Type.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/ts/entity/AlchemyAnnotation.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/ts/entity/AlchemyAnnotation.java?rev=910938&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/ts/entity/AlchemyAnnotation.java (added)
+++ incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/ts/entity/AlchemyAnnotation.java Wed Feb 17 12:06:17 2010
@@ -0,0 +1,124 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/* First created by JCasGen Sat Jan 09 18:51:20 CET 2010 */
+package org.apache.uima.alchemy.ts.entity;
+
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.JCasRegistry;
+import org.apache.uima.jcas.cas.TOP_Type;
+
+import org.apache.uima.jcas.tcas.Annotation;
+
+/**
+ * Updated by JCasGen Sat Jan 09 18:51:22 CET 2010 XML source:
+ * /Users/tommaso/Documents/workspaces/uima_ws
+ * /alchemy-annotator/src/main/resources/TextAnnotatedEntityExtractionAEDescriptor.xml
+ *
+ * @generated
+ */
+public class AlchemyAnnotation extends Annotation {
+ /**
+ * @generated
+ * @ordered
+ */
+ public final static int typeIndexID = JCasRegistry.register(AlchemyAnnotation.class);
+
+ /**
+ * @generated
+ * @ordered
+ */
+ public final static int type = typeIndexID;
+
+ /** @generated */
+ public int getTypeIndexID() {
+ return typeIndexID;
+ }
+
+ /**
+ * Never called. Disable default constructor
+ *
+ * @generated
+ */
+ protected AlchemyAnnotation() {
+ }
+
+ /**
+ * Internal - constructor used by generator
+ *
+ * @generated
+ */
+ public AlchemyAnnotation(int addr, TOP_Type type) {
+ super(addr, type);
+ readObject();
+ }
+
+ /** @generated */
+ public AlchemyAnnotation(JCas jcas) {
+ super(jcas);
+ readObject();
+ }
+
+ /** @generated */
+ public AlchemyAnnotation(JCas jcas, int begin, int end) {
+ super(jcas);
+ setBegin(begin);
+ setEnd(end);
+ readObject();
+ }
+
+ /**
+ * <!-- begin-user-doc --> Write your own initialization here <!-- end-user-doc -->
+ *
+ * @generated modifiable
+ */
+ private void readObject() {
+ }
+
+ // *--------------*
+ // * Feature: alchemyType
+
+ /**
+ * getter for alchemyType - gets
+ *
+ * @generated
+ */
+ public String getAlchemyType() {
+ if (AlchemyAnnotation_Type.featOkTst
+ && ((AlchemyAnnotation_Type) jcasType).casFeat_alchemyType == null)
+ jcasType.jcas.throwFeatMissing("alchemyType",
+ "org.apache.uima.alchemy.ts.entity.AlchemyAnnotation");
+ return jcasType.ll_cas.ll_getStringValue(addr,
+ ((AlchemyAnnotation_Type) jcasType).casFeatCode_alchemyType);
+ }
+
+ /**
+ * setter for alchemyType - sets
+ *
+ * @generated
+ */
+ public void setAlchemyType(String v) {
+ if (AlchemyAnnotation_Type.featOkTst
+ && ((AlchemyAnnotation_Type) jcasType).casFeat_alchemyType == null)
+ jcasType.jcas.throwFeatMissing("alchemyType",
+ "org.apache.uima.alchemy.ts.entity.AlchemyAnnotation");
+ jcasType.ll_cas.ll_setStringValue(addr,
+ ((AlchemyAnnotation_Type) jcasType).casFeatCode_alchemyType, v);
+ }
+}
Propchange: incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/ts/entity/AlchemyAnnotation.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/ts/entity/AlchemyAnnotation_Type.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/ts/entity/AlchemyAnnotation_Type.java?rev=910938&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/ts/entity/AlchemyAnnotation_Type.java (added)
+++ incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/ts/entity/AlchemyAnnotation_Type.java Wed Feb 17 12:06:17 2010
@@ -0,0 +1,107 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/* First created by JCasGen Sat Jan 09 18:51:20 CET 2010 */
+package org.apache.uima.alchemy.ts.entity;
+
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.JCasRegistry;
+import org.apache.uima.cas.impl.CASImpl;
+import org.apache.uima.cas.impl.FSGenerator;
+import org.apache.uima.cas.FeatureStructure;
+import org.apache.uima.cas.impl.TypeImpl;
+import org.apache.uima.cas.Type;
+import org.apache.uima.cas.impl.FeatureImpl;
+import org.apache.uima.cas.Feature;
+import org.apache.uima.jcas.tcas.Annotation_Type;
+
+/**
+ * Updated by JCasGen Sat Jan 09 18:51:22 CET 2010
+ *
+ * @generated
+ */
+public class AlchemyAnnotation_Type extends Annotation_Type {
+ /** @generated */
+ protected FSGenerator getFSGenerator() {
+ return fsGenerator;
+ }
+
+ /** @generated */
+ private final FSGenerator fsGenerator = new FSGenerator() {
+ public FeatureStructure createFS(int addr, CASImpl cas) {
+ if (AlchemyAnnotation_Type.this.useExistingInstance) {
+ // Return eq fs instance if already created
+ FeatureStructure fs = AlchemyAnnotation_Type.this.jcas.getJfsFromCaddr(addr);
+ if (null == fs) {
+ fs = new AlchemyAnnotation(addr, AlchemyAnnotation_Type.this);
+ AlchemyAnnotation_Type.this.jcas.putJfsFromCaddr(addr, fs);
+ return fs;
+ }
+ return fs;
+ } else
+ return new AlchemyAnnotation(addr, AlchemyAnnotation_Type.this);
+ }
+ };
+
+ /** @generated */
+ public final static int typeIndexID = AlchemyAnnotation.typeIndexID;
+
+ /**
+ * @generated
+ * @modifiable
+ */
+ public final static boolean featOkTst = JCasRegistry
+ .getFeatOkTst("org.apache.uima.alchemy.ts.entity.AlchemyAnnotation");
+
+ /** @generated */
+ final Feature casFeat_alchemyType;
+
+ /** @generated */
+ final int casFeatCode_alchemyType;
+
+ /** @generated */
+ public String getAlchemyType(int addr) {
+ if (featOkTst && casFeat_alchemyType == null)
+ jcas.throwFeatMissing("alchemyType", "org.apache.uima.alchemy.ts.entity.AlchemyAnnotation");
+ return ll_cas.ll_getStringValue(addr, casFeatCode_alchemyType);
+ }
+
+ /** @generated */
+ public void setAlchemyType(int addr, String v) {
+ if (featOkTst && casFeat_alchemyType == null)
+ jcas.throwFeatMissing("alchemyType", "org.apache.uima.alchemy.ts.entity.AlchemyAnnotation");
+ ll_cas.ll_setStringValue(addr, casFeatCode_alchemyType, v);
+ }
+
+ /**
+ * initialize variables to correspond with Cas Type and Features
+ *
+ * @generated
+ */
+ public AlchemyAnnotation_Type(JCas jcas, Type casType) {
+ super(jcas, casType);
+ casImpl.getFSClassRegistry().addGeneratorForType((TypeImpl) this.casType, getFSGenerator());
+
+ casFeat_alchemyType = jcas.getRequiredFeatureDE(casType, "alchemyType", "uima.cas.String",
+ featOkTst);
+ casFeatCode_alchemyType = (null == casFeat_alchemyType) ? JCas.INVALID_FEATURE_CODE
+ : ((FeatureImpl) casFeat_alchemyType).getCode();
+
+ }
+}
Propchange: incubator/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/ts/entity/AlchemyAnnotation_Type.java
------------------------------------------------------------------------------
svn:eol-style = native