List of usage examples for org.apache.commons.collections15.multimap MultiHashMap put
public V put(K key, V value)
From source file:org.dataconservancy.dcs.index.rebuild.OrderedDcpEntitySource.java
private void createDataDU(String id, String[] parentCollections, String[] parentDUs) { DcsDeliverableUnit du = new DcsDeliverableUnit(); Dcp pkg = new Dcp(); du.setId(id);/*from w w w. j a v a 2 s . c om*/ du.setTitle("data DU " + id); for (String parentColl : parentCollections) { if (parentColl != null) { du.addCollection(new DcsCollectionRef(parentColl)); parentChildMap.put(parentColl, du); } } for (String parentDU : parentDUs) { if (parentDU != null) { du.addParent(new DcsDeliverableUnitRef(parentDU)); parentChildMap.put(parentDU, du); } } entities.put(id, du); /* Create a manifesation containing metadata describing this DU */ DcsFile duMetadataFile = createMetadataFileDescribing(du); MultiHashMap<DcsFile, DcsEntity> duMetadataFileMap = new MultiHashMap<DcsFile, DcsEntity>(); duMetadataFileMap.put(duMetadataFile, du); DcsManifestation duMetadataManifestation = createManifestation(du, duMetadataFileMap); /* * Create a manifestation containing a data file, and a metadata file * describing it */ DcsFile dataFile = createDataFile(); DcsFile dataMetadataFile = createMetadataFileDescribing(dataFile); MultiHashMap<DcsFile, DcsEntity> dataMetadataFileMap = new MultiHashMap<DcsFile, DcsEntity>(); dataMetadataFileMap.put(dataMetadataFile, dataFile); DcsManifestation dataManifestation = createManifestation(du, dataMetadataFileMap, dataFile); /* * Create a manifestation containing three metadata files: one * describing all parent collections, one describing all parent DU * collections, and one describing all parents together */ DcsFile collectionsMdFile = createMetadataFileDescribing(entities.get(parentCollections[0])); DcsFile duCollectionsMdFile = createMetadataFileDescribing(entities.get(parentDUs[0])); DcsFile comprehensiveMdFile = createMetadataFileDescribing(du); MultiHashMap<DcsFile, DcsEntity> collectionsMetadataFileMap = new MultiHashMap<DcsFile, DcsEntity>(); for (String collectionParent : parentCollections) { collectionsMetadataFileMap.put(collectionsMdFile, entities.get(collectionParent)); collectionsMetadataFileMap.put(comprehensiveMdFile, entities.get(collectionParent)); } for (String duParent : parentDUs) { collectionsMetadataFileMap.put(duCollectionsMdFile, entities.get(duParent)); collectionsMetadataFileMap.put(comprehensiveMdFile, entities.get(duParent)); } DcsManifestation collectionManifestation = createManifestation(du, collectionsMetadataFileMap); /* Finally, create an event for the whole darn thing */ DcsEvent event = createEvent("createDataDU", new DcsEntity[] { du, duMetadataManifestation, duMetadataFile, dataFile, dataMetadataFile, dataManifestation, collectionsMdFile, duCollectionsMdFile, comprehensiveMdFile, collectionManifestation }); addChldrenTo(du, duMetadataManifestation, dataManifestation, collectionManifestation); addChldrenTo(duMetadataManifestation, duMetadataFile); addChldrenTo(dataManifestation, dataFile, dataMetadataFile); addChldrenTo(collectionManifestation, collectionsMdFile, duCollectionsMdFile, comprehensiveMdFile); addTo(pkg, du, duMetadataManifestation, duMetadataFile, dataFile, dataMetadataFile, dataManifestation, collectionsMdFile, duCollectionsMdFile, comprehensiveMdFile, collectionManifestation, event); packages.add(pkg); }
From source file:org.nlp2rdf.corpusconversion.Tiger.java
private void addSyntax(Individual sentence, Result r) { OliaSyntaxOntologyConnector.SyntaxTree root = oliaSyntaxOntologyConnector.createSyntaxTreeRoot(sentence); MultiHashMap mhm = new MultiHashMap<String, OneLine>(); for (OneLine ol : oneEntry) { mhm.put(ol.parent, ol); }/*from ww w .j a v a 2 s.c om*/ OneLine currentLine = new OneLine(); currentLine.word = "#0"; currentLine.edge = "--"; processTree(currentLine, root, mhm, sentence); oliaSyntaxOntologyConnector.connect(r.model); //System.out.println(mhm); //System.exit(0); }
From source file:org.openanzo.combus.realtime.RealtimeUpdatePublisher.java
private MultiHashMap<URI, DestinationDatasetTracker> matchingDatasetTrackers(URI namedGraphUri) { MultiHashMap<URI, DestinationDatasetTracker> results = new MultiHashMap<URI, DestinationDatasetTracker>(); Collection<DestinationDatasetTracker> trackers = datasetTrackers.get(namedGraphUri); if (trackers != null) { for (DestinationDatasetTracker entry : trackers) { results.put(entry.userUri, entry); }/*w w w . j a va 2 s .c o m*/ } return results; }
From source file:org.openanzo.combus.realtime.RealtimeUpdatePublisher.java
private MultiHashMap<Destination, URI> byDestination(Collection<DestinationDatasetTracker> trackers) { MultiHashMap<Destination, URI> results = new MultiHashMap<Destination, URI>(); for (DestinationDatasetTracker entry : trackers) { results.put(entry.destination, entry.getTrackerURI()); }/*from www . j a v a 2 s .co m*/ return results; }
From source file:org.openanzo.datasource.nodecentric.internal.NodeCentricModelService.java
@Override protected QueryDataset resolveNamedDatasetInternal(IOperationContext context, URI namedDatasetUri) throws AnzoException { long total = System.currentTimeMillis(); DefaultQueryDataset uriSet = new DefaultQueryDataset(new TreeSet<URI>(), new TreeSet<URI>(), new TreeSet<URI>()); NodeCentricOperationContext connectionContext = null; boolean isMine = false; try {/*from w w w . j ava 2 s . c o m*/ if (context instanceof NodeCentricOperationContext) { connectionContext = (NodeCentricOperationContext) context; } else { connectionContext = datasource.getQueryContext(context); isMine = true; } Long id = connectionContext.getNodeLayout().fetchId(namedDatasetUri, connectionContext.getConnection()); if (id == null) { return uriSet; } namedGraphPredicateId = connectionContext.getNodeLayout().store(Dataset.namedGraphProperty, connectionContext.getConnection(), 0); defaultGraphPredicateId = connectionContext.getNodeLayout().store(Dataset.defaultGraphProperty, connectionContext.getConnection(), 0); defaultNamedGraphPredicateId = connectionContext.getNodeLayout() .store(Dataset.defaultNamedGraphProperty, connectionContext.getConnection(), 0); boolean includeMetadataGraphs = false; if (!namedDatasetUri.equals(Constants.GRAPHS.GRAPHS_DATASET) && !namedDatasetUri.equals(Constants.GRAPHS.METADATA_GRAPHS_DATASET)) { Collection<Statement> stmts = find(connectionContext, namedDatasetUri, Dataset.includeMetadataGraphsProperty, null, new URI[] { namedDatasetUri }); if (stmts != null && stmts.size() > 0) { Statement stmt = stmts.iterator().next(); if (stmt.getObject() instanceof TypedLiteral) { Object obj = ((TypedLiteral) stmt.getObject()).getNativeValue(); if (obj instanceof Boolean) { includeMetadataGraphs = ((Boolean) obj).booleanValue(); } } } } HashSet<Long> ids = new HashSet<Long>(); MultiHashMap<Long, Long> sets = new MultiHashMap<Long, Long>(); boolean doNr = true; long start = System.currentTimeMillis(); for (ResolveDatasetResult result : StatementRdbWrapper.resolveDataset( connectionContext.getStatementProvider(), connectionContext.getConnection(), id, id, namedGraphPredicateId.toString(), defaultGraphPredicateId.toString(), defaultNamedGraphPredicateId.toString())) { doNr = false; ids.add(result.getObject()); sets.put(result.getPredicateId(), result.getObject()); } if (log.isInfoEnabled()) { log.info(LogUtils.RDB_MARKER, "[RESOLVE NAMED DATASET] {}:{}", Integer.toString(sets.size()), Long.toString(System.currentTimeMillis() - start)); } if (doNr) { start = System.currentTimeMillis(); for (ResolveDatasetNRResult result : StatementRdbWrapper.resolveDatasetNR( connectionContext.getStatementProvider(), connectionContext.getConnection(), id, id, namedGraphPredicateId.toString(), defaultGraphPredicateId.toString(), defaultNamedGraphPredicateId.toString())) { doNr = false; ids.add(result.getObject()); sets.put(result.getPredicateId(), result.getObject()); } if (log.isInfoEnabled()) { log.info(LogUtils.RDB_MARKER, "[RESOLVE NAMEDNR DATASET] {}:{}", Integer.toString(sets.size()), Long.toString(System.currentTimeMillis() - start)); } } Map<Long, Value> values = connectionContext.getNodeLayout().resolveStoredIds(ids, connectionContext.getConnection()); Collection<Long> ngIds = sets.get(namedGraphPredicateId); if (ngIds != null) { for (Long gid : ngIds) { Value uri = values.get(gid); if (uri != null) { if (uri instanceof URI) { uriSet.namedGraphs.add((URI) uri); if (includeMetadataGraphs && !UriGenerator.isMetadataGraphUri((URI) uri)) { uriSet.namedGraphs.add(UriGenerator.generateMetadataGraphUri((URI) uri)); } } } } } ngIds = sets.get(defaultGraphPredicateId); if (ngIds != null) { for (Long gid : ngIds) { Value uri = values.get(gid); if (uri != null) { if (uri instanceof URI) { uriSet.defaultGraphs.add((URI) uri); if (includeMetadataGraphs && !UriGenerator.isMetadataGraphUri((URI) uri)) { uriSet.defaultGraphs.add(UriGenerator.generateMetadataGraphUri((URI) uri)); } } } } } ngIds = sets.get(defaultNamedGraphPredicateId); if (ngIds != null) { for (Long gid : ngIds) { Value uri = values.get(gid); if (uri != null) { if (uri instanceof URI) { uriSet.namedGraphs.add((URI) uri); uriSet.defaultGraphs.add((URI) uri); if (includeMetadataGraphs && !uri.toString().startsWith(Constants.NAMESPACES.METADATAGRAPH_PREFIX)) { URI muri = UriGenerator.generateMetadataGraphUri((URI) uri); uriSet.defaultGraphs.add(muri); uriSet.namedGraphs.add(muri); } } } } } if (log.isInfoEnabled()) { log.info(LogUtils.RDB_MARKER, "[RESOLVE NAMED DATASET TOTAL] {}/{}:{}", new Object[] { Integer.toString(uriSet.defaultGraphs.size()), Integer.toString(uriSet.namedGraphs.size()), Long.toString(System.currentTimeMillis() - total) }); } return uriSet; } finally { if (connectionContext != null && isMine) { datasource.returnQueryContext(connectionContext); } } }
From source file:org.openanzo.jet.services.ServicesRestListenerTemplate.java
/** * Generate source code// www. j ava 2s . c om * @param argument source for template * @return Return generated source */ public String generate(Object argument) { final StringBuffer stringBuffer = new StringBuffer(); stringBuffer.append(TEXT_1); stringBuffer.append(TEXT_2); stringBuffer.append("$".toString()); stringBuffer.append(TEXT_3); stringBuffer.append("$".toString()); stringBuffer.append(TEXT_4); stringBuffer.append("$".toString()); stringBuffer.append(TEXT_5); stringBuffer.append("$".toString()); stringBuffer.append(TEXT_6); ServiceWrapper wrapper = (ServiceWrapper) argument; Service service = wrapper.service; stringBuffer.append(TEXT_7); stringBuffer.append(WikiFormatUtils.convertPackageDirectory(wrapper.task.getRestPackage())); stringBuffer.append(TEXT_8); java.util.regex.Pattern objectPattern = java.util.regex.Pattern .compile("^/anzo/([a-zA-Z]*)?((\\((\\?[a-zA-Z]*)\\))?(/(([a-zA-Z]*)))?)?$"); stringBuffer.append(TEXT_9); if (service.getPropertyValue(DC.TITLE) != null) { stringBuffer.append(JastorUtils.getStingValue(service.getPropertyValue(DC.TITLE))); } stringBuffer.append(TEXT_10); stringBuffer.append(service.getName()); stringBuffer.append(TEXT_11); stringBuffer.append(service.getName()); stringBuffer.append(TEXT_12); stringBuffer.append(WikiFormatUtils.convertPackageDirectory(wrapper.task.getStatsPackage())); stringBuffer.append(TEXT_13); stringBuffer.append(service.getName()); stringBuffer.append(TEXT_14); stringBuffer.append(WikiFormatUtils.convertPackageDirectory(wrapper.task.getInterfacePackage())); stringBuffer.append(TEXT_15); stringBuffer.append(service.getName()); stringBuffer.append(TEXT_16); stringBuffer.append(service.getName()); stringBuffer.append(TEXT_17); java.util.HashMap<String, java.util.HashMap<RequestType, java.util.Collection<RestOperation>>> methods = new java.util.HashMap<String, java.util.HashMap<RequestType, java.util.Collection<RestOperation>>>(); java.util.HashSet<String> operationNames = new java.util.HashSet<String>(); for (Operation operation : JastorUtils.sortByTitle(service.getOperation())) { String opTemplate = operation.getRestEndpoint(); java.util.regex.Matcher match = objectPattern.matcher(opTemplate); if (match.matches()) { String method = null; String op = null; if (match.groupCount() > 0 && match.group(1) != null) { method = match.group(1); } if (match.groupCount() > 6 && match.group(6) != null) { op = match.group(6); } if (op != null && !operationNames.contains(op)) { operationNames.add(op); stringBuffer.append(TEXT_18); stringBuffer.append(op); stringBuffer.append(TEXT_19); stringBuffer.append(org.openanzo.rdf.utils.WikiFormatUtils.formatConstantString(op)); stringBuffer.append(TEXT_20); stringBuffer.append(op); stringBuffer.append(TEXT_21); } java.util.HashMap<RequestType, java.util.Collection<RestOperation>> typeMaps = methods .get("METHOD_" + org.openanzo.rdf.utils.WikiFormatUtils.formatConstantString(method)); if (typeMaps == null) { java.util.HashMap<RequestType, java.util.Collection<RestOperation>> maps = new java.util.HashMap<RequestType, java.util.Collection<RestOperation>>(); java.util.Collection<RestOperation> ops = new java.util.TreeSet<RestOperation>(); ops.add(new RestOperation( (op != null) ? op : org.openanzo.rdf.utils.SerializationConstants.NULL_OP, operation, (match.matches() && match.groupCount() > 4 && match.group(4) != null))); maps.put(RequestType.valueOf(operation.getRestType()), ops); stringBuffer.append(TEXT_22); stringBuffer.append(method); stringBuffer.append(TEXT_23); stringBuffer.append(org.openanzo.rdf.utils.WikiFormatUtils.formatConstantString(method)); stringBuffer.append(TEXT_24); stringBuffer.append(method); stringBuffer.append(TEXT_25); methods.put("METHOD_" + org.openanzo.rdf.utils.WikiFormatUtils.formatConstantString(method), maps); } else { java.util.Collection<RestOperation> ops = typeMaps .get(RequestType.valueOf(operation.getRestType())); if (ops == null) { ops = new java.util.TreeSet<RestOperation>(); typeMaps.put(RequestType.valueOf(operation.getRestType()), ops); } ops.add(new RestOperation( (op != null) ? op : org.openanzo.rdf.utils.SerializationConstants.NULL_OP, operation, (match.matches() && match.groupCount() > 4 && match.group(4) != null))); } } else { java.util.HashMap<RequestType, java.util.Collection<RestOperation>> typeMaps = methods .get(SerializationConstants.NULL_OP); if (typeMaps == null) { java.util.HashMap<RequestType, java.util.Collection<RestOperation>> maps = new java.util.HashMap<RequestType, java.util.Collection<RestOperation>>(); java.util.Collection<RestOperation> ops = new java.util.TreeSet<RestOperation>(); ops.add(new RestOperation(SerializationConstants.NULL_OP, operation, (match.matches() && match.groupCount() > 4 && match.group(4) != null))); maps.put(RequestType.valueOf(operation.getRestType()), ops); methods.put(SerializationConstants.NULL_OP, maps); } else { java.util.Collection<RestOperation> ops = typeMaps .get(RequestType.valueOf(operation.getRestType())); if (ops == null) { ops = new java.util.TreeSet<RestOperation>(); typeMaps.put(RequestType.valueOf(operation.getRestType()), ops); } ops.add(new RestOperation(SerializationConstants.NULL_OP, operation, (match.matches() && match.groupCount() > 4 && match.group(4) != null))); } } } stringBuffer.append(TEXT_26); stringBuffer.append(service.getName()); stringBuffer.append(TEXT_27); stringBuffer.append(service.getName()); stringBuffer.append(TEXT_28); stringBuffer.append(WikiFormatUtils.convertPackageDirectory(wrapper.task.getInterfacePackage())); stringBuffer.append(TEXT_29); stringBuffer.append(service.getName()); stringBuffer.append(TEXT_30); stringBuffer.append(service.getName()); stringBuffer.append(TEXT_31); stringBuffer.append(WikiFormatUtils.convertPackageDirectory(wrapper.task.getStatsPackage())); stringBuffer.append(TEXT_32); stringBuffer.append(service.getName()); stringBuffer.append(TEXT_33); MultiHashMap<String, String> methodOps = new MultiHashMap<String, String>(); for (java.util.Map.Entry<String, java.util.HashMap<RequestType, java.util.Collection<RestOperation>>> entry : methods .entrySet()) { for (java.util.Collection<RestOperation> ops : entry.getValue().values()) { for (RestOperation op : ops) { if (!methodOps.containsValue( entry.getKey().equals(SerializationConstants.NULL_OP) ? "SerializationConstants.NULL_OP" : entry.getKey(), (op.operationName != null && !op.operationName.equals(SerializationConstants.NULL_OP)) ? "OP_" + org.openanzo.rdf.utils.WikiFormatUtils .formatConstantString(op.operationName) : "org.openanzo.rdf.utils.SerializationConstants.NULL_OP")) { methodOps.put( entry.getKey().equals(SerializationConstants.NULL_OP) ? "org.openanzo.rdf.utils.SerializationConstants.NULL_OP" : entry.getKey(), (op.operationName != null && !op.operationName.equals(SerializationConstants.NULL_OP)) ? "OP_" + org.openanzo.rdf.utils.WikiFormatUtils .formatConstantString(op.operationName) : "org.openanzo.rdf.utils.SerializationConstants.NULL_OP"); } } } } for (java.util.Map.Entry<String, java.util.Collection<String>> entry : methodOps.entrySet()) { for (String opp : entry.getValue()) { stringBuffer.append(TEXT_34); stringBuffer.append(entry.getKey()); stringBuffer.append(TEXT_35); stringBuffer.append(opp); stringBuffer.append(TEXT_36); } } stringBuffer.append(TEXT_37); stringBuffer.append(WikiFormatUtils.convertPackageDirectory(wrapper.task.getStatsPackage())); stringBuffer.append(TEXT_38); stringBuffer.append(service.getName()); stringBuffer.append(TEXT_39); boolean firstMethod = true; for (String key : methods.keySet()) { boolean firstRequestType = true; java.util.HashMap<RequestType, java.util.Collection<RestOperation>> ops = methods.get(key); stringBuffer.append(TEXT_40); if (!firstMethod) { stringBuffer.append(TEXT_41); } else { stringBuffer.append(TEXT_42); } stringBuffer.append(TEXT_43); if (SerializationConstants.NULL_OP.equals(key)) { stringBuffer.append(TEXT_44); } else { stringBuffer.append(key); stringBuffer.append(TEXT_45); } stringBuffer.append(TEXT_46); for (java.util.Map.Entry<RequestType, java.util.Collection<RestOperation>> entry : ops.entrySet()) { if (!firstRequestType) { stringBuffer.append(TEXT_47); } firstRequestType = false; stringBuffer.append(TEXT_48); stringBuffer.append(entry.getKey()); stringBuffer.append(TEXT_49); boolean firstOp = true; for (RestOperation restOperation : entry.getValue()) { Operation operation = restOperation.operation; Parameter result = null; boolean resultHasDefaultFormat = false; Iterator<Parameter> results = operation.getResult().iterator(); if (results.hasNext()) { result = results.next(); if (result != null) { resultHasDefaultFormat = result.getType().getDefaultJMSFormat() != null || result.getType().getDefaultRestFormat() != null || result.getType().getDefaultWSFormat() != null; } } Parameter parameters[] = new Parameter[8]; String parameterName[] = new String[8]; String javaType[] = new String[8]; String type[] = new String[8]; String defaultValue[] = new String[8]; boolean nullAllowed[] = new boolean[8]; String defaultFormat[] = new String[8]; String serializer[] = new String[8]; int propertyLocation[] = new int[8]; int readerParam = -1; if (operation.getRequestParameter0() != null) { parameters[0] = operation.getRequestParameter0(); } if (operation.getRequestParameter1() != null) { parameters[1] = operation.getRequestParameter1(); } if (operation.getRequestParameter2() != null) { parameters[2] = operation.getRequestParameter2(); } if (operation.getRequestParameter3() != null) { parameters[3] = operation.getRequestParameter3(); } if (operation.getRequestParameter4() != null) { parameters[4] = operation.getRequestParameter4(); } if (operation.getRequestParameter5() != null) { parameters[5] = operation.getRequestParameter5(); } if (operation.getRequestParameter6() != null) { parameters[6] = operation.getRequestParameter6(); } if (operation.getRequestParameter7() != null) { parameters[7] = operation.getRequestParameter7(); } for (int i = 0; i < 8; i++) { if (parameters[i] != null) { parameterName[i] = parameters[i].getName(); if (parameters[i].getType() != null) { type[i] = javaType[i] = parameters[i].getType().getJavaType(); defaultValue[i] = parameters[i].getType().getDefaultValue(); serializer[i] = parameters[i].getType().getSerializer(); String location = parameters[i].getParameterLocation(); if (location == null) { propertyLocation[i] = 0; } else if ("body".equals(location)) { propertyLocation[i] = 1; } else if ("parameter".equals(location)) { propertyLocation[i] = 0; } else if ("transport".equals(location)) { propertyLocation[i] = 2; } else if ("callbackHandler".equals(location)) { propertyLocation[i] = -1; } Boolean nullAllowedBoolean = parameters[i].getNullAllowed(); nullAllowed[i] = (nullAllowedBoolean != null) ? nullAllowedBoolean.booleanValue() : true; defaultFormat[i] = (parameters[i].getType().getDefaultJMSFormat() != null) ? parameters[i].getType().getDefaultJMSFormat().getJavaType() : null; } } } String opTemplate = operation.getRestEndpoint(); java.util.regex.Matcher match = objectPattern.matcher(opTemplate); int uriParam = -1; if (match.matches()) { String param = null; if (match.groupCount() > 4 && match.group(4) != null) { param = match.group(4); if (param.startsWith("?")) { param = param.substring(1); for (int i = 0; i < 8; i++) { if (parameterName[i] != null && parameterName[i].equals(param)) { uriParam = i; } } } } } stringBuffer.append(TEXT_50); if (!firstOp) { stringBuffer.append(TEXT_51); } else { stringBuffer.append(TEXT_52); } stringBuffer.append(TEXT_53); if (restOperation.operationName == SerializationConstants.NULL_OP) { stringBuffer.append(TEXT_54); } else { stringBuffer.append("OP_" + org.openanzo.rdf.utils.WikiFormatUtils .formatConstantString(restOperation.operationName)); stringBuffer.append(TEXT_55); } if (uriParam > -1) { stringBuffer.append(TEXT_56); } stringBuffer.append(TEXT_57); stringBuffer.append(WikiFormatUtils.capFirstLetter(operation.getName())); stringBuffer.append(TEXT_58); for (int i = 0; i < 8; i++) { Parameter parameter = parameters[i]; if (defaultFormat[i] != null) { stringBuffer.append(TEXT_59); stringBuffer.append(parameterName[i]); stringBuffer.append(TEXT_60); stringBuffer.append( WikiFormatUtils.convertPackageDirectory(wrapper.task.getInterfacePackage())); stringBuffer.append(TEXT_61); stringBuffer.append(service.getName()); stringBuffer.append(TEXT_62); stringBuffer.append( org.openanzo.rdf.utils.WikiFormatUtils.formatConstantString(parameterName[i])); stringBuffer.append(TEXT_63); stringBuffer.append(parameterName[i]); stringBuffer.append(TEXT_64); stringBuffer.append(parameterName[i]); stringBuffer.append(TEXT_65); stringBuffer.append(parameterName[i]); stringBuffer.append(TEXT_66); stringBuffer.append(parameterName[i]); stringBuffer.append(TEXT_67); stringBuffer.append(parameterName[i]); stringBuffer.append(TEXT_68); stringBuffer.append(parameterName[i]); stringBuffer.append(TEXT_69); stringBuffer.append(defaultFormat[i]); stringBuffer.append(TEXT_70); } if (parameter != null && propertyLocation[i] > -1 && i != uriParam) { if (propertyLocation[i] == 1) { readerParam = i; stringBuffer.append(TEXT_71); stringBuffer.append(parameterName[i]); stringBuffer.append(TEXT_72); } else { stringBuffer.append(TEXT_73); stringBuffer.append(parameterName[i]); stringBuffer.append(TEXT_74); stringBuffer.append(WikiFormatUtils .convertPackageDirectory(wrapper.task.getInterfacePackage())); stringBuffer.append(TEXT_75); stringBuffer.append(service.getName()); stringBuffer.append(TEXT_76); stringBuffer.append(org.openanzo.rdf.utils.WikiFormatUtils .formatConstantString(parameterName[i])); stringBuffer.append(TEXT_77); stringBuffer.append(javaType[i]); stringBuffer.append(TEXT_78); stringBuffer.append(parameterName[i]); stringBuffer.append(TEXT_79); if (nullAllowed[i]) { stringBuffer.append(TEXT_80); stringBuffer.append(parameterName[i]); stringBuffer.append(TEXT_81); } stringBuffer.append(serializer[i]); stringBuffer.append(TEXT_82); stringBuffer.append(WikiFormatUtils .convertPackageDirectory(wrapper.task.getInterfacePackage())); stringBuffer.append(TEXT_83); stringBuffer.append(service.getName()); stringBuffer.append(TEXT_84); stringBuffer.append(org.openanzo.rdf.utils.WikiFormatUtils .formatConstantString(parameterName[i])); stringBuffer.append(TEXT_85); if (defaultFormat[i] != null) { stringBuffer.append(parameterName[i]); stringBuffer.append(TEXT_86); } else { stringBuffer.append(TEXT_87); } stringBuffer.append(TEXT_88); if (nullAllowed[i]) { stringBuffer.append(TEXT_89); } stringBuffer.append(TEXT_90); } } } if (uriParam > -1) { stringBuffer.append(TEXT_91); stringBuffer.append(javaType[uriParam]); stringBuffer.append(TEXT_92); stringBuffer.append(parameterName[uriParam]); stringBuffer.append(TEXT_93); stringBuffer.append(serializer[uriParam]); stringBuffer.append(TEXT_94); } stringBuffer.append(TEXT_95); stringBuffer.append(service.getName()); stringBuffer.append(TEXT_96); stringBuffer.append(operation.getName()); stringBuffer.append(TEXT_97); for (int i = 0; i < 8; i++) { if (parameters[i] != null && propertyLocation[i] > -1) { stringBuffer.append(TEXT_98); stringBuffer.append(parameterName[i]); } if (defaultFormat[i] != null && readerParam == i) { stringBuffer.append(TEXT_99); stringBuffer.append(parameterName[readerParam]); stringBuffer.append(TEXT_100); } } stringBuffer.append(TEXT_101); if (resultHasDefaultFormat) { stringBuffer.append(TEXT_102); } stringBuffer.append(TEXT_103); stringBuffer.append(WikiFormatUtils.capFirstLetter(operation.getName())); stringBuffer.append(TEXT_104); firstOp = false; } stringBuffer.append(TEXT_105); } stringBuffer.append(TEXT_106); firstMethod = false; } stringBuffer.append(TEXT_107); stringBuffer.append(TEXT_108); return stringBuffer.toString(); }
From source file:org.openanzo.rdf.utils.StatementUtils.java
/** * Get an Collection for the members of the RDFList construct provided * //from w w w .j a va2 s . co m * @param list * Resource of RDFList object * @param dataset * Dataset containing data * @return Collection containing data contained within RDFContainer */ public static MultiMap<URI, Value> getCollectionMembers(Resource list, IDataset dataset) { // NO_UCD MultiHashMap<URI, Value> statements = new MultiHashMap<URI, Value>(); if (dataset.contains(list, RDF.first, null) && dataset.contains(list, RDF.rest, null)) { Collection<Statement> firstStatements = dataset.find(list, RDF.first, null); if (!firstStatements.isEmpty()) { Statement first = firstStatements.iterator().next(); if (!statements.containsValue(first.getNamedGraphUri(), first.getObject())) { statements.put(first.getNamedGraphUri(), first.getObject()); } } Collection<Statement> restStatements = dataset.find(list, RDF.rest, null); if (!restStatements.isEmpty()) { Statement rest = restStatements.iterator().next(); if (!statements.containsValue(rest.getNamedGraphUri(), rest.getObject()) && rest.getObject() instanceof Resource) { statements.putAll(getCollectionMembers((Resource) rest.getObject(), dataset)); } } } return statements; }