Exemple #1
0
        public void CreateEmptyConstructQueryTest()
        {
            //Arrange
            var constructQuery = new RDFConstructQuery();

            //Assert
            Assert.NotEqual(0, constructQuery.QueryMemberID);
        }
Exemple #2
0
        public void CreateConstructQueryResultTest()
        {
            //Arrange
            var constructQuery = new RDFConstructQuery();

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

            //Assert
            Assert.Equal(0, constructQueryResult.ConstructResultsCount);
        }
Exemple #3
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);
        }