コード例 #1
0
 public void testParseOpenedInterval() throws Exception {
   loadRemoteOntologyWithProtegeMetadataOntology();
   RDFProperty subDatatypeOfProperty = XSPNames.getRDFProperty(owlModel, XSPNames.XSP_BASE);
   RDFProperty maxExclusiveProperty =
       XSPNames.getRDFProperty(owlModel, XSPNames.XSP_MAX_EXCLUSIVE);
   String expression = "xsd:int(..,24)";
   Map map = DefaultRDFSDatatype.parse(owlModel, expression);
   assertEquals(2, map.size());
   assertEquals(owlModel.getXSDint(), map.get(subDatatypeOfProperty));
   assertEquals(
       owlModel.createRDFSLiteral("24", owlModel.getXSDint()), map.get(maxExclusiveProperty));
 }
コード例 #2
0
 public void testGetBaseDatatype() throws Exception {
   loadRemoteOntologyWithProtegeMetadataOntology();
   RDFSDatatype datatype = owlModel.createRDFSDatatype("intOver18");
   RDFProperty subDatatypeOfProperty = XSPNames.getRDFProperty(owlModel, XSPNames.XSP_BASE);
   datatype.setPropertyValue(subDatatypeOfProperty, owlModel.getXSDint());
   assertEquals(owlModel.getXSDint(), datatype.getBaseDatatype());
 }
コード例 #3
0
 public void testUserDefinedIntType() throws Exception {
   loadRemoteOntologyWithProtegeMetadataOntology();
   String name = owlModel.getNextAnonymousResourceName();
   RDFSDatatype datatype = owlModel.createRDFSDatatype(name);
   RDFProperty subDatatypeOfProperty = XSPNames.getRDFProperty(owlModel, XSPNames.XSP_BASE);
   datatype.setPropertyValue(subDatatypeOfProperty, owlModel.getXSDint());
   RDFProperty minInclusiveProperty =
       XSPNames.getRDFProperty(owlModel, XSPNames.XSP_MIN_INCLUSIVE);
   datatype.setPropertyValue(minInclusiveProperty, new Integer(18));
   RDFProperty maxInclusiveProperty =
       XSPNames.getRDFProperty(owlModel, XSPNames.XSP_MAX_INCLUSIVE);
   datatype.setPropertyValue(maxInclusiveProperty, new Integer(24));
   assertEquals(
       owlModel.createRDFSLiteral("24", owlModel.getXSDint()), datatype.getMaxInclusive());
   RDFProperty property = owlModel.createOWLDatatypeProperty("property");
   property.setRange(datatype);
   assertEquals("int[18,24]", datatype.getBrowserText());
 }