コード例 #1
0
 def fromNullableList(cls, nullableList):
     """ generated source for method fromNullableList """
     builder = ImmutableMap.builder()
     i = 0
     while i < len(nullableList):
         if nullableList.get(i) != None:
             builder.put(i, nullableList.get(i))
         i += 1
     return builder.build()
コード例 #2
0
 def copyUsingCartesianDomains(cls, otherModel):
     """ generated source for method copyUsingCartesianDomains """
     if isinstance(otherModel, (ImmutableSentenceDomainModel, )):
         return otherModel
     domains = ImmutableMap.builder()
     for form in otherModel.getSentenceForms():
         while i < form.getTupleSize():
             domainsForSlots.add(otherDomain.getDomainForSlot(i))
             i += 1
         domains.put(form, CartesianSentenceFormDomain.create(form, domainsForSlots))
     return ImmutableSentenceDomainModel(ImmutableSentenceFormModel.copyOf(otherModel), domains.build())
コード例 #3
0
ファイル: SimpleSentenceForm.py プロジェクト: hobson/ggpy
 def create_0(cls, function_):
     """ generated source for method create_0 """
     name = function_.__name__
     arity = function_.arity()
     tupleSize = 0
     functions = Maps.newHashMap()
     i = 0
     while i < arity:
         if isinstance(term, (GdlFunction, )):
             functions.put(i, functionForm)
             tupleSize += functionForm.getTupleSize()
         else:
             tupleSize += 1
         i += 1
     return SimpleSentenceForm(name, arity, ImmutableMap.copyOf(functions), tupleSize)
コード例 #4
0
ファイル: MutableFunctionInfo.py プロジェクト: hobson/ggpy
 def addTuple(self, sentenceTuple):
     """ generated source for method addTuple """
     if len(sentenceTuple) != self.form.getTupleSize():
         raise IllegalArgumentException()
     # For each slot...
     i = 0
     while i < len(sentenceTuple):
         if self.dependentSlots.get(i):
             # Either add to that entry, or invalidate the slot
             lookupTuple.remove(i)
             if curValue == None:
                 # Just add to the map
                 valueMap.put(ImmutableList.copyOf(lookupTuple), newValue)
             else:
                 # If this isn't the existing sentence, invalidate this slot
                 if curValue != newValue:
                     self.dependentSlots.set(i, False)
                     self.valueMaps.set(i, ImmutableMap.of())
         i += 1
コード例 #5
0
ファイル: SentenceFormsFinder.py プロジェクト: hobson/ggpy
 def addTrueSentencesToModel(self):
     """ generated source for method addTrueSentencesToModel """
     for gdl in description:
         ConcurrencyUtils.checkForInterruption()
         if isinstance(gdl, (GdlSentence, )):
             addSentenceToModel(gdl, ImmutableMap.of())
コード例 #6
0
 def create(cls, formModel, domains):
     """ generated source for method create """
     return ImmutableSentenceDomainModel(ImmutableSentenceFormModel.copyOf(formModel), ImmutableMap.copyOf(domains))
コード例 #7
0
ファイル: ddsite.py プロジェクト: minorg/dressdiscover
put_institution(
    data_rights=\
        RightsSet.Builder()
            .setElements(ImmutableList.of(
                Rights.Builder()
                    .setRightsHolder('University of North Texas')
                    .setText("The contents of Texas Fashion Collection, hosted by the University of North Texas Libraries (digital content including images, text, and sound and video recordings) are made publicly available by the collection-holding partners for use in research, teaching, and private study. For the full terms of use, see http://digital.library.unt.edu/terms-of-use/")
                    .setType(RightsType.COPYRIGHTED)
                    .build()
            ))
            .build(),
    institution_id=InstitutionId.parse('untvca'),
    institution_title='Texas Fashion Collection',
    institution_url=Url.parse('http://digital.library.unt.edu/explore/collections/TXFC/'),
    store_parameters=ImmutableMap.of(
        'record_mapper', TxfcOaiPmhRecordMapper.__module__ + '.' + TxfcOaiPmhRecordMapper.__name__  # @UndefinedVariable
    ),
)
put_collection(
    collection_id=CollectionId.parse('untvca/txfc'),
    institution_id=InstitutionId.parse('untvca'),
    object_store_uri=Uri.parse(OaiPmhFsObjectStore.URI_SCHEME + ':/' + os.path.join(data_dir_path, 'untvca', 'txfc').replace(os.path.sep, '/')),
    title='Texas Fashion Collection'
)

put_institution(
    collection_store_uri=Uri.parse(OmekaFsCollectionStore.URI_SCHEME + ':/' + data_dir_path.replace(os.path.sep, '/')),
    institution_id=InstitutionId.parse('vccc'),
    institution_title='Vassar College Costume Collection',
    institution_url=Url.parse('http://vcomeka.com/vccc/'),
    store_parameters=ImmutableMap.of(
コード例 #8
0
ファイル: VariableConstrainer.py プロジェクト: hobson/ggpy
 def create(cls, original, replacementsByOriginalTupleIndex, replacement):
     """ generated source for method create """
     return cls.Ambiguity(original, ImmutableMap.copyOf(replacementsByOriginalTupleIndex), replacement)
コード例 #9
0
ファイル: AssignmentFunction.py プロジェクト: hobson/ggpy
 def create(cls, conjunct, functionInfo, rightmostVar, varOrder, preassignment):
     """ generated source for method create """
     # We have to set up the things mentioned above...
     internalFunctions = ArrayList()
     # We can traverse the conjunct for the list of variables/constants...
     terms = ArrayList()
     gatherVars(conjunct.getBody(), terms)
     # Note that we assume here that the var of interest only
     # appears once in the relation...
     varIndex = terms.indexOf(rightmostVar)
     if varIndex == -1:
         print "conjunct is: " + conjunct
         print "terms are: " + terms
         print "righmostVar is: " + rightmostVar
     terms.remove(rightmostVar)
     function_ = functionInfo.getValueMap(varIndex)
     # Set up inputs and such, using terms
     querySize = len(terms)
     isInputConstant = ArrayList(len(terms))
     queryConstants = Maps.newHashMap()
     queryInputIndices = ArrayList(len(terms))
     i = 0
     while i < len(terms):
         if isinstance(term, (GdlConstant, )):
             isInputConstant.add(True)
             queryConstants.put(i, term)
             queryInputIndices.add(-1)
         elif isinstance(term, (GdlVariable, )):
             # Is it in the head assignment?
             if preassignment.containsKey(term):
                 isInputConstant.add(True)
                 queryConstants.put(i, preassignment.get(term))
                 queryInputIndices.add(-1)
             else:
                 isInputConstant.add(False)
                 # 						queryConstants.add(null);
                 # What value do we put here?
                 # We want to grab some value out of the
                 # input tuple, which uses functional ordering
                 # Index of the relevant variable, by the
                 # assignment's ordering
                 queryInputIndices.add(varOrder.indexOf(term))
         i += 1
     return AssignmentFunction(ImmutableList.copyOf(internalFunctions), querySize, ImmutableList.copyOf(isInputConstant), ImmutableMap.copyOf(queryConstants), ImmutableList.copyOf(queryInputIndices), ImmutableMap.copyOf(function_))
コード例 #10
0
ファイル: SentenceDomainModels.py プロジェクト: hobson/ggpy
 def combineDomains(cls, varDomainsByVar):
     """ generated source for method combineDomains """
     return ImmutableMap.copyOf(Maps.transformValues(varDomainsByVar.asMap(), Function()))
コード例 #11
0
 def create(cls, varsToAssign, tuplesBySource, headAssignment, indicesToChangeWhenNull, distincts, varsToChangePerDistinct, valuesToCompute, sourceDefiningSlot, valuesToIterate, varsChosenBySource, putDontCheckBySource, empty, allDone):
     """ generated source for method create """
     if empty:
         return cls.EMPTY_ITERATION_PLAN
     return AssignmentIterationPlan(ImmutableList.copyOf(varsToAssign), ImmutableList.copyOf(tuplesBySource), ImmutableMap.copyOf(headAssignment), ImmutableList.copyOf(indicesToChangeWhenNull), ImmutableList.copyOf(distincts), fromNullableList(varsToChangePerDistinct), fromNullableList(valuesToCompute), ImmutableList.copyOf(sourceDefiningSlot), ImmutableList.copyOf(valuesToIterate), ImmutableList.copyOf(varsChosenBySource), ImmutableList.copyOf(putDontCheckBySource), empty, allDone)