Changeset 240 for branches/new-datamodel


Ignore:
Timestamp:
03/21/10 18:15:47 (15 years ago)
Author:
lgiessmann
Message:

new-datamodel: changed some code sections that caused problems with "rdf_exporter.lisp"

Location:
branches/new-datamodel/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified branches/new-datamodel/src/model/datamodel.lisp

    r239 r240  
    2121  (:export ;;classes
    2222           :TopicMapConstructC
     23           :VersionedConstructC
     24           :ReifiableConstructC
    2325           :TopicMapC
    2426           :AssociationC
    2527           :RoleC
     28           :CharacteristicC
    2629           :OccurrenceC
    2730           :NameC
    2831           :VariantC
     32           :PointerC
     33           :IdentifierC
    2934           :PersistentIdC
    3035           :ItemIdentifierC
     
    125130           :make-construct
    126131           :list-instanceOf
     132           :list-super-types
    127133           :in-topicmap
    128134           :string-starts-with
     
    132138           :unique-id
    133139           :topic
     140           :referenced-topics
    134141           :revision
    135142           :get-all-revisions-for-tm
     
    15921599
    15931600
    1594 
    1595 (defgeneric list-instanceOf (topic &key tm)
     1601(defgeneric list-instanceOf (topic &key tm revision)
    15961602 (:documentation "Generates a list of all topics that this topic is an
    1597                   instance of, optionally filtered by a topic map"))
    1598 
    1599 
    1600 (defmethod list-instanceOf ((topic TopicC)  &key (tm nil))
    1601   (remove-if
    1602    #'null
    1603    (map 'list #'(lambda(x)
    1604                   (when (loop for psi in (psis (instance-of x))
    1605                            when (string= (uri psi) constants:*instance-psi*)
    1606                            return t)
    1607                     (loop for role in (roles (parent x))
    1608                        when (not (eq role x))
    1609                        return (player role))))
    1610         (if tm
    1611             (remove-if-not
    1612              (lambda (role)
    1613                (in-topicmap tm (parent role)))
    1614              (player-in-roles topic))
    1615             (player-in-roles topic)))))
     1603                  instance of, optionally filtered by a topic map")
     1604 (:method ((topic TopicC) &key (tm nil) (revision 0))
     1605   (declare (type (or null TopicMapC) tm)
     1606            (integer revision))
     1607   (remove-if
     1608    #'null
     1609    (map 'list
     1610         #'(lambda(x)
     1611             (when (loop for psi in (psis (instance-of x :revision revision)
     1612                                          :revision revision)
     1613                      when (string= (uri psi) constants:*instance-psi*)
     1614                      return t)
     1615               (loop for role in (roles (parent x :revision revision)
     1616                                        :revision revision)
     1617                  when (not (eq role x))
     1618                  return (player role :revision revision))))
     1619         (if tm
     1620             (remove-if-not
     1621              (lambda (role)
     1622                (in-topicmap tm (parent role :revision revision)))
     1623              (player-in-roles topic :revision revision))
     1624             (player-in-roles topic :revision revision))))))
     1625 
     1626
     1627(defgeneric list-super-types (topic &key tm revision)
     1628 (:documentation "Generate a list of all topics that this topic is an
     1629  subclass of, optionally filtered by a topic map")
     1630 (:method ((topic TopicC)  &key (tm nil) (revision 0))
     1631   (declare (type (or null TopicMapC) tm)
     1632            (integer revision))
     1633   (remove-if
     1634    #'null
     1635    (map 'list
     1636         #'(lambda(x)
     1637             (when (loop for psi in (psis (instance-of x :revision revision)
     1638                                          :revision revision)
     1639                      when (string= (uri psi) *subtype-psi*)
     1640                      return t)
     1641               (loop for role in (roles (parent x :revision revision)
     1642                                        :revision revision)
     1643                  when (not (eq role x))
     1644                  return (player role :revision revision))))
     1645         (if tm
     1646             (remove-if-not
     1647              (lambda (role)
     1648                (in-topicmap tm (parent role :revision revision)))
     1649              (player-in-roles topic :revision revision))
     1650             (player-in-roles topic :revision revision))))))
    16161651
    16171652
  • TabularUnified branches/new-datamodel/src/rest_interface/read.lisp

    r90 r240  
    6868           ;check if xtm-id has already been imported or if the entry is older
    6969           ;than the snapshot feed. If so, don't do it again
    70            (unless (or (xtm-id-p xtm-id) (string> (atom:updated entry) (atom:updated imported-snapshot-entry)))
     70           (unless (or (string> (atom:updated entry) (atom:updated imported-snapshot-entry)))
    7171             (when top
    7272               (mark-as-deleted top :source-locator source-locator :revision revision))
     
    9999
    100100(defun most-recent-imported-snapshot (all-snapshot-entries)
    101   (let
    102       ((all-imported-entries
    103         (remove-if-not #'xtm-id-p all-snapshot-entries :key #'atom:id)))
    104     (most-recent-entry all-imported-entries)))
     101;  (let
     102;      ((all-imported-entries
     103;       (remove-if-not #'xtm-id-p all-snapshot-entries :key #'atom:id)))
     104;  (most-recent-entry all-imported-entries))
     105  (most-recent-entry all-snapshot-entries))
    105106
    106107(defun import-snapshots-feed (snapshot-feed-url &key tm-id)
  • TabularUnified branches/new-datamodel/src/xml/rdf/exporter.lisp

    r175 r240  
    217217  (if (psis topic)
    218218      (cxml:attribute "rdf:resource"
    219                       (if (reified topic)
     219                      (if (reified-construct topic)
    220220                          (let ((psi (get-reifier-psi topic)))
    221221                            (if psi
     
    593593          (t-assocs (list-rdf-mapped-associations construct)))
    594594      (if psi
    595           (if (reified construct)
     595          (if (reified-construct construct)
    596596              (let ((reifier-uri (get-reifier-uri construct)))
    597597                (if reifier-uri
     
    628628          (sl (locators construct)))
    629629      (if psi
    630           (if (reified construct)
     630          (if (reified-construct construct)
    631631              (let ((reifier-uri (get-reifier-uri construct)))
    632632                (if reifier-uri
  • TabularUnified branches/new-datamodel/src/xml/xtm/importer_xtm1.0.lisp

    r172 r240  
    8484                        parent-construct)
    8585                       ((typep parent-construct 'VariantC)
    86                         (name parent-construct))
     86                        (parent parent-construct))
    8787                       (t
    8888                        (error "from-variant-elem-xtm1.0: parent-construct is neither NameC nor VariantC"))))
     
    395395        (create-instanceof-association instanceOf-topicRef top start-revision :xtm-id xtm-id
    396396                                       :tm tm))
    397       (add-to-topicmap tm top))))
     397      (add-to-tm tm top))))
    398398
    399399
     
    421421        (format t "from-association-elem-xtm1.0: type is missing -> http://www.topicmaps.org/xtm/1.0/core.xtm#association~%")
    422422        (setf type (get-item-by-id "association" :xtm-id "core.xtm")))
    423       (add-to-topicmap tm
     423      (add-to-tm tm
    424424                       (make-construct 'AssociationC
    425425                                       :start-revision start-revision
  • TabularUnified branches/new-datamodel/src/xml/xtm/importer_xtm2.0.lisp

    r173 r240  
    314314                                       :tm tm
    315315                                       :xtm-id xtm-id))
    316       (add-to-topicmap tm top)
     316      (add-to-tm tm top)
    317317      top))))
    318318
     
    387387         (reifier-topic (get-reifier-topic assoc-elem)))
    388388      (setf roles (set-standard-role-types roles)); sets standard role types if there are missing some of them
    389       (add-to-topicmap
     389      (add-to-tm
    390390       tm
    391391       (make-construct 'AssociationC
     
    416416        ((topic-vector (get-topic-elems xtm-dom)))
    417417      (loop for top-elem across topic-vector do
    418            (add-to-topicmap
     418           (add-to-tm
    419419            tm 
    420420            (from-topic-elem-to-stub top-elem revision
Note: See TracChangeset for help on using the changeset viewer.