File | Date | Author | Commit |
---|---|---|---|
META-INF | 2015-01-02 | miguelnunes | [1cb872] Merge branch 'develop' |
bundle | 2015-01-05 | miguelnunes | [45c5c2] Started to adapt for cli. CLI class still to write |
cli | 2015-01-06 | miguelnunes | [e924cc] Developed CLI class. Now working |
src | 2015-01-06 | miguelnunes | [e924cc] Developed CLI class. Now working |
.gitignore | 2014-05-26 | miguelnunes | [a11d54] Changed gitignore |
Readme.md | 2015-01-14 | miguelnunes | [8f9c38] Updated Readme |
build.properties | 2014-05-26 | miguelnunes | [97db3c] First commit |
pom.xml | 2015-01-06 | miguelnunes | [e924cc] Developed CLI class. Now working |
Read Me
Perl Modules Converter
Perl Modules Converter converts the JSON output from the Perl Modules Extractor develop by Nuno Martins and converts it to Context, required for further preservation.
How to get the code
git clone https://opensourceprojects.eu/git/p/timbus/context-model/converters/json-xml/perl-modules-converter timbus-context-model-converters-json-xml-perl-modules-converter
Install Requirements
Building the code
This converter is split into two different modules:
1. Bundle - To be used in the Context Population Framework
2. Cli - To be used through command-line
Apache Maven is used to manage dependencies and build the project, and all that's needed to successfully build the project is running the following command in the base directory:
1 | mvn clean package |
This command will freshly create a target subdirectory in both cli and bundle directories and place the output jar files there.
Running the cli modules
A simple example on running this module with a previous Perl Modules extraction is running the following command in the cli base directory:
1 | java -jar perl-modules-converter-cli-1.0-SNAPSHOT.jar --json exampleextraction.json -f RDF |
This command requests a conversion from the exampleextraction.json file and will create a file within the current directory with the output directory. Further options are:
- -d,--directory - Output directory
- -f,--format (RDF|OWL) - Output format
- -h,--help - Shows help (no arguments)
- --json - Input JSON file(s)
- -n
- --dont-save - Does not save output to file (no arguments)
Running the bundle module
The bundle needs to be deployed in the Virgo container. A tutorial on how to install Virgo and deploy artefacts, including the usage of converters can be found here
Note: A typical extraction within the Context Population Framework will encapsulate the result with the following header:
1 2 3 4 5 6 7 8 | { "format": { "multiple": false, "id": "d7f5e025-9daa-11e3-ab53-e3e54faab75e" }, "UUID": "923fdec6-2ebf-11e4-bc19-ce2b29c0121b", "result": { ... ... ... |
The converter expects solely the result JSON Object. Any other format or header will result in an error.
Format UUID
This version of Perl Modules Converter accepts the format d7f5e025-9daa-11e3-ab53-e3e54faab75e
Required input
The common formating for an extraction includes the name of the extractor in question, a UUID from the extraction and a format. This format, as showed below, is a JSON Object displaying the format UUID (section above) and a boolean to indicate whether the result contains multiple extractions or not. Cases in which this is true are the Extractor Wrappers.
An example of an individual extraction is shown below.
1 2 3 4 5 6 7 8 | { "extractor" : "Perl Modules Extractor", "format" : { "id" : "d7f5e025-9daa-11e3-ab53-e3e54faab75e", "multiple" : false }, "UUID" : "91dbaf55-b01c-11e3-9422-a58c1d99206b" } |
NOTE: Whereas the extractor name is optional, conversion format is mandatory. This converter will NOT be visible to the Converters API unless the format is provided.
Expected output
This module converts from JSON to OWL, more specifically to DIO and the CUDF DSO. All main dependencies are stored as CUDF Packages and each dependency is then represented by a VersionedPackage and connected to the main package by the realizedBy property. This connection includes other properties such as the version comparator.
When a Perl Module provides others, these are represented as VirtualPackages and connected to the main Package by the provides property.
Author
Miguel Gama Nunes miguel.nunes@caixamagica.pt
License
Copyright (c) 2014, Caixa Magica Software Lda (CMS).
The work has been developed in the TIMBUS Project and the above-mentioned are Members of the TIMBUS Consortium.
TIMBUS is supported by the European Union under the 7th Framework Programme for research and technological development and demonstration activities (FP7/2007-2013) under grant agreement no. 269940.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at: http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTIBITLY, or FITNESS FOR A PARTICULAR PURPOSE. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law or agreed to in writing, shall any Contributor be liable for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work.
See the License for the specific language governing permissions and limitation under the License.