Commit e6165c95 authored by Maxime Lefrançois's avatar Maxime Lefrançois
Browse files

trace IOException

parent 68cc26cc
Loading
Loading
Loading
Loading
+0 −5
Original line number Diff line number Diff line
package fr.emse.gitlab.saref.entities.utils;

public class SAREFProjectUtils {

}
+0 −131
Original line number Diff line number Diff line
package fr.emse.gitlab.saref.jobsold;
///*
// * Copyright 2020 ETSI
// * 
// * Redistribution and use in source and binary forms, with or without 
// * modification, are permitted provided that the following conditions are met:
// * 1. Redistributions of source code must retain the above copyright notice, 
// *    this list of conditions and the following disclaimer.
// * 2. Redistributions in binary form must reproduce the above copyright notice, 
// *    this list of conditions and the following disclaimer in the documentation 
// *    and/or other materials provided with the distribution.
// * 3. Neither the name of the copyright holder nor the names of its contributors 
// *    may be used to endorse or promote products derived from this software without 
// *    specific prior written permission.
// * 
// * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
// * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
// * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
// * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
// * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
// * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 
// * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 
// * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 
// * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 
// * OF THE POSSIBILITY OF SUCH DAMAGE.
// */
//package fr.emse.gitlab.saref.jobs;
//
//import org.apache.jena.query.Dataset;
//import org.apache.jena.query.QueryExecution;
//import org.apache.jena.query.QueryExecutionFactory;
//import org.apache.jena.query.QuerySolution;
//import org.apache.jena.query.ReadWrite;
//import org.apache.jena.query.ResultSet;
//import org.apache.jena.rdf.model.Model;
//import org.apache.jena.rdf.model.Resource;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//
//import fr.emse.gitlab.saref.REGEX;
//
///**
//*
//* @author Maxime Lefrançois
//*
//*/
//public class CheckConfig {
//
//	static final String FIND_USED_UNDEFINED = "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\r\n" + 
//			"PREFIX rdfp: <https://w3id.org/rdfp/>\r\n" + 
//			"PREFIX ex: <http://example.org/>\r\n" + 
//			"\r\n" + 
//			"SELECT ?term (SAMPLE(?v) AS ?version) WHERE {\r\n" + 
//			"  ?term a rdfp:Resource ;\r\n" + 
//			"    ex:isUsedBy ?v .\r\n" + 
//			"  FILTER NOT EXISTS {\r\n" + 
//			"  ?term rdfs:isDefinedBy ?ontology .\r\n" + 
//			"  }\r\n" + 
//			"} GROUP BY ?term \n"
//			+ "ORDER BY ?term";
//
//	static final String FIND_EXAMPLIFIED_UNDEFINED = "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\r\n" + 
//			"PREFIX rdfp: <https://w3id.org/rdfp/>\r\n" + 
//			"PREFIX ex: <http://example.org/>\r\n" + 
//			"\r\n" + 
//			"SELECT ?term (SAMPLE(?e) AS ?example) WHERE {\r\n" + 
//			"  ?term a rdfp:Resource ;\r\n" + 
//			"    ex:hasExample ?e .\r\n" + 
//			"  FILTER NOT EXISTS {\r\n" + 
//			"  ?term rdfs:isDefinedBy ?ontology .\r\n" + 
//			"  }\r\n" + 
//			"} GROUP BY ?term \n"
//			+ "ORDER BY ?term";
//
//	static final String FIND_DEFINED_UNEXAMPLIFIED = "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\r\n" + 
//			"PREFIX rdfp: <https://w3id.org/rdfp/>\r\n" + 
//			"PREFIX ex: <http://example.org/>\r\n" + 
//			"\r\n" + 
//			"SELECT ?term (SAMPLE(?o) AS ?ontology) WHERE {\r\n" + 
//			"  ?term a rdfp:Resource ;\r\n" + 
//			"    rdfs:isDefinedBy ?o .\r\n" + 
//			"  FILTER NOT EXISTS {\r\n" + 
//			"  ?term ex:hasExample ?e .\r\n" + 
//			"  }\r\n" + 
//			"} GROUP BY ?term \n"
//			+ "ORDER BY ?term";
//
//	public void doJob(Dataset dataset, boolean ignoreExamples) {
//		dataset.begin(ReadWrite.READ);
//		Model config = dataset.getNamedModel(REGEX.CONFIG);
//
//		// check which terms are used but not defined
//		Logger logger = LoggerFactory.getLogger(REGEX.LOGGER_BASE + "." + "Terms that are used but never defined");
//		try (QueryExecution exec = QueryExecutionFactory.create(FIND_USED_UNDEFINED, config);) {
//			for (ResultSet resultSet = exec.execSelect(); resultSet.hasNext();) {
//				QuerySolution sol = resultSet.next();
//				Resource term = sol.getResource("term");
//				Resource version = sol.getResource("version");
//				logger.warn(String.format("Term %s is never defined, but is used in version %s", term, version));
//			}
//		}
//		
//		if(!ignoreExamples) {
//			
//			// check which terms are exemplified but not defined
//			logger = LoggerFactory.getLogger(REGEX.LOGGER_BASE + "." + "Terms that have examples, but never defined");
//			try (QueryExecution exec = QueryExecutionFactory.create(FIND_EXAMPLIFIED_UNDEFINED, config);) {
//				for (ResultSet resultSet = exec.execSelect(); resultSet.hasNext();) {
//					QuerySolution sol = resultSet.next();
//					Resource term = sol.getResource("term");
//					Resource example = sol.getResource("example");
//					logger.warn(String.format("Term %s is never defined, but is used in example %s", term, example));
//				}
//			}
//	
//			// check which terms are defined but not exemplified
//			logger = LoggerFactory.getLogger(REGEX.LOGGER_BASE + "." + "Terms that are defined, but have no example");
//			try (QueryExecution exec = QueryExecutionFactory.create(FIND_DEFINED_UNEXAMPLIFIED, config);) {
//				for (ResultSet resultSet = exec.execSelect(); resultSet.hasNext();) {
//					QuerySolution sol = resultSet.next();
//					Resource term = sol.getResource("term");
//					Resource ontology = sol.getResource("ontology");
//					logger.warn(String.format("Term %s is defined in %s, but there is no example that uses it.", term, ontology));
//				}
//			}
//		}
//
//
//		dataset.end();
//	}
//}
+0 −305
Original line number Diff line number Diff line
///*
// * Copyright 2020 ETSI
// * 
// * Redistribution and use in source and binary forms, with or without 
// * modification, are permitted provided that the following conditions are met:
// * 1. Redistributions of source code must retain the above copyright notice, 
// *    this list of conditions and the following disclaimer.
// * 2. Redistributions in binary form must reproduce the above copyright notice, 
// *    this list of conditions and the following disclaimer in the documentation 
// *    and/or other materials provided with the distribution.
// * 3. Neither the name of the copyright holder nor the names of its contributors 
// *    may be used to endorse or promote products derived from this software without 
// *    specific prior written permission.
// * 
// * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
// * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
// * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
// * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
// * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
// * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 
// * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 
// * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 
// * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 
// * OF THE POSSIBILITY OF SUCH DAMAGE.
// */
//package fr.emse.gitlab.saref.jobs;
//
//import java.io.File;
//import java.io.FileInputStream;
//import java.io.InputStream;
//import java.io.InputStreamReader;
//import java.nio.charset.Charset;
//import java.nio.charset.MalformedInputException;
//import java.nio.charset.StandardCharsets;
//import java.text.SimpleDateFormat;
//import java.util.HashMap;
//import java.util.HashSet;
//import java.util.Map;
//import java.util.Set;
//import java.util.regex.Pattern;
//
//import org.apache.commons.io.IOUtils;
//import org.apache.jena.atlas.RuntimeIOException;
//import org.apache.jena.query.Dataset;
//import org.apache.jena.query.DatasetFactory;
//import org.apache.jena.query.QueryExecution;
//import org.apache.jena.query.QueryExecutionFactory;
//import org.apache.jena.query.QuerySolution;
//import org.apache.jena.query.QuerySolutionMap;
//import org.apache.jena.query.ReadWrite;
//import org.apache.jena.query.ResultSet;
//import org.apache.jena.rdf.model.Literal;
//import org.apache.jena.rdf.model.Model;
//import org.apache.jena.rdf.model.ModelFactory;
//import org.apache.jena.rdf.model.NodeIterator;
//import org.apache.jena.rdf.model.RDFNode;
//import org.apache.jena.rdf.model.ResIterator;
//import org.apache.jena.rdf.model.Resource;
//import org.apache.jena.rdf.model.ResourceFactory;
//import org.apache.jena.riot.Lang;
//import org.apache.jena.update.UpdateExecutionFactory;
//import org.apache.jena.update.UpdateFactory;
//import org.apache.jena.update.UpdateProcessor;
//import org.apache.jena.update.UpdateRequest;
//import org.apache.jena.vocabulary.OWL2;
//import org.apache.jena.vocabulary.RDF;
//import org.topbraid.jenax.util.JenaUtil;
//import org.topbraid.shacl.validation.ValidationUtil;
//import org.topbraid.shacl.vocabulary.SH;
//
//import fr.emse.gitlab.saref.REGEX;
//import fr.emse.gitlab.saref.SAREFPipelineException;
//import fr.emse.gitlab.saref.entities.git.Version;
//import fr.emse.gitlab.saref.vocabs.EX;
//import fr.emse.gitlab.saref.vocabs.RDFP;
//
///**
//*
//* @author Maxime Lefrançois
//*
//*/
//public class ReadExamples extends JobRunner {
//	
//	static final String SHACL_WARNING = "http://www.w3.org/ns/shacl#Warning";
//	static final String SHACL_VIOLATION = "http://www.w3.org/ns/shacl#Violation";
//	public static final String REGEX_TERM_URI = "^" + REGEX.BASE + REGEX.PROJECT_PATH + "/(?<localName>[^/]+)$";
//
//	static final String SELECT_VIOLATION = "PREFIX sh: <http://www.w3.org/ns/shacl#>\n"
//			+ "SELECT ?focusNode ?resultMessage ?resultPath ?value ?severity\n" + "WHERE {   \n"
//			+ "    ?violation sh:focusNode ?focusNode .\n" + "    ?violation sh:resultMessage ?resultMessage .\n"
//			+ "    ?violation sh:resultSeverity ?severity .\n"
//			+ "      OPTIONAL { ?violation sh:resultPath ?resultPath . }\n"
//			+ "      OPTIONAL { ?violation sh:value ?value . } \n" + "}";
//
//	static final Map<String, String> PREFIXES = new HashMap<String, String>();
//	static {
//		PREFIXES.put("owl", "http://www.w3.org/2002/07/owl#");
//		PREFIXES.put("rdfs", "http://www.w3.org/2000/01/rdf-schema#");
//		PREFIXES.put("xsd", "http://www.w3.org/2001/XMLSchema#");
//		PREFIXES.put("dcterms", "http://purl.org/dc/terms/");
//		PREFIXES.put("vann", "http://purl.org/vocab/vann/");
//		PREFIXES.put("foaf", "http://xmlns.com/foaf/0.1/");
//		PREFIXES.put("schema", "http://schema.org/");
//		PREFIXES.put("rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#");
//		PREFIXES.put("voaf", "http://purl.org/vocommons/voaf#");
//		PREFIXES.put("dce", "http://purl.org/dc/elements/1.1/");
//		PREFIXES.put("dct", "http://purl.org/dc/terms/");
//		PREFIXES.put("xml", "http://www.w3.org/XML/1998/namespace/");
//		PREFIXES.put("saref", "https://saref.etsi.org/core/");
//	}
//	private static final SimpleDateFormat SIMPLE_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd");
//
//	public ReadExamples(String testSuiteName) {
//		super(testSuiteName);
//	}
//
//	public void doJob(Dataset dataset, Version version, String url, File exampleFile) throws SAREFPipelineException {
//		Model model = ModelFactory.createDefaultModel();
//		try (FileInputStream input = new FileInputStream(exampleFile)) {
//			model.read(input, REGEX.BASE, Lang.TTL.getLabel());
//		} catch (Exception ex) {
//			if(ex instanceof RuntimeIOException && ex.getCause() instanceof MalformedInputException) {
//				try (InputStreamReader  input2 = new InputStreamReader(new FileInputStream(exampleFile), Charset.defaultCharset())) {
//					model.read(input2, REGEX.BASE, Lang.TTL.getLabel());
//				} catch (Exception ex2) {
//					errorLogger.error("Exception while reading the example file", ex);
//					throw new SAREFPipelineException("Exception while reading the example file", ex2);
//				}
//			} else {
//				errorLogger.error("Exception while reading the example file", ex);
//				throw new SAREFPipelineException("Exception while reading the example file", ex);
//			}
//		}
//		checkPrefixes(model);
//		checkShapes(model, version);
//		
//		Resource example = ResourceFactory.createResource(url);
//
//		dataset.begin(ReadWrite.WRITE);
//		Model config = getNamedModel(dataset, REGEX.CONFIG);
//		try {
//			updateExampleMetadata(version, model, example);
//		} catch (Exception ex) {
//			errorLogger.error("Error while updating example metadata", ex);
//			throw new SAREFPipelineException("Error while updating example metadata", ex);
//		}
//		dataset.addNamedModel(url,  model);
//
//		augmentTermGraphs(dataset, version, example, model, config, exampleFile);
//		
//		dataset.commit();
//	}
//	
//	private void checkPrefixes(Model model) {
//		final Map<String, String> prefixes = model.getNsPrefixMap();
//		for (String s : PREFIXES.keySet()) {
//			if (prefixes.containsKey(s)) {
//				if (!prefixes.get(s).equals(PREFIXES.get(s))) {
//					errorLogger.warn(String.format(
//							"Prefix `%s:` in the example file is expected to be equal to `<%s>`. Got: `<%s>`", s,
//							PREFIXES.get(s), prefixes.get(s)));
//				}
//			}
//		}
//		for (Map.Entry<String, String> entry : prefixes.entrySet()) {
//			String s = entry.getKey();
//			String l = entry.getValue();
//			if (l.contains("saref")) {
//				if (!l.matches(REGEX.REGEX_ONTO_URI)) {
//					errorLogger.warn(String.format(
//							"Prefix `%s:` in the example file contains string \"saref\", but does not seem to match a SAREF ontologies namespace: `\\\\%s\\\\`. Got: `<%s>`",
//							s, REGEX.REGEX_ONTO_URI, l));
//				}
//			}
//		}
//	}
//
//	private void checkShapes(Model model, Version version) throws SAREFPipelineException {
//		Model shapeModel = JenaUtil.createDefaultModel();
//		try (InputStream in = ReadOntology.class.getClassLoader().getResourceAsStream("exampleShape.ttl")) {
//			shapeModel.read(in, REGEX.BASE, "TTL");
//		} catch (Exception ex) {
//			errorLogger.error("Exception while reading the example shape file", ex);
//			throw new SAREFPipelineException("Exception while reading the example shape file", ex);
//		}
//		Resource reportResource = ValidationUtil.validateModel(model, shapeModel, true);
//		boolean conforms = reportResource.getProperty(SH.conforms).getBoolean();
//		if (!conforms) {
//			Model reportModel = reportResource.getModel();
//			reportModel.setNsPrefixes(PREFIXES);
//			reportModel.setNsPrefix("sh", "http://www.w3.org/ns/shacl#");
//			try (QueryExecution exec = QueryExecutionFactory.create(SELECT_VIOLATION, reportModel);) {
//				for (ResultSet resultSet = exec.execSelect(); resultSet.hasNext();) {
//					QuerySolution sol = resultSet.next();
//					Resource severity = sol.getResource("severity");
//					Resource focusNode = sol.get("focusNode").asResource();
//					Literal resultMessage = sol.getLiteral("resultMessage");
//					RDFNode value = sol.get("value");
//					String gotString = (value != null && value.isURIResource()) ? String.format(" Got: %s", value)
//							: "";
//					if (severity != null && severity.getURI().equals(SHACL_VIOLATION)) {
//						errorLogger.error(String.format("Shape violation on node %s: %s%s", focusNode, resultMessage,
//								gotString));
//					} else {
//						errorLogger.warn(String.format("Shape violation on node %s: %s%s", focusNode, resultMessage,
//								gotString));
//					}
//				}
//			}
//		}
//		int onto = 0;
//		ResIterator it = model.listSubjectsWithProperty(RDF.type, OWL2.Ontology);
//		if(!it.hasNext()) {
//			errorLogger.error("There shall be exactly one owl:Ontology");
//		}
//		while(it.hasNext()) {
//			Resource ontology = it.next();
//			if(onto++>1) {
//				errorLogger.error("There shall be exactly one owl:Ontology");
//			}
//			// check that this ontology is imported (without a version)
//			boolean found = false;
//			NodeIterator its = model.listObjectsOfProperty(ontology, OWL2.imports);
//			while(its.hasNext()) {
//				RDFNode s = its.next();
//				String uri = s.asResource().getURI();
//				if(uri.equals(version.getRepository().getNamespace())) {
//					found = true;
////				} else {
////					if(!uri.matches("^https://saref.etsi.org/(core|saref4[a-z]{4})/v[1-9][0-9]*\\\\.[1-9][0-9]*\\\\.[1-9][0-9]*/$")) {
////						logger.error("Only SAREF ontologies with specific versions shall be imported. Their URIs conform to the regular expression `^https://saref.etsi.org/(core|saref4[a-z]{4})/v[1-9][0-9]*\\\\.[1-9][0-9]*\\\\.[1-9][0-9]*/$`");
////					}
//				}
//			}
//			if(!found) {
//				errorLogger.error(String.format("The current ontology shall be imported: <%s>", version.getRepository().getNamespace()));
//			}
//		}
//	}
//	
//	private void updateExampleMetadata(Version version, Model model, Resource example) throws Exception {
//		Dataset dataset = DatasetFactory.create(model);
//		
//		QuerySolutionMap sol = new QuerySolutionMap();
//		sol.add("IRI", example);
//		String updateString = IOUtils.toString(ReadExamples.class.getClassLoader().getResourceAsStream("queries/examples/updateOntologyIRI.rq"), StandardCharsets.UTF_8);
//		UpdateRequest updateRequest = UpdateFactory.create(updateString);
//		UpdateProcessor exec = UpdateExecutionFactory.create(updateRequest, dataset, sol);
//		exec.execute();
//		
//		sol = new QuerySolutionMap();
//		sol.add("ONTOLOGY_SERIES", version.getRepository().getVersionResource());
//		sol.add("ONTOLOGY_VERSION", version.getVersionResource());
//		updateString = IOUtils.toString(ReadExamples.class.getClassLoader().getResourceAsStream("queries/examples/updateImportIRI.rq"), StandardCharsets.UTF_8);
//		updateRequest = UpdateFactory.create(updateString);
//		exec = UpdateExecutionFactory.create(updateRequest, dataset, sol);
//		exec.execute();
//	}
//
//	private void augmentTermGraphs(Dataset dataset, Version version, Resource example, Model model, Model config, File exampleFile) {
//		Set<Resource> exemplifiedTerms = new HashSet<>();
//		computeTerms(version, example, model, exemplifiedTerms);
//		config.add(example, RDF.type, EX.Example);
//		String localName = exampleFile.getName().substring(0,exampleFile.getName().length()-4);
//		config.add(example, EX.localName, localName);
//		for (Resource t : exemplifiedTerms) {
//			Model termModel = getNamedModel(dataset, t.getURI());
//			termModel.add(t, EX.hasExample, example);
//			config.add(t, RDF.type, RDFP.Resource);
//			config.add(t, EX.hasExample, example);
//		}
//	}
//
//	private void computeTerms(Version version, Resource example, Model model, Set<Resource> exemplifiedTerms) {
//		model.listStatements().forEachRemaining(stmt -> {
//			Resource s = stmt.getSubject();
//			Resource p = stmt.getPredicate();
//			Resource o = stmt.getObject().isResource() ? (Resource) stmt.getObject() : null;
//			computeTerms(version, example, s, exemplifiedTerms);
//			computeTerms(version, example, p, exemplifiedTerms);
//			computeTerms(version, example, o, exemplifiedTerms);
//		});
//	}
//
//	private void computeTerms(Version version, Resource example, Resource t, Set<Resource> exemplifiedTerms) {
//		if (t == null || !t.isURIResource() || !t.getURI().startsWith(REGEX.BASE) || t.getURI().endsWith("/")) {
//			return;
//		}
//		String uri = t.getURI();
//		if(Pattern.matches(REGEX_TERM_URI, uri)) {
//			exemplifiedTerms.add(t);
//		}
////		if (uri.startsWith(version.getRepository().getNamespace()) && !uri.startsWith(example.getURI())) {
////			exemplifiedTerms.add(t);
////		}
//	}
//
//	private Model getNamedModel(Dataset dataset, String uri) {
//		if (!dataset.containsNamedModel(uri)) {
//			dataset.addNamedModel(uri, ModelFactory.createDefaultModel());
//		}
//		return dataset.getNamedModel(uri);
//	}
//
//}
+15 −8
Original line number Diff line number Diff line
@@ -138,13 +138,10 @@ public class RepositoryFactory extends SAREFErrorLogger {
					errorLogger.warn(msg);
					throw new SAREFPipelineException(msg);
				} 
				SAREFVersionName vn = guessVersion(project, directory);
				if (isTarget && vn == null) {
				originalVersionName = guessVersion(project, directory);
				if (isTarget && originalVersionName.equals(SAREFVersionName.DEFAULT)) {
					final String msg = getMessage(MESSAGE.develop_branch, originalBranch);
					errorLogger.warn(msg);
					originalVersionName = SAREFVersionName.DEFAULT;
				} else {
					originalVersionName = vn; 
				}
			} else {
				int major = Integer.parseInt(m.group(SAREF.REGEX_VERSION_MAJOR_VAR));
@@ -162,11 +159,17 @@ public class RepositoryFactory extends SAREFErrorLogger {
			readVersions(git, repository);
			return repository;
		} catch (IOException ex) {
			LOG.trace("IOException " + ex, ex);
			if (pipeline.mode == Mode.RELEASE) {
				throw new SAREFPipelineException(getMessage(MESSAGE.release_git), ex);
			}
			return new SAREFRepository(directory, project, false, SAREFVersionName.DEFAULT, null);
			final SAREFVersionName versionName = guessVersion(project, directory);
			final SAREFRepository repository = new SAREFRepository(directory, project, false, versionName, null);
			SAREFVersion version = new SAREFVersion(repository, versionName, null, null, null);
			repository.getVersions().put(versionName, version);
			return repository;
		} catch (GitAPIException ex) {
			LOG.trace("GitAPIException " + ex, ex);
			throw new SAREFPipelineException("Unexpected Git APIException", ex);
		}
	}
@@ -178,9 +181,13 @@ public class RepositoryFactory extends SAREFErrorLogger {
			SAREFNamedGraph namedGraph = new SAREFNamedGraph("null");
			SAREF.loadModel(namedGraph, ontologyFile, errorLogger);
			String uri = namedGraph.getModel().listObjectsOfProperty(OWL2.versionIRI).next().asResource().getURI();
			return SAREF.extractVersionName(uri);
			SAREFVersionName versionName = SAREF.extractVersionName(uri);
			if(versionName == null) {
				return SAREFVersionName.DEFAULT;
			}
			return versionName;
		} catch (Exception ex) {
			return null;
			return SAREFVersionName.DEFAULT;
		}
	}