/** * Adds a handlesMimetypes restriction to the query. * * <p>Note that all mimetypes added using the methods {@link #addHandlesMimetype(String...)}, * {@link #addHandlesMimetypeWildcard(String...)}, {@link #addHandlesMimetypes(String, String)} * and {@link #addHandlesMimetypesWildcard(String, String)} will be concatenated using UNION. * * @param leftMimetype the left mimetype * @param rightMimetype the right mimetype * @return this query */ public ComponentQuery addHandlesMimetypes(String leftMimetype, String rightMimetype) { if (leftMimetype != null && !leftMimetype.isEmpty() && rightMimetype != null && !rightMimetype.isEmpty()) { Node node = NodeFactory.createAnon(); ElementGroup group = new ElementGroup(); group.addTriplePattern( new Triple(wfNode, NodeFactory.createURI(ONTOLOGY_IRI + "handlesMimetypes"), node)); group.addTriplePattern( new Triple( node, NodeFactory.createURI(TYPE_IRI), NodeFactory.createURI(ONTOLOGY_IRI + "AcceptedMimetypes"))); group.addTriplePattern( new Triple( node, NodeFactory.createURI(ONTOLOGY_IRI + "handlesLeftMimetype"), NodeFactory.createLiteral(leftMimetype))); group.addTriplePattern( new Triple( node, NodeFactory.createURI(ONTOLOGY_IRI + "handlesRightMimetype"), NodeFactory.createLiteral(rightMimetype))); handlesMimetypes.addElement(group); } return this; }
/** * Adds a handlesMimetype restriction to the query. * * <p>Note that all mimetypes added using the methods {@link #addHandlesMimetype(String...)}, * {@link #addHandlesMimetypeWildcard(String...)}, {@link #addHandlesMimetypes(String, String)} * and {@link #addHandlesMimetypesWildcard(String, String)} will be concatenated using UNION. * * @param mimetypes the mimetypes * @return this query */ public ComponentQuery addHandlesMimetype(String... mimetypes) { if (mimetypes != null && mimetypes.length > 0) { ElementGroup elements = new ElementGroup(); Set<String> mimeset = new HashSet<String>(); Collections.addAll(mimeset, mimetypes); for (String mimetype : mimeset) { if (mimetype != null) { elements.addTriplePattern( new Triple( wfNode, NodeFactory.createURI(ONTOLOGY_IRI + "handlesMimetype"), NodeFactory.createLiteral(mimetype))); } } handlesMimetypes.addElement(elements); } return this; }
/** * Adds a migration path source restriction to the query. * * <p>Note that all mimetypes added using the methods {@link #addMigrationPath(String)}, {@link * #addMigrationPathWildcard(String)} will be concatenated using UNION. * * @param sourceMimetype the source mimetype * @return this query */ public ComponentQuery addMigrationPath(String sourceMimetype) { if (sourceMimetype != null && !sourceMimetype.isEmpty()) { Node node = NodeFactory.createAnon(); ElementGroup group = new ElementGroup(); group.addTriplePattern( new Triple(wfNode, NodeFactory.createURI(ONTOLOGY_IRI + "migrates"), node)); group.addTriplePattern( new Triple( node, NodeFactory.createURI(TYPE_IRI), NodeFactory.createURI(ONTOLOGY_IRI + "MigrationPath"))); group.addTriplePattern( new Triple( node, NodeFactory.createURI(ONTOLOGY_IRI + "sourceMimetype"), NodeFactory.createLiteral(sourceMimetype))); migrationPathSource.addElement(group); } return this; }