• It's Saturday morning and I'm in a dreadful mood because my coffee machine is giving me terrible coffee. I know I need to descale it but I don't know how and the manual is in one of the boxes labeled "Misc." that have been sitting unopened on the top shelf of my cupboard since I moved here five years ago. So I grab my phone and... ? --> The product manual is stored as PDF file in the OMM. So we want to retrieve the manual blocks containing the PDF file. The primary identifier of the object memory must be known in advance in order to execute this code snipped, e.g. by QR code via camera and parser software // CODE EXAMPLE ------------------------------------------------------- var omm = new OMM('http://www.my-omm-server.com/memory/id12345'); // primary ID var fittingBlock = null; // two possibilities to retrieve fittingBlock containing information // about product manual // 1.) retrieve all blocks and search for fitting block with code ----- var ommBlocks = omm.getAllBlocks(); for(i = 0; i < ommBlocks.lenght; i++) { var currentBlock = ommBlocks[i]; if (currentBlock.getFormat().getValue() == 'application/pdf' && currentBlock.getType() == 'http://purl.org/dc/dcmitype/Text' && currentBlock.getSubject().existsTag('manual')) { fittingBlock = currentBlock; break; } } // END 1.) ------------------------------------------------------------ // or 2.) search for fitting block via query -------------------------- var filter = new OMMFilter(); filter.add(MetaDataType.Format, 'application/pdf'); filter.add(MetaDataType.Type, 'http://purl.org/dc/dcmitype/Text'); filter.add(MetaDataType.SubjectTag, 'manual'); fittingBlock = omm.getBlockWithMetadata(filter); // END 2.) ------------------------------------------------------------ if (fittingBlock != null) { var pdfFileAsByteArray = fittingBlock.getPayload(); // execute PDF viewer with pdfFileAsByteArray } // CODE EXAMPLE ------------------------------------------------------- • I'm an engineer looking for microfissures on an aeroplane and I see a pattern emerge that might indicate improper screwing. I want to review the torque applied to the seventeen screws in this area over the past three years of maintenance. So I grab my tablet and... ? --> Torque information is stored in a separate block for each maintenance task. So we want to retrieve all maintenance blocks with torque information within the last 3 years. The primary identifier of the object memory must be known in advance in order to execute this code snipped, e.g. by database access // CODE EXAMPLE ------------------------------------------------------- var omm = new OMM('http://www.my-omm-server.com/memory/id67890'); var fittingBlocks = new Array(); var lastThreeYears = newDate.getTime(); lastThreeYears.setFullYear(new Date().getFullYear() - 3); var threeYearsAgo = lastThreeYears.getTime(); // two possibilities to retrieve fittingBlocks containing information // about screw torque infomation // 1.) retrieve all blocks and search for fitting block with code ----- var ommBlocks = omm.getAllBlocks(); for(i = 0; i < ommBlocks.lenght; i++) { var currentBlock = ommBlocks[i]; if (currentBlock.getCreation().getDate() >= threeYearsAgo && currentBlock.getFormat().getValue() == 'application/xml' && currentBlock.getSubject().existsTag('maintenance.torque')) { fittingBlocks[fittingBlocks.length] = currentBlock; break; } } // END 1.) ------------------------------------------------------------ // or 2.) search for fitting block via query -------------------------- var filter = new OMMFilter(); filter.add(MetaDataType.CreationDateAfter, threeYearsAgo); filter.add(MetaDataType.Format, 'application/pdf'); filter.add(MetaDataType.SubjectTag, 'maintenance.torque'); fittingBlocks = omm.getBlocksWithMetadata(filter); // END 2.) ------------------------------------------------------------ if (fittingBlocks != null && fittingBlocks.length > 0) { for(int k = 0; k < fittingBlocks.length; k++) { var data = fittingBlocks[k].getPayload(); // handle log data stored in this block (== data) with your code } } // CODE EXAMPLE -------------------------------------------------------