@Test
 public void testPresentTotalCount() throws URISyntaxException {
   Integer totalResults = new Integer(17);
   Resource thisMetaPage = createMetadata(true, totalResults);
   Literal tr = thisMetaPage.getModel().createTypedLiteral(totalResults);
   assertTrue(thisMetaPage.hasProperty(OpenSearch.totalResults, tr));
 }
 private static List<Resource> equivalentTypes(Resource type) {
   List<Resource> types = new ArrayList<Resource>();
   types.add(type);
   for (StmtIterator it = type.getModel().listStatements(ANY, OWL.equivalentClass, type);
       it.hasNext(); ) types.add(it.nextStatement().getSubject());
   return types;
 }
  @Test
  public void testTermbindsIncludesMetaproperties() throws URISyntaxException {
    Integer totalResults = null;
    Resource thisMetaPage = createMetadata(false, totalResults);

    for (Property p : expectedTermboundProperties) {
      Model model = thisMetaPage.getModel();
      if (!model.contains(null, API.property, p)) {
        fail("term bindings should include " + model.shortForm(p.getURI()));
      }
    }
  }
Exemple #4
0
 @Test
 public void testInfoStamp() {
   String versionString = "E3.14159", commentString = "gloopSmurfale";
   String resourceString =
       "_x eye:assumed 'ABC'; _x eye:checked 'DEF'; _x eye:version '%v'; _x eye:comment '%c'"
           .replaceAll("%v", versionString)
           .replaceAll("%c", commentString);
   InfoStamp i = new InfoStamp(resourceInModel(resourceString));
   Calendar now = Calendar.getInstance();
   Resource root = i.stamp(now);
   Model stamp = root.getModel();
   Literal dateLiteral = ModelFactory.createDefaultModel().createTypedLiteral(now);
   String dateString = "'" + dateLiteral.getLexicalForm() + "'" + dateLiteral.getDatatypeURI();
   String expectedFormat =
       "[eye:assumed 'ABC' & eye:checked 'DEF' & eye:dated <date>"
           + " & eye:comment '<comment>' & eye:version '<version>']";
   String expectedString =
       expectedFormat
           .replaceAll("<date>", dateString)
           .replaceAll("<version>", versionString)
           .replaceAll("<comment>", commentString);
   Model expected = model(expectedString);
   assertIsoModels(expected, stamp);
 }