예제 #1
0
        public void CreateConstructQueryResultTest()
        {
            //Arrange
            var constructQuery = new RDFConstructQuery();

            //Act
            var constructQueryResult = constructQuery.ApplyToGraph(graph);

            //Assert
            Assert.Equal(0, constructQueryResult.ConstructResultsCount);
        }
예제 #2
0
        /// <summary>
        /// Applies the given SPARQL CONSTRUCT 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 RDFConstructQueryResult ApplyToOntology(this RDFConstructQuery constructQuery,
                                                              RDFOntology ontology,
                                                              RDFSemanticsEnums.RDFOntologyInferenceExportBehavior ontologyInferenceExportBehavior = RDFSemanticsEnums.RDFOntologyInferenceExportBehavior.ModelAndData)
        {
            var result = new RDFConstructQueryResult(ontology.Value.ToString());

            if (constructQuery != null)
            {
                if (ontology != null)
                {
                    RDFSemanticsEvents.RaiseSemanticsInfo(String.Format("Ontology '{0}' is going to be converted into a graph on which the SPARQL CONSTRUCT 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(constructQuery.ApplyToGraph(ontGraph));
                }
            }
            return(result);
        }