[pypy-svn] r27701 - in pypy/dist/pypy/lib/pyontology: . test

ale at codespeak.net ale at codespeak.net
Fri May 26 11:36:18 CEST 2006


Author: ale
Date: Fri May 26 11:36:10 2006
New Revision: 27701

Modified:
   pypy/dist/pypy/lib/pyontology/constraint_classes.py
   pypy/dist/pypy/lib/pyontology/pyontology.py
   pypy/dist/pypy/lib/pyontology/test/test_ontology.py
Log:
Found the bug I think

Modified: pypy/dist/pypy/lib/pyontology/constraint_classes.py
==============================================================================
--- pypy/dist/pypy/lib/pyontology/constraint_classes.py	(original)
+++ pypy/dist/pypy/lib/pyontology/constraint_classes.py	Fri May 26 11:36:10 2006
@@ -28,10 +28,10 @@
 
     cost = 10
 
-    def __init__(self, prop, cls_name, var, comp):
+    def __init__(self, prop,  var, comp):
         AbstractConstraint.__init__(self, [prop])
         self.check_individual = "domains['%s'].getValues() != []" % prop
-        self.formula = "len(domains['%s'].getValuesPrKey('%s')) %s int(%s)"% (prop, cls_name, comp, var)
+        self.formula = "len(domains['%s'].getValuesPrKey('%s')) %s int(%s)"% (prop, var, comp, var)
 
     def estimateCost(self, domains):
         return self.cost

Modified: pypy/dist/pypy/lib/pyontology/pyontology.py
==============================================================================
--- pypy/dist/pypy/lib/pyontology/pyontology.py	(original)
+++ pypy/dist/pypy/lib/pyontology/pyontology.py	Fri May 26 11:36:10 2006
@@ -634,14 +634,11 @@
         self.resolve_item(s)
         log("%r %sCardinality %r "%(s, card, var))
         svar =self.make_var(Restriction, s)
-        cls = list(self.graph.subjects(None,s))[0]
-        self.resolve_item(cls)
-        cls_name = self.make_var(ClassDomain, cls)
         prop = self.variables[svar].property
         assert prop
         comp = {'max': '<', 'min': '>'}.get(card, '=')
         self.variables[svar].TBox[prop] = {'Cardinality': [( comp, int(var))]}
-        self.constraints.append(CardinalityConstraint(prop, cls, var, comp+'='))
+        self.constraints.append(CardinalityConstraint(prop, var, comp+'='))
 
     def maxCardinality(self, s, var):
         """ Len of finite domain of the property shall be less than or equal to var"""

Modified: pypy/dist/pypy/lib/pyontology/test/test_ontology.py
==============================================================================
--- pypy/dist/pypy/lib/pyontology/test/test_ontology.py	(original)
+++ pypy/dist/pypy/lib/pyontology/test/test_ontology.py	Fri May 26 11:36:10 2006
@@ -498,7 +498,6 @@
 
 
 def test_terminology_cardinality():
-    py.test.skip("There is a bug in here somewhere")
     # Modeled after one of the standard tests (approved/maxCardinality)
     # 'cls' by subclassing two maxCardinality restrictions becomes the set of
     # individuals satisfying both restriction, ie having exactly 2 values of
@@ -525,7 +524,6 @@
     py.test.raises(ConsistencyFailure, O.check_TBoxes)
 
 def test_terminology_subclassof_cardinality():
-    py.test.skip("There is a bug in here somewhere")
     cls = URIRef('cls')
     cls2 = URIRef('cls2')
     O = Ontology()



More information about the Pypy-commit mailing list