Skip to content

Commit

Permalink
Sketched unit test for issue #6
Browse files Browse the repository at this point in the history
  • Loading branch information
alexdma committed Apr 23, 2018
1 parent 4509759 commit f4dc659
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

import java.util.Iterator;
import java.util.Map;
Expand All @@ -23,6 +24,7 @@
import org.apache.jena.vocabulary.DCTerms;
import org.apache.jena.vocabulary.RDF;
import org.apache.jena.vocabulary.RDFS;
import org.apache.jena.vocabulary.SKOS;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
Expand Down Expand Up @@ -216,6 +218,26 @@ public void oneTypePresent() throws Exception {
assertFalse(find(q1, var_s, rdf_type, type_var));
}

/**
* One type not appearing in the target dataset; two properties, both used in
* the target dataset, also for same type, but neither for the type we need in
* the recommendation. In other words, the ideal query to recommend has
* <em>nothing</em> in common with the original one, except for the rdf:type
* property.
*
* I have no idea what a generalized query that satisfies this case would look
* like.
*/
@Test
public void twoPropertiesPresentButNeitherForOptimalType() throws Exception {
String q = "SELECT DISTINCT ?id ?name WHERE {"
+ " ?s a <http://statistics.data.gov.uk/def/geography/LocalEducationAuthority>" + " ; <"
+ SKOS.notation.getURI() + "> ?id" + " ; <" + SKOS.prefLabel.getURI() + "> ?name" + " }";
Set<Query> qG = _op.generalize(QueryFactory.create(q));
assertEquals(1, qG.size());
fail("Unit test NIY - don't know yet what general query we should require.");
}

/**
* One type not appearing in the target dataset; two properties, both used in
* the target dataset but never for the same type.
Expand Down
27 changes: 26 additions & 1 deletion squire/src/test/resources/signatures2.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,15 @@
},
"http://data.open.ac.uk/openlearn/ontology/Podcast": {

},
"http://statistics.data.gov.uk/def/geography/LocalEducationAuthority": {
"dps": [
"http://www.w3.org/2004/02/skos/core#notation",
"http://www.w3.org/2004/02/skos/core#prefLabel"
],
"ops": [
"http://statistics.data.gov.uk/def/geography/coverage"
]
}
},
"http://example.org/dataset/2": {
Expand Down Expand Up @@ -62,7 +71,23 @@
"dps": [
"http://www.w3.org/2000/01/rdf-schema#label"
],
"ops": ["http://xmlns.com/foaf/0.1/depiction"]
"ops": [
"http://xmlns.com/foaf/0.1/depiction"
]
},
"http://schema.org/School": {
"dps": [
"http://gov.genealogy.net/ontology.owl#hasDenomination",
"http://schema.org/legalName",
"http://schema.stapferenquete.ch/schoolType",
"https://gont.ch/id"
]
},
"http://example.org/BadRecommendation/1": {
"dps": [
"http://www.w3.org/2004/02/skos/core#notation",
"http://www.w3.org/2004/02/skos/core#prefLabel"
]
}
}
}

0 comments on commit f4dc659

Please sign in to comment.