Exemplo n.º 1
0
        public void CreateDescribeQueryResultTest()
        {
            //Arrange
            var describeQuery = new RDFDescribeQuery();

            //Act
            var describeQueryResult = describeQuery.ApplyToGraph(graph);

            //Assert
            Assert.Equal(0, describeQueryResult.DescribeResultsCount);
        }
Exemplo n.º 2
0
        public void DescribeQueryResultTest()
        {
            //Arrange
            var query = new RDFDescribeQuery();

            //Act
            query.AddDescribeTerm(new RDFResource("http://www.waltdisney.com/donald_duck"));
            var result = query.ApplyToGraph(graph);

            //Assert
            Assert.Equal(2, result.DescribeResultsCount);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Applies the given SPARQL DESCRIBE query to the given ontology (which is converted into
        /// a RDF graph including semantic inferences in respect of the given export behavior)
        /// </summary>
        public static RDFDescribeQueryResult ApplyToOntology(this RDFDescribeQuery describeQuery,
                                                             RDFOntology ontology,
                                                             RDFSemanticsEnums.RDFOntologyInferenceExportBehavior ontologyInferenceExportBehavior = RDFSemanticsEnums.RDFOntologyInferenceExportBehavior.ModelAndData)
        {
            var result = new RDFDescribeQueryResult(ontology.Value.ToString());

            if (describeQuery != null)
            {
                if (ontology != null)
                {
                    RDFSemanticsEvents.RaiseSemanticsInfo(String.Format("Ontology '{0}' is going to be converted into a graph on which the SPARQL DESCRIBE query will be applied. Please, remember that if the ontology validation has raised warnings or errors, you may get unexpected query results due to inconsistent semantic inferences!", ontology.Value));

                    var ontGraph = ontology.ToRDFGraph(ontologyInferenceExportBehavior);
                    return(describeQuery.ApplyToGraph(ontGraph));
                }
            }
            return(result);
        }