/// <summary>
        /// Gets a graph representation of this shape
        /// </summary>
        public virtual RDFGraph ToRDFGraph()
        {
            var result = new RDFGraph();

            //Severity
            switch (this.Severity)
            {
            case RDFValidationEnums.RDFShapeSeverity.Info:
                result.AddTriple(new RDFTriple(this, RDFVocabulary.SHACL.SEVERITY_PROPERTY, RDFVocabulary.SHACL.INFO));
                break;

            case RDFValidationEnums.RDFShapeSeverity.Warning:
                result.AddTriple(new RDFTriple(this, RDFVocabulary.SHACL.SEVERITY_PROPERTY, RDFVocabulary.SHACL.WARNING));
                break;

            case RDFValidationEnums.RDFShapeSeverity.Violation:
                result.AddTriple(new RDFTriple(this, RDFVocabulary.SHACL.SEVERITY_PROPERTY, RDFVocabulary.SHACL.VIOLATION));
                break;
            }

            //Deactivated
            result.AddTriple(new RDFTriple(this, RDFVocabulary.SHACL.DEACTIVATED, this.Deactivated ? RDFTypedLiteral.True : RDFTypedLiteral.False));

            //Messages
            this.Messages.ForEach(message => result.AddTriple(new RDFTriple(this, RDFVocabulary.SHACL.MESSAGE, message)));

            //Targets
            this.Targets.ForEach(target => result = result.UnionWith(target.ToRDFGraph(this)));

            //Constraints
            this.Constraints.ForEach(constraint => result = result.UnionWith(constraint.ToRDFGraph(this)));

            result.SetContext(this.URI);
            return(result);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Gets a graph representation of this validation report
        /// </summary>
        public RDFGraph ToRDFGraph()
        {
            var result = new RDFGraph();

            //ValidationReport
            result.AddTriple(new RDFTriple(this, RDFVocabulary.RDF.TYPE, RDFVocabulary.SHACL.VALIDATION_REPORT));

            //Conforms
            if (this.Conforms)
            {
                result.AddTriple(new RDFTriple(this, RDFVocabulary.SHACL.CONFORMS, new RDFTypedLiteral("true", RDFModelEnums.RDFDatatypes.XSD_BOOLEAN)));
            }
            else
            {
                result.AddTriple(new RDFTriple(this, RDFVocabulary.SHACL.CONFORMS, new RDFTypedLiteral("false", RDFModelEnums.RDFDatatypes.XSD_BOOLEAN)));
            }

            //Results
            this.Results.ForEach(res => {
                result.AddTriple(new RDFTriple(this, RDFVocabulary.SHACL.RESULT, res));
                result = result.UnionWith(res.ToRDFGraph());
            });

            result.SetContext(this.URI);
            return(result);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Gets a graph representation of this validation report
        /// </summary>
        public RDFGraph ToRDFGraph()
        {
            RDFGraph result = new RDFGraph();

            //ValidationReport
            result.AddTriple(new RDFTriple(this, RDFVocabulary.RDF.TYPE, RDFVocabulary.SHACL.VALIDATION_REPORT));

            //Conforms
            if (this.Conforms)
            {
                result.AddTriple(new RDFTriple(this, RDFVocabulary.SHACL.CONFORMS, RDFTypedLiteral.True));
            }
            else
            {
                result.AddTriple(new RDFTriple(this, RDFVocabulary.SHACL.CONFORMS, RDFTypedLiteral.False));
            }

            //Results
            this.Results.ForEach(res =>
            {
                result.AddTriple(new RDFTriple(this, RDFVocabulary.SHACL.RESULT, res));
                result = result.UnionWith(res.ToRDFGraph());
            });

            result.SetContext(this.URI);
            return(result);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Gets a graph representation of this shapes graph
        /// </summary>
        public RDFGraph ToRDFGraph()
        {
            var result = new RDFGraph();

            foreach (var shape in this)
            {
                result = result.UnionWith(shape.ToRDFGraph());
            }

            result.SetContext(this.URI);
            return(result);
        }