Github user ajs6f commented on a diff in the pull request:
https://github.com/apache/jena/pull/314#discussion_r153816757
--- Diff:
jena-core/src/main/java/org/apache/jena/assembler/assemblers/AssemblerBase.java
---
@@ -63,11 +63,16 @@ protected static RDFNode getUnique( Resource root,
Property property )
throw new NotUniqueException( root, property );
}
- protected void checkType( Resource root, Resource type )
- {
- if (!root.hasProperty( RDF.type, type ))
- throw new CannotConstructException( this.getClass(), root,
type );
- }
+ /**
+ * Throws {@link CannotConstructException} if the offered resource
isn't any of the offered types.
+ *
+ * @param root resource to check
+ * @param types types for which to check
+ */
+ protected void checkType( Resource root, Resource... types ) {
--- End diff --
See the changes I made to
[InMemDatasetAssembler](https://github.com/apache/jena/pull/314/files#diff-296ca0303990cf5f435982192c1f2563R45).
That's where.
This happens because if you pass assembler RDF with `RDFDataset`, it could
become a general-purpose dataset or it could become a TIM dataset, and so the
TIM assembler has to be able to accept both types. IOW, "An assembler resource
must have one type", yes, but the more important point is that the assembler
code has to be able to _accept_ more than one type.
We can change the semantics, instead, so that there is a one-to-one between
types and assembler classes. and I am increasingly convinced we should, because
if _we_ are getting a bit confused about this, it's not going to be easy for
users!
---