<commit_before>/**
 * Copyright (c) 2011 Source Auditor Inc.
 *
 *   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.
 *   See the License for the specific language governing permissions and
 *   limitations under the License.
 *
 */
package org.spdx.tools;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.StringReader;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;

import org.spdx.compare.LicenseCompareHelper;
import org.spdx.compare.SpdxCompareException;
import org.spdx.html.InvalidLicenseTemplateException;
import org.spdx.licensexml.XmlLicenseProvider;
import org.spdx.rdfparser.InvalidSPDXAnalysisException;
import org.spdx.rdfparser.license.ISpdxListedLicenseProvider;
import org.spdx.rdfparser.license.LicenseException;
import org.spdx.rdfparser.license.LicenseRestrictionException;
import org.spdx.rdfparser.license.SpdxListedLicense;
import org.spdx.rdfparser.license.SpdxListedLicenseException;
import org.spdx.spdxspreadsheet.SPDXLicenseSpreadsheet;
import org.spdx.spdxspreadsheet.SPDXLicenseSpreadsheet.DeprecatedLicenseInfo;
import org.spdx.tools.licensegenerator.FsfLicenseDataParser;
import org.spdx.tools.licensegenerator.ILicenseFormatWriter;
import org.spdx.tools.licensegenerator.ILicenseTester;
import org.spdx.tools.licensegenerator.LicenseHtmlFormatWriter;
import org.spdx.tools.licensegenerator.LicenseJsonFormatWriter;
import org.spdx.tools.licensegenerator.LicenseMarkdownFormatWriter;
import org.spdx.tools.licensegenerator.LicenseRdfFormatWriter;
import org.spdx.tools.licensegenerator.LicenseRdfaFormatWriter;
import org.spdx.tools.licensegenerator.LicenseTemplateFormatWriter;
import org.spdx.tools.licensegenerator.LicenseTextFormatWriter;
import org.spdx.tools.licensegenerator.SimpleLicenseTester;
import org.spdx.tools.licensegenerator.SpdxWebsiteFormatWriter;
import org.spdx.spdxspreadsheet.SpreadsheetException;

import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import com.google.common.io.Files;

import au.com.bytecode.opencsv.CSVReader;

/**
 * Converts input license text and metadata into various output formats.
 * 
 * Supported input formats:
 *  - Spreadsheet - spreadsheet used by the SPDX legal team including associated text files
 *  - Directory of XML files - Files following the SPDX legal team license format
 * 
 * Supported output formats:
 *  - Text - license text
 *  - Templates - license templates as defined by the SPDX legal team matching guidelines
 *  - JSON - Json format as defined in https://github.com/spdx/license-list-data
 *  - RDFa - HTML with RDFa tags as defined in https://github.com/spdx/license-list-data
 *  - RDF NT - RDF NT format defined by the SPDX Spec
 *  - RDF XML - RDF XML format defined by the SPDX Spec
 *  - RDF Turtle - RDF Turtle format defined by the SPDX Spec
 *  - Website - the content for the website available at https://spdx.org/licenses
 *  
 *  Output generated by this tool can be found at https://github.com/spdx/license-list-data and on the 
 *  spdx.org licenses website
 *  
 *  To add a new output format, create a class supporting the ILicenseFormatWriter interface and add it
 *  to the writers list.
 *  
 * @author <NAME>
 *
 */
public class LicenseRDFAGenerator {
		
	static final Set<Character> INVALID_TEXT_CHARS = Sets.newHashSet();
	
	static {
		INVALID_TEXT_CHARS.add('\uFFFD');
	}
	static int MIN_ARGS = 2;
	static int MAX_ARGS = 5;

	static final int ERROR_STATUS = 1;
	static final int WARNING_STATUS = 64;
	static final String CSS_TEMPLATE_FILE = "resources/screen.css";
	static final String CSS_FILE_NAME = "screen.css";
	static final String SORTTABLE_JS_FILE = "resources/sorttable.js";
	static final String SORTTABLE_FILE_NAME = "sorttable.js";
	static final String TEXT_FOLDER_NAME = "text";
	static final String TEMPLATE_FOLDER_NAME = "template";
	static final String HTML_FOLDER_NAME = "html";
	static final String RDFA_FOLDER_NAME = "rdfa";
	static final String JSON_FOLDER_NAME = "json";
	private static final String WEBSITE_FOLDER_NAME = "website";
	private static final String RDFXML_FOLDER_NAME = "rdfxml";
	private static final String RDFTURTLE_FOLDER_NAME = "rdfturtle";
	private static final String RDFNT_FOLDER_NAME = "rdfnt";
	private static final String TABLE_OF_CONTENTS_FILE_NAME = "licenses.md";
	<commit_msg>Fix the maximum number of arguments for the LicenseRDFAGenerator<commit_after>/**
 * Copyright (c) 2011 Source Auditor Inc.
 *
 *   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.
 *   See the License for the specific language governing permissions and
 *   limitations under the License.
 *
 */
package org.spdx.tools;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.StringReader;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;

import org.spdx.compare.LicenseCompareHelper;
import org.spdx.compare.SpdxCompareException;
import org.spdx.html.InvalidLicenseTemplateException;
import org.spdx.licensexml.XmlLicenseProvider;
import org.spdx.rdfparser.InvalidSPDXAnalysisException;
import org.spdx.rdfparser.license.ISpdxListedLicenseProvider;
import org.spdx.rdfparser.license.LicenseException;
import org.spdx.rdfparser.license.LicenseRestrictionException;
import org.spdx.rdfparser.license.SpdxListedLicense;
import org.spdx.rdfparser.license.SpdxListedLicenseException;
import org.spdx.spdxspreadsheet.SPDXLicenseSpreadsheet;
import org.spdx.spdxspreadsheet.SPDXLicenseSpreadsheet.DeprecatedLicenseInfo;
import org.spdx.tools.licensegenerator.FsfLicenseDataParser;
import org.spdx.tools.licensegenerator.ILicenseFormatWriter;
import org.spdx.tools.licensegenerator.ILicenseTester;
import org.spdx.tools.licensegenerator.LicenseHtmlFormatWriter;
import org.spdx.tools.licensegenerator.LicenseJsonFormatWriter;
import org.spdx.tools.licensegenerator.LicenseMarkdownFormatWriter;
import org.spdx.tools.licensegenerator.LicenseRdfFormatWriter;
import org.spdx.tools.licensegenerator.LicenseRdfaFormatWriter;
import org.spdx.tools.licensegenerator.LicenseTemplateFormatWriter;
import org.spdx.tools.licensegenerator.LicenseTextFormatWriter;
import org.spdx.tools.licensegenerator.SimpleLicenseTester;
import org.spdx.tools.licensegenerator.SpdxWebsiteFormatWriter;
import org.spdx.spdxspreadsheet.SpreadsheetException;

import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import com.google.common.io.Files;

import au.com.bytecode.opencsv.CSVReader;

/**
 * Converts input license text and metadata into various output formats.
 * 
 * Supported input formats:
 *  - Spreadsheet - spreadsheet used by the SPDX legal team including associated text files
 *  - Directory of XML files - Files following the SPDX legal team license format
 * 
 * Supported output formats:
 *  - Text - license text
 *  - Templates - license templates as defined by the SPDX legal team matching guidelines
 *  - JSON - Json format as defined in https://github.com/spdx/license-list-data
 *  - RDFa - HTML with RDFa tags as defined in https://github.com/spdx/license-list-data
 *  - RDF NT - RDF NT format defined by the SPDX Spec
 *  - RDF XML - RDF XML format defined by the SPDX Spec
 *  - RDF Turtle - RDF Turtle format defined by the SPDX Spec
 *  - Website - the content for the website available at https://spdx.org/licenses
 *  
 *  Output generated by this tool can be found at https://github.com/spdx/license-list-data and on the 
 *  spdx.org licenses website
 *  
 *  To add a new output format, create a class supporting the ILicenseFormatWriter interface and add it
 *  to the writers list.
 *  
 * @author <NAME>
 *
 */
public class LicenseRDFAGenerator {
		
	static final Set<Character> INVALID_TEXT_CHARS = Sets.newHashSet();
	
	static {
		INVALID_TEXT_CHARS.add('\uFFFD');
	}
	static int MIN_ARGS = 2;
	static int MAX_ARGS = 6;

	static final int ERROR_STATUS = 1;
	static final int WARNING_STATUS = 64;
	static final String CSS_TEMPLATE_FILE = "resources/screen.css";
	static final String CSS_FILE_NAME = "screen.css";
	static final String SORTTABLE_JS_FILE = "resources/sorttable.js";
	static final String SORTTABLE_FILE_NAME = "sorttable.js";
	static final String TEXT_FOLDER_NAME = "text";
	static final String TEMPLATE_FOLDER_NAME = "template";
	static final String HTML_FOLDER_NAME = "html";
	static final String RDFA_FOLDER_NAME = "rdfa";
	static final String JSON_FOLDER_NAME = "json";
	private static final String WEBSITE_FOLDER_NAME = "website";
	private static final String RDFXML_FOLDER_NAME = "rdfxml";
	private static final String RDFTURTLE_FOLDER_NAME = "rdfturtle";
	private static final String RDFNT_FOLDER_NAME = "rdfnt";
	private static final String TABLE_OF_CONTENTS_FILE_NAME = "licenses.md";
	
{'fraction_non_alphanumeric': 0.08191607124886786, 'fraction_numerical': 0.0026164838482439366, 'mean_word_length': 4.883955002960332, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 8, 'lorem ipsum': 0, 'www.': 2, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2225684', 'n_tokens_mistral': 3028, 'n_tokens_neox': 2962, 'n_words': 852}