Skip to content
This repository has been archived by the owner on Oct 12, 2021. It is now read-only.

Commit

Permalink
Changing returned validation results to simply be the SHACL Result.
Browse files Browse the repository at this point in the history
Commit only a OSLC model of the SHACL report resources. Interface still
needs to be changed.
  • Loading branch information
jadelkhoury authored and yashkhatri committed Oct 11, 2018
1 parent 8b12a24 commit f6a3eb7
Show file tree
Hide file tree
Showing 7 changed files with 1,034 additions and 22 deletions.
20 changes: 20 additions & 0 deletions model/shacl_domain.xml
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<oslc4j_ai:Specification xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:oslc4j_ai="http://org.eclipse.lyo/oslc4j/adaptorInterface">
<domainSpecifications name="SHACL" namespaceURI="http://www.w3.org/ns/shacl" namespacePrefix="//@domainPrefixes.0">
<resources name="ValidationReport" resourceProperties="//@domainSpecifications.0/@resourceProperties.0 //@domainSpecifications.0/@resourceProperties.4"/>
<resources name="ValidationResult" resourceProperties="//@domainSpecifications.0/@resourceProperties.3 //@domainSpecifications.0/@resourceProperties.1 //@domainSpecifications.0/@resourceProperties.2 //@domainSpecifications.0/@resourceProperties.5"/>
<resourceProperties name="conforms"/>
<resourceProperties name="focusNode" valueType="URI"/>
<resourceProperties name="message" valueType="String"/>
<resourceProperties name="resultpath" valueType="URI"/>
<resourceProperties name="result" occurs="zeroOrMany" valueType="LocalResource" range="//@domainSpecifications.0/@resources.1"/>
<resourceProperties name="resultSeverity" valueType="URI">
<allowedValue>http://www.w3.org/ns/shacl#Info</allowedValue>
<allowedValue>http://www.w3.org/ns/shacl#Warning</allowedValue>
<allowedValue>http://www.w3.org/ns/shacl#Violation</allowedValue>
</resourceProperties>
<generationSetting javaClassPackageName="" javaFilesPath=""/>
</domainSpecifications>
<domainPrefixes name="sh"/>
<generationSetting javaClassPackageName="org.eclipse.lyo.validation.shacl" javaFilesPath="\src\main\java"/>
</oslc4j_ai:Specification>
267 changes: 267 additions & 0 deletions representations.aird

Large diffs are not rendered by default.

101 changes: 101 additions & 0 deletions src/main/java/org/eclipse/lyo/validation/shacl/IValidationReport.java
@@ -0,0 +1,101 @@
// Start of user code Copyright
/*******************************************************************************
* Copyright (c) 2012 IBM Corporation and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Eclipse Distribution License v. 1.0 which accompanies this distribution.
*
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
* and the Eclipse Distribution License is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* Contributors:
*
* Russell Boykin - initial API and implementation
* Alberto Giammaria - initial API and implementation
* Chris Peters - initial API and implementation
* Gianluca Bernardini - initial API and implementation
* Sam Padgett - initial API and implementation
* Michael Fiedler - adapted for OSLC4J
* Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448)
*
* This file is generated by org.eclipse.lyo.oslc4j.codegenerator
*******************************************************************************/
// End of user code

package org.eclipse.lyo.validation.shacl;

import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.text.SimpleDateFormat;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
import java.util.Iterator;
import javax.servlet.http.HttpServletRequest;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import javax.ws.rs.core.UriBuilder;

import org.eclipse.lyo.oslc4j.core.annotation.OslcAllowedValue;
import org.eclipse.lyo.oslc4j.core.annotation.OslcDescription;
import org.eclipse.lyo.oslc4j.core.annotation.OslcMemberProperty;
import org.eclipse.lyo.oslc4j.core.annotation.OslcName;
import org.eclipse.lyo.oslc4j.core.annotation.OslcNamespace;
import org.eclipse.lyo.oslc4j.core.annotation.OslcOccurs;
import org.eclipse.lyo.oslc4j.core.annotation.OslcPropertyDefinition;
import org.eclipse.lyo.oslc4j.core.annotation.OslcRange;
import org.eclipse.lyo.oslc4j.core.annotation.OslcReadOnly;
import org.eclipse.lyo.oslc4j.core.annotation.OslcRepresentation;
import org.eclipse.lyo.oslc4j.core.annotation.OslcResourceShape;
import org.eclipse.lyo.oslc4j.core.annotation.OslcTitle;
import org.eclipse.lyo.oslc4j.core.annotation.OslcValueType;
import org.eclipse.lyo.oslc4j.core.model.AbstractResource;
import org.eclipse.lyo.oslc4j.core.model.Link;
import org.eclipse.lyo.oslc4j.core.model.Occurs;
import org.eclipse.lyo.oslc4j.core.model.OslcConstants;
import org.eclipse.lyo.oslc4j.core.model.Representation;
import org.eclipse.lyo.oslc4j.core.model.ValueType;

import org.eclipse.lyo.validation.shacl.ShDomainConstants;
import org.eclipse.lyo.validation.shacl.ShDomainConstants;
import org.eclipse.lyo.validation.shacl.IValidationResult;

// Start of user code imports
// End of user code

@OslcNamespace(ShDomainConstants.VALIDATIONREPORT_NAMESPACE)
@OslcName(ShDomainConstants.VALIDATIONREPORT_LOCALNAME)
@OslcResourceShape(title = "ValidationReport Resource Shape", describes = ShDomainConstants.VALIDATIONREPORT_TYPE)
public interface IValidationReport
{

public void addResult(final ValidationResult result );

@OslcName("conforms")
@OslcPropertyDefinition(ShDomainConstants.SHACL_NAMSPACE + "conforms")
@OslcOccurs(Occurs.ExactlyOne)
@OslcValueType(ValueType.Boolean)
@OslcReadOnly(false)
public Boolean isConforms();

@OslcName("result")
@OslcPropertyDefinition(ShDomainConstants.SHACL_NAMSPACE + "result")
@OslcOccurs(Occurs.ZeroOrMany)
@OslcValueType(ValueType.LocalResource)
@OslcRange({ShDomainConstants.VALIDATIONRESULT_TYPE})
@OslcReadOnly(false)
public HashSet<ValidationResult> getResult();


public void setConforms(final Boolean conforms );
public void setResult(final HashSet<ValidationResult> result );
}

112 changes: 112 additions & 0 deletions src/main/java/org/eclipse/lyo/validation/shacl/IValidationResult.java
@@ -0,0 +1,112 @@
// Start of user code Copyright
/*******************************************************************************
* Copyright (c) 2012 IBM Corporation and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Eclipse Distribution License v. 1.0 which accompanies this distribution.
*
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
* and the Eclipse Distribution License is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* Contributors:
*
* Russell Boykin - initial API and implementation
* Alberto Giammaria - initial API and implementation
* Chris Peters - initial API and implementation
* Gianluca Bernardini - initial API and implementation
* Sam Padgett - initial API and implementation
* Michael Fiedler - adapted for OSLC4J
* Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448)
*
* This file is generated by org.eclipse.lyo.oslc4j.codegenerator
*******************************************************************************/
// End of user code

package org.eclipse.lyo.validation.shacl;

import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.text.SimpleDateFormat;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
import java.util.Iterator;
import javax.servlet.http.HttpServletRequest;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import javax.ws.rs.core.UriBuilder;

import org.eclipse.lyo.oslc4j.core.annotation.OslcAllowedValue;
import org.eclipse.lyo.oslc4j.core.annotation.OslcDescription;
import org.eclipse.lyo.oslc4j.core.annotation.OslcMemberProperty;
import org.eclipse.lyo.oslc4j.core.annotation.OslcName;
import org.eclipse.lyo.oslc4j.core.annotation.OslcNamespace;
import org.eclipse.lyo.oslc4j.core.annotation.OslcOccurs;
import org.eclipse.lyo.oslc4j.core.annotation.OslcPropertyDefinition;
import org.eclipse.lyo.oslc4j.core.annotation.OslcRange;
import org.eclipse.lyo.oslc4j.core.annotation.OslcReadOnly;
import org.eclipse.lyo.oslc4j.core.annotation.OslcRepresentation;
import org.eclipse.lyo.oslc4j.core.annotation.OslcResourceShape;
import org.eclipse.lyo.oslc4j.core.annotation.OslcTitle;
import org.eclipse.lyo.oslc4j.core.annotation.OslcValueType;
import org.eclipse.lyo.oslc4j.core.model.AbstractResource;
import org.eclipse.lyo.oslc4j.core.model.Link;
import org.eclipse.lyo.oslc4j.core.model.Occurs;
import org.eclipse.lyo.oslc4j.core.model.OslcConstants;
import org.eclipse.lyo.oslc4j.core.model.Representation;
import org.eclipse.lyo.oslc4j.core.model.ValueType;

import org.eclipse.lyo.validation.shacl.ShDomainConstants;
import org.eclipse.lyo.validation.shacl.ShDomainConstants;

// Start of user code imports
// End of user code

@OslcNamespace(ShDomainConstants.VALIDATIONRESULT_NAMESPACE)
@OslcName(ShDomainConstants.VALIDATIONRESULT_LOCALNAME)
@OslcResourceShape(title = "ValidationResult Resource Shape", describes = ShDomainConstants.VALIDATIONRESULT_TYPE)
public interface IValidationResult
{


@OslcName("resultpath")
@OslcPropertyDefinition(ShDomainConstants.SHACL_NAMSPACE + "resultpath")
@OslcOccurs(Occurs.ExactlyOne)
@OslcReadOnly(false)
public URI getResultpath();

@OslcName("focusNode")
@OslcPropertyDefinition(ShDomainConstants.SHACL_NAMSPACE + "focusNode")
@OslcOccurs(Occurs.ExactlyOne)
@OslcReadOnly(false)
public URI getFocusNode();

@OslcName("message")
@OslcPropertyDefinition(ShDomainConstants.SHACL_NAMSPACE + "message")
@OslcOccurs(Occurs.ExactlyOne)
@OslcValueType(ValueType.String)
@OslcReadOnly(false)
public String getMessage();

@OslcName("resultSeverity")
@OslcPropertyDefinition(ShDomainConstants.SHACL_NAMSPACE + "resultSeverity")
@OslcOccurs(Occurs.ExactlyOne)
@OslcReadOnly(false)
@OslcAllowedValue({"http://www.w3.org/ns/shacl#Info", "http://www.w3.org/ns/shacl#Warning", "http://www.w3.org/ns/shacl#Violation"})
public URI getResultSeverity();


public void setResultpath(final URI resultpath );
public void setFocusNode(final URI focusNode );
public void setMessage(final String message );
public void setResultSeverity(final URI resultSeverity );
}

@@ -0,0 +1,51 @@
// Start of user code Copyright
/*******************************************************************************
* Copyright (c) 2012 IBM Corporation and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Eclipse Distribution License v. 1.0 which accompanies this distribution.
*
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
* and the Eclipse Distribution License is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* Contributors:
*
* Russell Boykin - initial API and implementation
* Alberto Giammaria - initial API and implementation
* Chris Peters - initial API and implementation
* Gianluca Bernardini - initial API and implementation
* Michael Fiedler - Bugzilla adpater implementations
* Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448)
*
* This file is generated by org.eclipse.lyo.oslc4j.codegenerator
*******************************************************************************/
// End of user code

package org.eclipse.lyo.validation.shacl;

import org.eclipse.lyo.oslc4j.core.model.OslcConstants;


// Start of user code imports
// End of user code

public interface ShDomainConstants
{
// Start of user code user constants
// End of user code

public static String SHACL_DOMAIN = "http://www.w3.org/ns/shacl";
public static String SHACL_NAMSPACE = "http://www.w3.org/ns/shacl";
public static String SHACL_NAMSPACE_PREFIX = "sh";

public static String VALIDATIONREPORT_PATH = "validationReport";
public static String VALIDATIONREPORT_NAMESPACE = SHACL_NAMSPACE; //namespace of the rdfs:class the resource describes
public static String VALIDATIONREPORT_LOCALNAME = "ValidationReport"; //localName of the rdfs:class the resource describes
public static String VALIDATIONREPORT_TYPE = VALIDATIONREPORT_NAMESPACE + VALIDATIONREPORT_LOCALNAME; //fullname of the rdfs:class the resource describes
public static String VALIDATIONRESULT_PATH = "validationResult";
public static String VALIDATIONRESULT_NAMESPACE = SHACL_NAMSPACE; //namespace of the rdfs:class the resource describes
public static String VALIDATIONRESULT_LOCALNAME = "ValidationResult"; //localName of the rdfs:class the resource describes
public static String VALIDATIONRESULT_TYPE = VALIDATIONRESULT_NAMESPACE + VALIDATIONRESULT_LOCALNAME; //fullname of the rdfs:class the resource describes
}

0 comments on commit f6a3eb7

Please sign in to comment.