You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2019/08/21 07:58:10 UTC
[camel] 15/20: Improve documentation
This is an automated email from the ASF dual-hosted git repository.
acosentino pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
commit f9abcdda1e3224f728354788c33ef251cf75174c
Author: Roberto Flores <be...@gmail.com>
AuthorDate: Sun Aug 4 18:18:15 2019 -0500
Improve documentation
---
.../src/main/docs/any23-dataformat.adoc | 51 +++++++++++++---------
.../camel/model/dataformat/Any23DataFormat.java | 21 ++++++++-
.../modules/ROOT/pages/any23-dataformat.adoc | 51 +++++++++++++---------
.../springboot/Any23DataFormatConfiguration.java | 15 +++++++
4 files changed, 97 insertions(+), 41 deletions(-)
diff --git a/components/camel-any23/src/main/docs/any23-dataformat.adoc b/components/camel-any23/src/main/docs/any23-dataformat.adoc
index 7e51ad2..3f6450c 100644
--- a/components/camel-any23/src/main/docs/any23-dataformat.adoc
+++ b/components/camel-any23/src/main/docs/any23-dataformat.adoc
@@ -5,7 +5,6 @@ Camel Any23 is a DataFormat that uses the Apache Anything To Triples (Any23) lib
The main functionality of this DataFormat focuses on its Unmarshal method which extracts RDF triplets from compatible pages, in a wide variety of RDF syntaxes.
-
*Available as of Camel version 3.0*
Any23 is a Data Format that is intended to convert HTML from a site (or file) into rdf.
@@ -20,10 +19,10 @@ The Any23 dataformat supports 5 options, which are listed below.
[width="100%",cols="2s,1m,1m,6",options="header"]
|===
| Name | Default | Java Type | Description
-| outputFormat | RDF4JMODEL | Any23Type |
-| configurations | | Map |
-| extractors | | List |
-| baseURI | | String |
+| outputFormat | RDF4JMODEL | Any23Type | What RDF syntax to unmarshal as, can be: NTRIPLES, TURTLE, NQUADS, RDFXML, JSONLD, RDFJSON, RDF4JMODEL. It is by default: RDF4JMODEL.
+| configurations | | Map | Configurations for Apache Any23 as key-value pairs in order to customize the extraction process. The list of supported parameters can be found here. If not provided, a default configuration is used.
+| extractors | | List | List of Any23 extractors to be used in the unmarshal operation. A list of the available extractors can be found here here. If not provided, all the available extractors are used.
+| baseURI | | String | The URI to use as base for building RDF entities if only relative paths are provided.
| contentTypeHeader | false | Boolean | Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML, or application/json for data formats marshalling to JSon etc.
|===
// dataformat options: END
@@ -50,11 +49,11 @@ The component supports 5 options, which are listed below.
[width="100%",cols="2,5,^1,2",options="header"]
|===
| Name | Description | Default | Type
-| *camel.dataformat.any23.base-u-r-i* | | | String
-| *camel.dataformat.any23.configurations* | | | String
+| *camel.dataformat.any23.base-u-r-i* | The URI to use as base for building RDF entities if only relative paths are provided. | | String
+| *camel.dataformat.any23.configurations* | Configurations for Apache Any23 as key-value pairs in order to customize the extraction process. The list of supported parameters can be found here. If not provided, a default configuration is used. The option is a java.util.Map<java.lang.String,java.lang.String> type. | | String
| *camel.dataformat.any23.content-type-header* | Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML, or application/json for data formats marshalling to JSon etc. | false | Boolean
| *camel.dataformat.any23.enabled* | Whether to enable auto configuration of the any23 data format. This is enabled by default. | | Boolean
-| *camel.dataformat.any23.extractors* | | | List
+| *camel.dataformat.any23.extractors* | List of Any23 extractors to be used in the unmarshal operation. A list of the available extractors can be found here here. If not provided, all the available extractors are used. | | List
|===
// spring-boot-auto-configure options: END
@@ -78,20 +77,32 @@ to unmarshal using Spring
[source,java]
-----------------------------------------------------------------------
<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
- <route>
- <from uri="file://site/inbox"/>
- <unmarshal>
- <tidyMarkup/>
- </unmarshal>
- <to uri="file://site/blogs"/>
- </route>
-</camelContext>
+ <dataFormats>
+ <any23 id="any23" baseURI ="http://mock.foo/bar" outputFormat="TURTLE" >
+ <configurations>
+ <entry>
+ <key>any23.extraction.metadata.nesting</key>
+ <value>off</value>
+ </entry>
+ </configurations>
+ <extractors>html-head-title</extractors>
+ </any23>
+ </dataFormats>
+ <route>
+ <from uri="direct:start"/>
+ <to uri="http://microformats.org/2009/08"/>
+ <unmarshal>
+ <custom ref="any23"/>
+ </unmarshal>
+ <to uri="mock:result"/>
+ </route>
+ </camelContext>
-----------------------------------------------------------------------
### Dependencies
-To use TidyMarkup in your camel routes you need to add the a dependency
-on *camel-tagsoup* which implements this data format.
+To use Any23 in your camel routes you need to add the a dependency
+on *camel-any23* which implements this data format.
If you use maven you could just add the following to your pom.xml,
substituting the version number for the latest & greatest release (see
@@ -101,7 +112,7 @@ the download page for the latest versions).
----------------------------------------
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-tagsoup</artifactId>
+ <artifactId>camel-any23</artifactId>
<version>x.x.x</version>
</dependency>
-----------------------------------------
\ No newline at end of file
+----------------------------------------
diff --git a/core/camel-core/src/main/java/org/apache/camel/model/dataformat/Any23DataFormat.java b/core/camel-core/src/main/java/org/apache/camel/model/dataformat/Any23DataFormat.java
index 0560836..1a52aee 100644
--- a/core/camel-core/src/main/java/org/apache/camel/model/dataformat/Any23DataFormat.java
+++ b/core/camel-core/src/main/java/org/apache/camel/model/dataformat/Any23DataFormat.java
@@ -75,6 +75,10 @@ public class Any23DataFormat extends DataFormatDefinition {
return outputFormat;
}
+ /**
+ * What RDF syntax to unmarshal as, can be: NTRIPLES, TURTLE, NQUADS, RDFXML,
+ * JSONLD, RDFJSON, RDF4JMODEL. It is by default: RDF4JMODEL.
+ */
public void setOutputFormat(Any23Type outputFormat) {
this.outputFormat = outputFormat;
}
@@ -83,6 +87,12 @@ public class Any23DataFormat extends DataFormatDefinition {
return configurations;
}
+ /**
+ * Configurations for Apache Any23 as key-value pairs in order to customize
+ * the extraction process. The list of supported parameters can be found
+ * <a href="https://github.com/apache/any23/blob/master/api/src/main/resources/default-configuration.properties">here</a>.
+ * If not provided, a default configuration is used.
+ */
public void setConfigurations(Map<String, String> configurations) {
this.configurations = configurations;
}
@@ -91,6 +101,12 @@ public class Any23DataFormat extends DataFormatDefinition {
return extractors;
}
+ /**
+ * List of Any23 extractors to be used in the unmarshal operation. A list of
+ * the available extractors can be found here
+ * <a href="https://any23.apache.org/getting-started.html">here</a>. If not
+ * provided, all the available extractors are used.
+ */
public void setExtractors(List<String> extractors) {
this.extractors = extractors;
}
@@ -99,9 +115,12 @@ public class Any23DataFormat extends DataFormatDefinition {
return baseURI;
}
+ /**
+ * The URI to use as base for building RDF entities if only relative paths are
+ * provided.
+ */
public void setBaseURI(String baseURI) {
this.baseURI = baseURI;
}
-
}
diff --git a/docs/components/modules/ROOT/pages/any23-dataformat.adoc b/docs/components/modules/ROOT/pages/any23-dataformat.adoc
index 7e51ad2..3f6450c 100644
--- a/docs/components/modules/ROOT/pages/any23-dataformat.adoc
+++ b/docs/components/modules/ROOT/pages/any23-dataformat.adoc
@@ -5,7 +5,6 @@ Camel Any23 is a DataFormat that uses the Apache Anything To Triples (Any23) lib
The main functionality of this DataFormat focuses on its Unmarshal method which extracts RDF triplets from compatible pages, in a wide variety of RDF syntaxes.
-
*Available as of Camel version 3.0*
Any23 is a Data Format that is intended to convert HTML from a site (or file) into rdf.
@@ -20,10 +19,10 @@ The Any23 dataformat supports 5 options, which are listed below.
[width="100%",cols="2s,1m,1m,6",options="header"]
|===
| Name | Default | Java Type | Description
-| outputFormat | RDF4JMODEL | Any23Type |
-| configurations | | Map |
-| extractors | | List |
-| baseURI | | String |
+| outputFormat | RDF4JMODEL | Any23Type | What RDF syntax to unmarshal as, can be: NTRIPLES, TURTLE, NQUADS, RDFXML, JSONLD, RDFJSON, RDF4JMODEL. It is by default: RDF4JMODEL.
+| configurations | | Map | Configurations for Apache Any23 as key-value pairs in order to customize the extraction process. The list of supported parameters can be found here. If not provided, a default configuration is used.
+| extractors | | List | List of Any23 extractors to be used in the unmarshal operation. A list of the available extractors can be found here here. If not provided, all the available extractors are used.
+| baseURI | | String | The URI to use as base for building RDF entities if only relative paths are provided.
| contentTypeHeader | false | Boolean | Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML, or application/json for data formats marshalling to JSon etc.
|===
// dataformat options: END
@@ -50,11 +49,11 @@ The component supports 5 options, which are listed below.
[width="100%",cols="2,5,^1,2",options="header"]
|===
| Name | Description | Default | Type
-| *camel.dataformat.any23.base-u-r-i* | | | String
-| *camel.dataformat.any23.configurations* | | | String
+| *camel.dataformat.any23.base-u-r-i* | The URI to use as base for building RDF entities if only relative paths are provided. | | String
+| *camel.dataformat.any23.configurations* | Configurations for Apache Any23 as key-value pairs in order to customize the extraction process. The list of supported parameters can be found here. If not provided, a default configuration is used. The option is a java.util.Map<java.lang.String,java.lang.String> type. | | String
| *camel.dataformat.any23.content-type-header* | Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML, or application/json for data formats marshalling to JSon etc. | false | Boolean
| *camel.dataformat.any23.enabled* | Whether to enable auto configuration of the any23 data format. This is enabled by default. | | Boolean
-| *camel.dataformat.any23.extractors* | | | List
+| *camel.dataformat.any23.extractors* | List of Any23 extractors to be used in the unmarshal operation. A list of the available extractors can be found here here. If not provided, all the available extractors are used. | | List
|===
// spring-boot-auto-configure options: END
@@ -78,20 +77,32 @@ to unmarshal using Spring
[source,java]
-----------------------------------------------------------------------
<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
- <route>
- <from uri="file://site/inbox"/>
- <unmarshal>
- <tidyMarkup/>
- </unmarshal>
- <to uri="file://site/blogs"/>
- </route>
-</camelContext>
+ <dataFormats>
+ <any23 id="any23" baseURI ="http://mock.foo/bar" outputFormat="TURTLE" >
+ <configurations>
+ <entry>
+ <key>any23.extraction.metadata.nesting</key>
+ <value>off</value>
+ </entry>
+ </configurations>
+ <extractors>html-head-title</extractors>
+ </any23>
+ </dataFormats>
+ <route>
+ <from uri="direct:start"/>
+ <to uri="http://microformats.org/2009/08"/>
+ <unmarshal>
+ <custom ref="any23"/>
+ </unmarshal>
+ <to uri="mock:result"/>
+ </route>
+ </camelContext>
-----------------------------------------------------------------------
### Dependencies
-To use TidyMarkup in your camel routes you need to add the a dependency
-on *camel-tagsoup* which implements this data format.
+To use Any23 in your camel routes you need to add the a dependency
+on *camel-any23* which implements this data format.
If you use maven you could just add the following to your pom.xml,
substituting the version number for the latest & greatest release (see
@@ -101,7 +112,7 @@ the download page for the latest versions).
----------------------------------------
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-tagsoup</artifactId>
+ <artifactId>camel-any23</artifactId>
<version>x.x.x</version>
</dependency>
-----------------------------------------
\ No newline at end of file
+----------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-any23-starter/src/main/java/org/apache/camel/dataformat/any23/springboot/Any23DataFormatConfiguration.java b/platforms/spring-boot/components-starter/camel-any23-starter/src/main/java/org/apache/camel/dataformat/any23/springboot/Any23DataFormatConfiguration.java
index 058c337..9086602 100644
--- a/platforms/spring-boot/components-starter/camel-any23-starter/src/main/java/org/apache/camel/dataformat/any23/springboot/Any23DataFormatConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-any23-starter/src/main/java/org/apache/camel/dataformat/any23/springboot/Any23DataFormatConfiguration.java
@@ -37,8 +37,23 @@ public class Any23DataFormatConfiguration
* enabled by default.
*/
private Boolean enabled;
+ /**
+ * Configurations for Apache Any23 as key-value pairs in order to customize
+ * the extraction process. The list of supported parameters can be found
+ * here. If not provided, a default configuration is used. The option is a
+ * java.util.Map<java.lang.String,java.lang.String> type.
+ */
private String configurations;
+ /**
+ * List of Any23 extractors to be used in the unmarshal operation. A list of
+ * the available extractors can be found here here. If not provided, all the
+ * available extractors are used.
+ */
private List<String> extractors;
+ /**
+ * The URI to use as base for building RDF entities if only relative paths
+ * are provided.
+ */
private String baseURI;
/**
* Whether the data format should set the Content-Type header with the type