Compare models for identity, but with variables? Construct with minus?

前端 未结 2 611
长发绾君心
长发绾君心 2021-01-23 06:36

My team is implementing a variation of Ceusters\'s Referent Tracking. In our implementation, the original URI for an entity can be changed (to something containing a UUID), alth

2条回答
  •  不要未来只要你来
    2021-01-23 06:41

    In order to determine that the triple-store contains only the triples which you expect and nothing more, you could test for the exact triples which you expect while simultaneously counting the number of triples which appear in the database before and after you run your program. If the difference in triples is higher or lower than you expect, you will know that you have some extraneous or missing data.

    Use SPARQL SELECT Count function:

    SELECT (count(?triples) as ?count)
    WHERE {
    ?triples ?p ?o .}
    

    Pseudocode:

    val beforeTripleCount = countTriplesInDatabase()
    //run your program, test for expected triples
    val afterTripleCount = countTriplesInDatabase()
    val diff = afterTripleCount - beforeTripleCount
    //diff should be equal to the number of triples you expect to be added/removed
    

    Additionally, if you are resistant to using variables in your tests, you could write additional queries to capture the URI of the node you have created, then add the results to your test queries using String concatenation.

提交回复
热议问题