/** * Adds an environment restriction to the query. * * @param environmentClass the environment class * @return this query */ public ComponentQuery addInstallationEnvironmentType(String environmentClass) { if (environmentClass != null && !environmentClass.isEmpty()) { Node processNode = NodeFactory.createAnon(); Node installationNode = NodeFactory.createAnon(); Node environmentNode = NodeFactory.createAnon(); ElementGroup group = new ElementGroup(); group.addTriplePattern( new Triple(wfNode, NodeFactory.createURI(WFDESC_IRI + "hasSubProcess"), processNode)); group.addTriplePattern( new Triple( processNode, NodeFactory.createURI(ONTOLOGY_IRI + "requiresInstallation"), installationNode)); group.addTriplePattern( new Triple( installationNode, NodeFactory.createURI(ONTOLOGY_IRI + "hasEnvironment"), environmentNode)); group.addTriplePattern( new Triple( environmentNode, NodeFactory.createURI(TYPE_IRI), NodeFactory.createURI(environmentClass))); query.addElement(group); } return this; }
/** Finishes the dependency label filter. */ private void finishDependencyLabelFilter() { if (dependencyLabelPattern != null && !dependencyLabelPattern.isEmpty()) { Node processNode = NodeFactory.createAnon(); Node installationNode = NodeFactory.createAnon(); Node dependencyNode = NodeFactory.createAnon(); Node dependencyLabel = NodeFactory.createVariable("dependencyLabel"); ElementGroup group = new ElementGroup(); group.addTriplePattern( new Triple(wfNode, NodeFactory.createURI(WFDESC_IRI + "hasSubProcess"), processNode)); group.addTriplePattern( new Triple( processNode, NodeFactory.createURI(ONTOLOGY_IRI + "requiresInstallation"), installationNode)); group.addTriplePattern( new Triple( installationNode, NodeFactory.createURI(ONTOLOGY_IRI + "dependsOn"), dependencyNode)); group.addTriplePattern( new Triple(dependencyNode, NodeFactory.createURI(SKOS_LABEL), dependencyLabel)); query.addElement(group); ElementFilter filter = new ElementFilter( new E_StrContains( new ExprVar(dependencyLabel), new NodeValueString(dependencyLabelPattern))); query.addElementFilter(filter); } }
@Test public void bindingStream_61() { BindingMap b = BindingFactory.create(); Node bn = NodeFactory.createAnon(new AnonId("unusual")); b.add(Var.alloc("v"), bn); testWriteRead(b); }
/** * 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 migration path restriction to the query. * * @param sourceMimetype the source mimetype * @param targetMimetype the target mimetype * @return this query */ public ComponentQuery addMigrationPath(String sourceMimetype, String targetMimetype) { if ((sourceMimetype != null && !sourceMimetype.isEmpty()) || (targetMimetype != null && !targetMimetype.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"))); if (sourceMimetype != null && !sourceMimetype.isEmpty()) { group.addTriplePattern( new Triple( node, NodeFactory.createURI(ONTOLOGY_IRI + "sourceMimetype"), NodeFactory.createLiteral(sourceMimetype))); } if (targetMimetype != null && !targetMimetype.isEmpty()) { group.addTriplePattern( new Triple( node, NodeFactory.createURI(ONTOLOGY_IRI + "targetMimetype"), NodeFactory.createLiteral(targetMimetype))); } query.addElement(group); } return this; }
/** * Adds an output port type restriction to the query. * * @param provides the port type * @return this query */ public ComponentQuery addOutputPort(String provides) { if (provides != null && !provides.isEmpty()) { Node node = NodeFactory.createAnon(); ElementGroup group = new ElementGroup(); group.addTriplePattern( new Triple(wfNode, NodeFactory.createURI(WFDESC_IRI + "hasOutput"), node)); group.addTriplePattern( new Triple( node, NodeFactory.createURI(ONTOLOGY_IRI + "provides"), NodeFactory.createURI(provides))); query.addElement(group); } return this; }
/** * Adds a measure output port restriction to the query. * * @param relatedObject the object related to the measures * @param measure the measure * @return this query */ public ComponentQuery addMeasureOutputPort(String relatedObject, String measure) { if (measure != null && !measure.isEmpty()) { Node node = NodeFactory.createAnon(); ElementGroup group = new ElementGroup(); group.addTriplePattern( new Triple(wfNode, NodeFactory.createURI(WFDESC_IRI + "hasOutput"), node)); if (relatedObject != null && !relatedObject.isEmpty()) { group.addTriplePattern( new Triple( node, NodeFactory.createURI(ONTOLOGY_IRI + "relatesTo"), NodeFactory.createURI(ONTOLOGY_IRI + relatedObject))); } group.addTriplePattern( new Triple( node, NodeFactory.createURI(ONTOLOGY_IRI + "provides"), NodeFactory.createURI(measure))); query.addElement(group); } return this; }
/** Finishes the migration path to filter. */ private void finishMigrationPathFilter() { if (migrationPathTargetPattern != null && !migrationPathTargetPattern.isEmpty()) { Node migrationPath = NodeFactory.createAnon(); Node toMimetype = NodeFactory.createVariable("migrationPathTarget"); ElementGroup group = new ElementGroup(); group.addTriplePattern( new Triple(wfNode, NodeFactory.createURI(ONTOLOGY_IRI + "migrates"), migrationPath)); group.addTriplePattern( new Triple( migrationPath, NodeFactory.createURI(TYPE_IRI), NodeFactory.createURI(ONTOLOGY_IRI + "MigrationPath"))); group.addTriplePattern( new Triple( migrationPath, NodeFactory.createURI(ONTOLOGY_IRI + "targetMimetype"), toMimetype)); query.addElement(group); ElementFilter filter = new ElementFilter( new E_StrContains( new ExprVar(toMimetype), new NodeValueString(migrationPathTargetPattern))); query.addElementFilter(filter); } }