You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by st...@apache.org on 2018/02/20 10:50:34 UTC

[1/3] commons-rdf git commit: No ExecutorService

Repository: commons-rdf
Updated Branches:
  refs/heads/fluent-parser 11a81fec6 -> a96eade4c


No ExecutorService

SnapshotParserConfig now contained within NullParserConfig


Project: http://git-wip-us.apache.org/repos/asf/commons-rdf/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-rdf/commit/6c9cc64d
Tree: http://git-wip-us.apache.org/repos/asf/commons-rdf/tree/6c9cc64d
Diff: http://git-wip-us.apache.org/repos/asf/commons-rdf/diff/6c9cc64d

Branch: refs/heads/fluent-parser
Commit: 6c9cc64d6d4b1ba374ed7abd39e578546469f30e
Parents: 11a81fe
Author: Stian Soiland-Reyes <st...@apache.org>
Authored: Tue Feb 20 10:41:07 2018 +0000
Committer: Stian Soiland-Reyes <st...@apache.org>
Committed: Tue Feb 20 10:41:07 2018 +0000

----------------------------------------------------------------------
 .../commons/rdf/api/io/MutableParserConfig.java |  1 -
 .../commons/rdf/api/io/NullParserConfig.java    |  8 ++----
 .../rdf/api/io/SnapshotParserConfig.java        | 29 --------------------
 3 files changed, 2 insertions(+), 36 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-rdf/blob/6c9cc64d/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/io/MutableParserConfig.java
----------------------------------------------------------------------
diff --git a/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/io/MutableParserConfig.java b/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/io/MutableParserConfig.java
index 283732e..c99407e 100644
--- a/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/io/MutableParserConfig.java
+++ b/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/io/MutableParserConfig.java
@@ -36,7 +36,6 @@ final class MutableParserConfig implements Cloneable, Serializable, ParserConfig
 	@SuppressWarnings("rawtypes")
 	private ParserTarget target = null;
 	private final Map<Option, Object> options = new HashMap<>();
-	private ExecutorService executor;
 
 	public MutableParserConfig() {
 	}

http://git-wip-us.apache.org/repos/asf/commons-rdf/blob/6c9cc64d/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/io/NullParserConfig.java
----------------------------------------------------------------------
diff --git a/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/io/NullParserConfig.java b/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/io/NullParserConfig.java
index 7ad78ba..e83a3a6 100644
--- a/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/io/NullParserConfig.java
+++ b/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/io/NullParserConfig.java
@@ -259,7 +259,6 @@ class NullParserConfig implements ImmutableParserConfig, Serializable {
 		private final ParserSource source;
 		private final ParserTarget target;
 		private final Map<Option, Object> options;
-		private final ExecutorService executor;
 
 		SnapshotParserConfig(ParserConfig old) {
 			this(
@@ -268,12 +267,10 @@ class NullParserConfig implements ImmutableParserConfig, Serializable {
 				old.base().orElse(null),
 				old.source().orElse(null),
 				old.target().orElse(null),
-				old.options(),
-				null);
+				old.options());
 		}
 		
-		SnapshotParserConfig(RDF rdf, RDFSyntax syntax, IRI base, ParserSource source, ParserTarget target, Map<Option, Object> options, 
-				ExecutorService executor) {
+		SnapshotParserConfig(RDF rdf, RDFSyntax syntax, IRI base, ParserSource source, ParserTarget target, Map<Option, Object> options) {
 			this.rdf = rdf;
 			this.syntax = syntax;
 			this.base = base;
@@ -281,7 +278,6 @@ class NullParserConfig implements ImmutableParserConfig, Serializable {
 			this.target = target;
 			// We'll make a copy
 			this.options = Collections.unmodifiableMap(new HashMap<Option, Object>(options));
-			this.executor = executor;				
 		}
 
 		@Override

http://git-wip-us.apache.org/repos/asf/commons-rdf/blob/6c9cc64d/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/io/SnapshotParserConfig.java
----------------------------------------------------------------------
diff --git a/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/io/SnapshotParserConfig.java b/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/io/SnapshotParserConfig.java
deleted file mode 100644
index 47e7ce9..0000000
--- a/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/io/SnapshotParserConfig.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * 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.commons.rdf.api.io;
-
-import java.io.Serializable;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Optional;
-import java.util.concurrent.ExecutorService;
-
-import org.apache.commons.rdf.api.IRI;
-import org.apache.commons.rdf.api.RDF;
-import org.apache.commons.rdf.api.RDFSyntax;
-import org.apache.commons.rdf.api.io.ParserConfig.ImmutableParserConfig;
-


[3/3] commons-rdf git commit: Sensible defaults in RDF() parser operations

Posted by st...@apache.org.
Sensible defaults in RDF() parser operations

but Simple throws UnsupportedOperationException as it can't parse
anything


Project: http://git-wip-us.apache.org/repos/asf/commons-rdf/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-rdf/commit/a96eade4
Tree: http://git-wip-us.apache.org/repos/asf/commons-rdf/tree/a96eade4
Diff: http://git-wip-us.apache.org/repos/asf/commons-rdf/diff/a96eade4

Branch: refs/heads/fluent-parser
Commit: a96eade4c3e88251323711095b7c4ea775fe60ac
Parents: 5f1c781
Author: Stian Soiland-Reyes <st...@apache.org>
Authored: Tue Feb 20 10:50:00 2018 +0000
Committer: Stian Soiland-Reyes <st...@apache.org>
Committed: Tue Feb 20 10:50:25 2018 +0000

----------------------------------------------------------------------
 .../main/java/org/apache/commons/rdf/api/RDF.java  | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-rdf/blob/a96eade4/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/RDF.java
----------------------------------------------------------------------
diff --git a/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/RDF.java b/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/RDF.java
index 46f7499..e88a171 100644
--- a/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/RDF.java
+++ b/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/RDF.java
@@ -28,6 +28,9 @@ import org.apache.commons.rdf.api.fluentparser.Sync;
 import org.apache.commons.rdf.api.io.Parsed;
 import org.apache.commons.rdf.api.io.Parser;
 import org.apache.commons.rdf.api.io.ParserBuilder;
+import org.apache.commons.rdf.api.io.ParserConfig;
+import org.apache.commons.rdf.api.io.ParserConfigBuilder;
+import org.apache.commons.rdf.api.io.ParserTarget;
 import org.apache.commons.rdf.api.io.Writer;
 
 /**
@@ -309,7 +312,11 @@ public interface RDF {
      * @throws UnsupportedOperationException
      *             If this RDF implementation does not support parsing RDF
      */
-    public ParserBuilder<Dataset> parserBuilder() throws UnsupportedOperationException;
+    @SuppressWarnings("unchecked")
+	default public ParserBuilder<Dataset> parserBuilder() throws UnsupportedOperationException {
+		return new ParserConfigBuilder(
+				ParserConfig.mutable().withRDF(this).withTarget(ParserTarget.toDataset(createDataset())));
+    }
     
     /**
      * Return a parser for the given RDF syntax.
@@ -327,7 +334,9 @@ public interface RDF {
      * @return A {@link Parser}, or {@link Optional#empty()} if the
      *         syntax is not supported.
      */
-    public Optional<Parser> parser(RDFSyntax syntax);
+    default public Optional<Parser> parser(RDFSyntax syntax) {
+    	return Optional.empty();
+    }
 
     /**
      * Return a writer for the given RDF syntax.
@@ -344,5 +353,7 @@ public interface RDF {
      * @return A {@link Writer}, or {@link Optional#empty()} if the
      *         syntax is not supported.
      */
-    public Optional<Writer> writer(RDFSyntax syntax);    
+    default public Optional<Writer> writer(RDFSyntax syntax) {
+    	return Optional.empty();
+    }
 }


[2/3] commons-rdf git commit: equivalent WriterConfig

Posted by st...@apache.org.
equivalent WriterConfig


Project: http://git-wip-us.apache.org/repos/asf/commons-rdf/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-rdf/commit/5f1c7814
Tree: http://git-wip-us.apache.org/repos/asf/commons-rdf/tree/5f1c7814
Diff: http://git-wip-us.apache.org/repos/asf/commons-rdf/diff/5f1c7814

Branch: refs/heads/fluent-parser
Commit: 5f1c781491734c4ef71bec9ad6393b50e09062b4
Parents: 6c9cc64
Author: Stian Soiland-Reyes <st...@apache.org>
Authored: Tue Feb 20 10:43:50 2018 +0000
Committer: Stian Soiland-Reyes <st...@apache.org>
Committed: Tue Feb 20 10:45:57 2018 +0000

----------------------------------------------------------------------
 .../java/org/apache/commons/rdf/api/RDF.java    |  17 ++
 .../commons/rdf/api/fluentwriter/Async.java     |   2 +-
 .../commons/rdf/api/fluentwriter/Buildable.java |  49 ++++
 .../rdf/api/fluentwriter/NeedSource.java        |   2 +-
 .../rdf/api/fluentwriter/NeedTarget.java        |   2 +-
 .../commons/rdf/api/fluentwriter/Sync.java      |   2 +-
 .../rdf/api/fluentwriter/_Buildable.java        |  49 ----
 .../commons/rdf/api/io/MutableWriterConfig.java | 103 ++++++++
 .../commons/rdf/api/io/NullWriterConfig.java    | 252 +++++++++++++++++++
 .../org/apache/commons/rdf/api/io/Writer.java   |  54 ++++
 .../apache/commons/rdf/api/io/WriterConfig.java |  68 +++++
 11 files changed, 547 insertions(+), 53 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-rdf/blob/5f1c7814/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/RDF.java
----------------------------------------------------------------------
diff --git a/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/RDF.java b/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/RDF.java
index 8fab94f..46f7499 100644
--- a/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/RDF.java
+++ b/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/RDF.java
@@ -28,6 +28,7 @@ import org.apache.commons.rdf.api.fluentparser.Sync;
 import org.apache.commons.rdf.api.io.Parsed;
 import org.apache.commons.rdf.api.io.Parser;
 import org.apache.commons.rdf.api.io.ParserBuilder;
+import org.apache.commons.rdf.api.io.Writer;
 
 /**
  * A RDF implementation.
@@ -328,4 +329,20 @@ public interface RDF {
      */
     public Optional<Parser> parser(RDFSyntax syntax);
 
+    /**
+     * Return a writer for the given RDF syntax.
+     * <p>
+     * If the syntax is not supported/recognised by this RDF implementation,
+     * return {@link Optional#empty()}, otherwise return an {@link Optional}
+     * containing an {@link Writer} for that syntax.
+     * <p>
+     * If the provided syntax is <code>null</code>, 
+     * return a generic {@link Writer} that can detect the syntax 
+     * (e.g. from WriterConfig), or {@link Optional#empty()} if this feature is not supported.
+     * 
+     * @param syntax RDF Syntax to write, or <code>null</code> for syntax to be configured later.
+     * @return A {@link Writer}, or {@link Optional#empty()} if the
+     *         syntax is not supported.
+     */
+    public Optional<Writer> writer(RDFSyntax syntax);    
 }

http://git-wip-us.apache.org/repos/asf/commons-rdf/blob/5f1c7814/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/fluentwriter/Async.java
----------------------------------------------------------------------
diff --git a/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/fluentwriter/Async.java b/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/fluentwriter/Async.java
index e7edcf4..99982eb 100644
--- a/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/fluentwriter/Async.java
+++ b/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/fluentwriter/Async.java
@@ -5,7 +5,7 @@ import java.util.concurrent.Future;
 import org.apache.commons.rdf.api.io.Option;
 import org.apache.commons.rdf.api.io.Written;
 
-public interface Async extends _Buildable {
+public interface Async extends Buildable {
     
     Async build();    
     <V> Async option(Option<V> option, V value);

http://git-wip-us.apache.org/repos/asf/commons-rdf/blob/5f1c7814/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/fluentwriter/Buildable.java
----------------------------------------------------------------------
diff --git a/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/fluentwriter/Buildable.java b/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/fluentwriter/Buildable.java
new file mode 100644
index 0000000..bd6aeab
--- /dev/null
+++ b/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/fluentwriter/Buildable.java
@@ -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.commons.rdf.api.fluentwriter;
+
+import org.apache.commons.rdf.api.io.Option;
+import org.apache.commons.rdf.api.io.Option.RequiredOption;
+
+public interface Buildable {
+    /**
+     * Return an immutable builder at the current state. The returned builder
+     * can be re-used multiple times in a thread-safe way.
+     * 
+     * @return An immutable builder
+     */
+    Buildable build();
+    
+    /**
+     * Return a builder with the given option set.
+     * <p>
+     * Note that implementations of {@link Writer} may support different
+     * vendor-specific {@link Option} types, and are free to ignore the set
+     * option (unless it is a {@link RequiredOption}).
+     * <p>
+     * It is undefined if setting multiple values for the same (equal) option
+     * are accumulative or overriding.
+     * 
+     * @param <V> The type of the {@link Option} value 
+     * @param option Option to set
+     * @param value Value to set for option
+     * @return A builder with the given option set
+     */
+    <V> Buildable option(Option<V> option, V value);
+
+}

http://git-wip-us.apache.org/repos/asf/commons-rdf/blob/5f1c7814/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/fluentwriter/NeedSource.java
----------------------------------------------------------------------
diff --git a/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/fluentwriter/NeedSource.java b/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/fluentwriter/NeedSource.java
index 3070427..007777e 100644
--- a/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/fluentwriter/NeedSource.java
+++ b/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/fluentwriter/NeedSource.java
@@ -8,7 +8,7 @@ import org.apache.commons.rdf.api.TripleLike;
 import org.apache.commons.rdf.api.io.Option;
 import org.apache.commons.rdf.api.io.WriterSource;
 
-public interface NeedSource extends _Buildable {
+public interface NeedSource extends Buildable {
     
     NeedSource build();    
     <V> NeedSource option(Option<V> option, V value);

http://git-wip-us.apache.org/repos/asf/commons-rdf/blob/5f1c7814/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/fluentwriter/NeedTarget.java
----------------------------------------------------------------------
diff --git a/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/fluentwriter/NeedTarget.java b/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/fluentwriter/NeedTarget.java
index 2148b54..2f245d8 100644
--- a/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/fluentwriter/NeedTarget.java
+++ b/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/fluentwriter/NeedTarget.java
@@ -23,7 +23,7 @@ import java.nio.file.Path;
 import org.apache.commons.rdf.api.io.Option;
 import org.apache.commons.rdf.api.io.WriterTarget;
 
-public interface NeedTarget extends _Buildable {
+public interface NeedTarget extends Buildable {
     @Override
     NeedTarget build();
     <V> NeedTarget option(Option<V> option, V value);

http://git-wip-us.apache.org/repos/asf/commons-rdf/blob/5f1c7814/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/fluentwriter/Sync.java
----------------------------------------------------------------------
diff --git a/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/fluentwriter/Sync.java b/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/fluentwriter/Sync.java
index f6d8afc..af2ba05 100644
--- a/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/fluentwriter/Sync.java
+++ b/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/fluentwriter/Sync.java
@@ -5,7 +5,7 @@ import java.util.concurrent.ExecutorService;
 import org.apache.commons.rdf.api.io.Option;
 import org.apache.commons.rdf.api.io.Written;
 
-public interface Sync extends _Buildable {
+public interface Sync extends Buildable {
     
     Sync build();    
     <V> Sync option(Option<V> option, V value);

http://git-wip-us.apache.org/repos/asf/commons-rdf/blob/5f1c7814/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/fluentwriter/_Buildable.java
----------------------------------------------------------------------
diff --git a/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/fluentwriter/_Buildable.java b/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/fluentwriter/_Buildable.java
deleted file mode 100644
index 95c4c7b..0000000
--- a/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/fluentwriter/_Buildable.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- * 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.commons.rdf.api.fluentwriter;
-
-import org.apache.commons.rdf.api.io.Option;
-import org.apache.commons.rdf.api.io.Option.RequiredOption;
-
-interface _Buildable {
-    /**
-     * Return an immutable builder at the current state. The returned builder
-     * can be re-used multiple times in a thread-safe way.
-     * 
-     * @return An immutable builder
-     */
-    _Buildable build();
-    
-    /**
-     * Return a builder with the given option set.
-     * <p>
-     * Note that implementations of {@link Writer} may support different
-     * vendor-specific {@link Option} types, and are free to ignore the set
-     * option (unless it is a {@link RequiredOption}).
-     * <p>
-     * It is undefined if setting multiple values for the same (equal) option
-     * are accumulative or overriding.
-     * 
-     * @param <V> The type of the {@link Option} value 
-     * @param option Option to set
-     * @param value Value to set for option
-     * @return A builder with the given option set
-     */
-    <V> _Buildable option(Option<V> option, V value);
-
-}

http://git-wip-us.apache.org/repos/asf/commons-rdf/blob/5f1c7814/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/io/MutableWriterConfig.java
----------------------------------------------------------------------
diff --git a/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/io/MutableWriterConfig.java b/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/io/MutableWriterConfig.java
new file mode 100644
index 0000000..96df0ee
--- /dev/null
+++ b/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/io/MutableWriterConfig.java
@@ -0,0 +1,103 @@
+/*
+ * 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.commons.rdf.api.io;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Optional;
+
+import org.apache.commons.rdf.api.RDF;
+import org.apache.commons.rdf.api.RDFSyntax;
+
+final class MutableWriterConfig implements Cloneable, Serializable, WriterConfig {
+	private static final long serialVersionUID = 1L;
+	private RDF rdf = null;
+	private RDFSyntax syntax = null;
+	private WriterSource source = null;
+	private WriterTarget target = null;
+	@SuppressWarnings("rawtypes")
+	private final Map<Option, Object> options = new HashMap<>();
+
+	public MutableWriterConfig() {
+	}
+
+	public MutableWriterConfig(WriterConfig old) {
+		rdf = old.rdf().orElse(null);
+		syntax = old.syntax().orElse(null);
+		source = old.source().orElse(null);
+		target = old.target().orElse(null);
+		options.putAll(old.options());
+	}
+
+	@Override
+	protected Object clone() {
+		return new MutableWriterConfig(this);
+	}
+
+	@Override
+	public Optional<WriterSource> source() {
+		return Optional.ofNullable(source);
+	}
+
+	@Override
+	public Optional<WriterTarget> target() {
+		return Optional.ofNullable(target);
+	}
+
+	@Override
+	public Optional<RDFSyntax> syntax() {
+		return Optional.ofNullable(syntax);
+	}
+
+	@Override
+	public Optional<RDF> rdf() {
+		return Optional.ofNullable(rdf);
+	}
+
+	@SuppressWarnings("rawtypes")
+	@Override
+	public Map<Option, Object> options() {
+		return options;
+	}
+
+	public WriterConfig withSyntax(RDFSyntax syntax) {
+		this.syntax = syntax;
+		return this;
+	}
+
+	public WriterConfig withSource(WriterSource source) {
+		this.source = source;
+		return this;
+	}
+
+	public WriterConfig withTarget(WriterTarget target) {
+		this.target = target;
+		return this;
+	}
+
+	public WriterConfig withRDF(RDF rdf) {
+		this.rdf = rdf;
+		return this;
+	}
+
+	public <V> WriterConfig withOption(Option<V> o, V v) {
+		this.options.put(o, v);
+		return this;
+	}
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/commons-rdf/blob/5f1c7814/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/io/NullWriterConfig.java
----------------------------------------------------------------------
diff --git a/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/io/NullWriterConfig.java b/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/io/NullWriterConfig.java
new file mode 100644
index 0000000..e26cfaf
--- /dev/null
+++ b/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/io/NullWriterConfig.java
@@ -0,0 +1,252 @@
+/*
+ * 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.commons.rdf.api.io;
+
+import java.io.Serializable;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Optional;
+import java.util.concurrent.ExecutorService;
+
+import org.apache.commons.rdf.api.IRI;
+import org.apache.commons.rdf.api.RDF;
+import org.apache.commons.rdf.api.RDFSyntax;
+import org.apache.commons.rdf.api.io.WriterConfig.ImmutableWriterConfig;
+
+class NullWriterConfig implements ImmutableWriterConfig, Serializable {
+
+	private static final long serialVersionUID = 1L;
+
+	@Override
+	public Optional<WriterSource> source() {
+		return Optional.empty();
+	}
+
+	@Override
+	public Optional<WriterTarget> target() {
+		return Optional.empty();
+	}
+
+	@Override
+	public Optional<RDFSyntax> syntax() {
+		return Optional.empty();
+	}
+
+	@Override
+	public Optional<RDF> rdf() {
+		return Optional.empty();
+	}
+
+	@SuppressWarnings("rawtypes")
+	@Override
+	public Map<Option, Object> options() {
+		return Collections.emptyMap();
+	}
+
+	@Override
+	public WriterConfig withSyntax(RDFSyntax syntax) {
+		return new WithSyntax(this, syntax);
+	}
+
+	@Override
+	public WriterConfig withSource(WriterSource source) {
+		return new WithSource(this, source);
+	}
+
+	@Override
+	public WriterConfig withTarget(WriterTarget target) {
+		return new WithTarget(this, target);
+	}
+
+	@Override
+	public WriterConfig withRDF(RDF rdf) {
+		return new WithRDF(this, rdf);
+	}
+
+	@Override
+	public <V> WriterConfig withOption(Option<V> o, V v) {
+		return new WithOption(this, o, v);
+	}
+
+	static class WithParent extends NullWriterConfig implements ImmutableWriterConfig {
+		private final ImmutableWriterConfig parent;
+
+		WithParent(ImmutableWriterConfig parent) {
+			this.parent = parent;
+		}
+
+		@Override
+		public Optional<WriterSource> source() {
+			return parent.source();
+		}
+
+		@Override
+		public Optional<WriterTarget> target() {
+			return parent.target();
+		}
+
+		@Override
+		public Optional<RDFSyntax> syntax() {
+			return parent.syntax();
+		}
+
+		@Override
+		public Optional<RDF> rdf() {
+			return parent.rdf();
+		}
+
+		@Override
+		public Map<Option, Object> options() {
+			return parent.options();
+		}
+	}
+
+	static final class WithSyntax extends WithParent implements WriterConfig {
+		private final RDFSyntax syntax;
+
+		public WithSyntax(ImmutableWriterConfig parent, RDFSyntax syntax) {
+			super(parent);
+			this.syntax = syntax;
+		}
+
+		@Override
+		public Optional<RDFSyntax> syntax() {
+			return Optional.ofNullable(syntax);
+		}
+	}
+
+	static final class WithSource extends WithParent implements WriterConfig {
+		private final WriterSource source;
+
+		public WithSource(ImmutableWriterConfig parent, WriterSource source) {
+			super(parent);
+			this.source = source;
+		}
+
+		@Override
+		public Optional<WriterSource> source() {
+			return Optional.ofNullable(source);
+		}
+	}
+
+	static class WithTarget extends WithParent implements WriterConfig {
+		private final WriterTarget target;
+
+		public WithTarget(ImmutableWriterConfig parent, WriterTarget target) {
+			super(parent);
+			this.target = target;
+		}
+
+		@Override
+		public Optional<WriterTarget> target() {
+			return Optional.ofNullable(target);
+		}
+	}
+	
+	static class WithRDF extends WithParent implements WriterConfig {
+		private final RDF rdf;
+
+		public WithRDF(ImmutableWriterConfig parent, RDF rdf) {
+			super(parent);
+			this.rdf = rdf;
+		}
+		@Override
+		public Optional<RDF> rdf() {
+			return Optional.ofNullable(rdf);
+		}
+
+	}	
+
+	static class WithOption extends WithParent implements WriterConfig {
+		private Option o;
+		private Object v;
+		public <V> WithOption(ImmutableWriterConfig parent, Option<V> o, V v) {
+			super(parent);
+			this.o = o;
+			this.v = v;
+		}
+		@Override
+		public Map<Option, Object> options() {
+			// Add to parent options
+			Map<Option, Object> options = super.options();
+			if (v == null) {
+				options.remove(o);
+			} else {
+				options.put(o, v);
+			}
+			return options;			
+		}
+	}
+	
+	@SuppressWarnings("rawtypes")
+	final static class SnapshotWriterConfig extends NullWriterConfig {
+		private static final long serialVersionUID = 1L;
+		private final RDF rdf;
+		private final RDFSyntax syntax;
+		private final WriterSource source;
+		private final WriterTarget target;
+		private final Map<Option, Object> options;
+
+		SnapshotWriterConfig(WriterConfig old) {
+			this(
+				old.rdf().orElse(null),
+				old.syntax().orElse(null),
+				old.source().orElse(null),
+				old.target().orElse(null),
+				old.options(),
+				null);
+		}
+		
+		SnapshotWriterConfig(RDF rdf, RDFSyntax syntax, WriterSource source, WriterTarget target, Map<Option, Object> options, 
+				ExecutorService executor) {
+			this.rdf = rdf;
+			this.syntax = syntax;
+			this.source = source;
+			this.target = target;
+			// We'll make a copy
+			this.options = Collections.unmodifiableMap(new HashMap<Option, Object>(options));
+		}
+
+		@Override
+		public Optional<WriterSource> source() {
+			return Optional.ofNullable(source);
+		}
+
+		@Override
+		public Optional<WriterTarget> target() {
+			return Optional.ofNullable(target);
+		}
+
+		@Override
+		public Optional<RDFSyntax> syntax() {
+			return Optional.ofNullable(syntax);
+		}
+
+		@Override
+		public Optional<RDF> rdf() {
+			return Optional.ofNullable(rdf);
+		}
+
+		@Override
+		public Map<Option, Object> options() {
+			// return a mutable copy so our children can build on it
+			return new HashMap<Option,Object>(options);
+		}
+	}	
+	
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/commons-rdf/blob/5f1c7814/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/io/Writer.java
----------------------------------------------------------------------
diff --git a/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/io/Writer.java b/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/io/Writer.java
new file mode 100644
index 0000000..5267e97
--- /dev/null
+++ b/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/io/Writer.java
@@ -0,0 +1,54 @@
+/*
+ * 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.commons.rdf.api.io;
+
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+
+public interface Writer {
+
+	@SuppressWarnings("rawtypes")
+	Written write(WriterConfig config);
+
+//	@SuppressWarnings("rawtypes")
+//	default Future<Parsed> writeAsync(ParserConfig config) {
+//		return new DefaultAsyncWriter(this, config).submit();
+//	}
+
+//	class DefaultAsyncParser {
+//		private static final ThreadGroup THEAD_GROUP = new ThreadGroup("Commons RDF async writer");
+//		private static final ExecutorService DEFAULT_EXECUTOR = Executors
+//				.newCachedThreadPool(r -> new Thread(THEAD_GROUP, r));
+//		
+//		private final Writer syncWriter;
+//		private final WriterConfig config;
+//
+//		DefaultAsyncParser(Writer writer, WriterConfig config) {
+//			this.syncWriter = writer;
+//			this.config = config.asImmutableConfig();
+//		}
+//		
+//		Written write() {
+//			return syncWriter.write(config);			
+//		}
+//
+//		Future<Parsed> submit() {
+//			return DEFAULT_EXECUTOR.submit(this::write);
+//		}
+//	}
+}

http://git-wip-us.apache.org/repos/asf/commons-rdf/blob/5f1c7814/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/io/WriterConfig.java
----------------------------------------------------------------------
diff --git a/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/io/WriterConfig.java b/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/io/WriterConfig.java
new file mode 100644
index 0000000..bbe781f
--- /dev/null
+++ b/commons-rdf-api/src/main/java/org/apache/commons/rdf/api/io/WriterConfig.java
@@ -0,0 +1,68 @@
+/*
+ * 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.commons.rdf.api.io;
+
+import java.io.Serializable;
+import java.util.Map;
+import java.util.Optional;
+
+import org.apache.commons.rdf.api.RDF;
+import org.apache.commons.rdf.api.RDFSyntax;
+import org.apache.commons.rdf.api.io.NullWriterConfig.SnapshotWriterConfig;
+
+@SuppressWarnings("rawtypes")
+public interface WriterConfig {
+	Optional<WriterSource> source();
+	Optional<WriterTarget> target();
+	Optional<RDFSyntax> syntax();
+	Optional<RDF> rdf();
+	Map<Option, Object> options();
+	
+	WriterConfig withSyntax(RDFSyntax syntax);
+	WriterConfig withSource(WriterSource source);
+	WriterConfig withTarget(WriterTarget target);
+	WriterConfig withRDF(RDF rdf);
+
+	<V> WriterConfig withOption(Option<V> o, V v);	
+	
+	static WriterConfig immutable() {
+		return new NullWriterConfig();
+	}
+
+	static WriterConfig mutable() {		
+		return new MutableWriterConfig();
+	}
+	
+	default WriterConfig asMutableConfig() {
+		if (this instanceof MutableWriterConfig) {
+			return this;
+		} else {
+			return new MutableWriterConfig(this);
+		}
+	}
+	
+	default ImmutableWriterConfig asImmutableConfig() {
+		if (this instanceof ImmutableWriterConfig) {
+			return (ImmutableWriterConfig) this;
+		} else {
+			return new SnapshotWriterConfig(this);
+		}
+	}
+	
+	interface ImmutableWriterConfig extends WriterConfig, Serializable {} 
+
+}