001package org.biopax.paxtools.query.wrapperL3;
002
003import org.biopax.paxtools.controller.PathAccessor;
004import org.biopax.paxtools.model.level3.PhysicalEntity;
005
006/**
007 * Filter by organism. Applied to PhysicalEntity. Checks if their EntityReference is associated with
008 * one of the given organisms.
009 *
010 * @author Ozgun Babur
011 */
012public class OrganismFilter extends StringFieldFilter
013{
014        /**
015         * Constructor.
016         * @param organism organisms to select
017         */
018        public OrganismFilter(String[] organism)
019        {
020                super(true, organism);
021        }
022
023        /**
024         * Creates the accessor from PhysicalEntity to the organism of related EntityReference.
025         */
026        @Override
027        public void createFieldAccessors()
028        {
029                addAccessor(new PathAccessor("PhysicalEntity/entityReference/organism/name"),
030                        PhysicalEntity.class);
031                addAccessor(new PathAccessor("PhysicalEntity/entityReference/organism/xref:UnificationXref/id"),
032                        PhysicalEntity.class);
033        }
034}