Patent Fetcher Button

Summary: This button functions within the Markush data infrastructure. When the button is placed on an Inventions form, it will fetch all the patents associated with the selected invention. From there, it determines the master patent and offers to launch the webpage associated with the patent, or providing a combination of patent websites and patents from the invention. It also provides links to a variety of patent repositories for other countries.

This script is a good example of using SwingBuilder and GridBagLayout to make clean input pop-ups. This button is on a query form, a dataTree with the necessary table containing the invention information as a secondary child (VMNS is a child of Query/root and Inventions is a child of VMNS). This is also a nice example for finding and using nested child tables.

/** Patent Fetcher
*
* Usage: Button on a Query form in the Markush Demo Data set, which has the edges of VMNS and then Inventions.
* It can be adapted to other dataTrees by locating the Inventions table among the dataTree
*
* @author Erin Bolstad ([email protected])
* Dec 2011
*/
import java.awt.Desktop
import com.im.commons.progress.*
import groovy.swing.SwingBuilder
import javax.swing.SwingUtilities

evaluate = { widget ->
if (SwingUtilities.isEventDispatchThread()) {
Thread.start() {
evaluateImpl(widget)
}
} else {
evaluateImpl(widget)
}
}

evaluateImpl = { widget ->

def rs = widget.form.resultSet
def dataTree = rs.getDataTree()
def VMNSvertex = dataTree.rootVertex.edges.find { it.destination.entity.name == 'VMNS' }
def inventionVertex = VMNSvertex.destination.edges.find { it.destination.entity.name == 'Inventions' }
def inventionEty = inventionVertex.destination.entity
def inventionPatentFld = inventionEty.fields.items.find { it.name == 'Patents' }
def invenV = inventionVertex.getDestination()
def invenVS = rs.getVertexState(invenV)

def invenIds = invenVS.selectedRowsIds
def invenFirstId = invenIds.get(0)

def invenGetData = invenVS.getData([invenFirstId], DFEnvironmentRO.DEV_NULL)
def patArray = invenGetData[invenFirstId][inventionPatentFld.id]
def patMaster = patArray.replace("*", "master")
def patentArray = patMaster.split("\\r?\\n")

patArray = ["-"]
patentArray.eachWithIndex { num, m ->
def trimLocation = num.indexOf("-")
def patentTrimmed = num.subSequence(0, trimLocation)
patArray.add(patentTrimmed)
if (num.contains("master")){
MASTER_PATENT = num
}
}

// Clean the master patent

def masterRemoved = MASTER_PATENT.replace("master", "")
def blanksRemoved = masterRemoved.replace(" ", "")

MASTER_PATENT = blanksRemoved

// master patent now to be matched against resource

def patentToTrim = MASTER_PATENT
def patentAssignment = MASTER_PATENT.substring(0, 2)

switch (patentAssignment) {
case "WO":
def trimLocation = patentToTrim.indexOf("-")
def patentTrimmed = patentToTrim.subSequence(0, trimLocation)
LEAD = "http://www.wipo.int/patentscope/search/en/detail.jsf?docId=" + patentTrimmed
break

case "US":
def trimLocation = patentToTrim.indexOf("-")
def endTrimmed = patentToTrim.subSequence(0, trimLocation)
def patentLength = endTrimmed.length()
def patentTrimmed = endTrimmed.subSequence(2, patentLength)
LEAD = "http://www.patentlens.net/patentlens/patents.html?patnums=US_" + patentTrimmed + "&returnTo=patentnumber.html" + patentTrimmed
break

default:
def trimLocation = patentToTrim.indexOf("-")
def patentTrimmed = patentToTrim.subSequence(0, trimLocation)
LEAD = "http://worldwide.espacenet.com/searchResults?DB=EPODOC&submitted=true&locale=en_EP&ST=singleline&compact=false&DB=EPODOC&query=" + patentTrimmed
break
}



def s = new SwingBuilder()

s.setVariable('myDialog-properties',[:])

def vars = s.variables

patentToTrim = MASTER_PATENT
def trimLocation = patentToTrim.indexOf("-")
def leadButton = patentToTrim.subSequence(0, trimLocation)

def dial = s.dialog(title:'Patent Selection',id:'myDialog',modal:true) {
panel() {
gridBagLayout()
label (text:"Retrieve the lead patent using our best guess to the location:", constraints:gbc(
gridx:0,
gridy:0,
insets:[10,20,10,0]))
button (id:'lead', label:"Lead Patent: $leadButton", constraints:gbc(
gridx:1,
gridy:0,
insets:[10,0,10,20],
anchor:LINE_START),
actionPerformed: {
vars.buttonResult = 'lead'
dispose()})
label(text:"---", constraints:gbc(
gridy:1,
gridwidth:2))
label(text:"Or, select the patent from the invention to view, and the web location", constraints:gbc(
gridy:2,
gridwidth:2,
insets:[10,0,0,0]))
label(text:"Some sites only work with patents from certain countries.", constraints:gbc(
gridy:3,
gridwidth:2,
insets:[0,0,10,0]))
label(text:"Select patent", constraints:gbc(
gridx:0,
gridy:4,
anchor:LINE_END))
comboBox(id:'patents', items:patArray, constraints:gbc(
gridx:1,
gridy:4,
anchor:LINE_START))
label(text:"Select patent repository", constraints:gbc(
gridx:0,
gridy:5,
insets:[0,0,10,0],
anchor:LINE_END))
comboBox(id:'patentLoc', items:['-', 'EP Patent Register', 'PatentScope (WIPO)', 'PatentLens'], constraints:gbc(
gridx:1,
gridy:5,
insets:[0,0,10,0],
anchor:LINE_START))
button(id:'search', label:"Search Patent/Location Combo", constraints:gbc(
gridx:0,
gridy:6,
insets:[0,0,10,0],
anchor:LINE_END),
actionPerformed: {
vars.buttonResult = 'search'
dispose()})
button(id:'cancel', label:"Cancel", constraints:gbc(
gridx:1,
gridy:6,
anchor:LINE_START,
insets:[0,0,10,0]),
actionPerformed: {
vars.buttonResult = 'cancel'
dispose()})
label(text:"---", constraints:gbc(
gridy:7,
gridwidth:2))
label(text:"Some patent sites block external programs, or are not used often.", constraints:gbc(
gridy:8,
gridwidth:2,
insets:[10,0,0,0]))
label(text:"Jump to the country specific patent websites using the menu below.", constraints:gbc(
gridy:9,
gridwidth:2,
insets:[0,0,10,0]))
comboBox(id:'othersites', items:['-', 'JP: IDPL', 'CA: CIPO', 'AU: AusPat', 'KR: Korea', 'HK: PatentSearch', 'TW: Taiwan IPO', 'SG: IPOS', 'DE: DPMA', 'RU: FIPS', 'ID: IPDL'], constraints:gbc(
gridx:0,
gridy:10,
insets:[0,0,10,0],
anchor:LINE_END))
button(id:'otherok', label:"Go To Site", constraints:gbc(
gridx:1,
gridy:10,
insets:[0,0,10,0],
anchor:LINE_START),
actionPerformed: {
vars.buttonResult = 'otherok'
dispose()})

}
}

dial.pack()
dial.setLocationRelativeTo(null)
dial.show()

chosenAction = vars.buttonResult

switch (chosenAction) {
case "cancel":
return
break
case "lead":
def temp = LEAD
GOTOURL = temp
break
case "search":
def patentWebsite = vars.patentLoc.selectedItem
def patentTrimmed = vars.patents.selectedItem

switch (patentWebsite) {
case "EP Patent Register":
GOTOURL = "http://worldwide.espacenet.com/searchResults?DB=EPODOC&submitted=true&locale=en_EP&ST=singleline&compact=false&DB=EPODOC&query=" + patentTrimmed
break
case "PatentScope (WIPO)":
GOTOURL = "http://www.wipo.int/patentscope/search/en/detail.jsf?docId=" + patentTrimmed
break
case "PatentLens":
GOTOURL = "http://www.patentlens.net/patentlens/patents.html?patnums=" + patentTrimmed + "&returnTo=patentnumber.html" + patentTrimmed
break
}
break
case "otherok":
goToLoc = vars.othersites.selectedItem
switch (goToLoc) {
case "JP: IDPL":
GOTOURL = "http://www.ipdl.inpit.go.jp/homepg_e.ipdl"
break
case "CA: CIPO":
GOTOURL = "http://brevets-patents.ic.gc.ca/opic-cipo/cpd/eng/introduction.html"
break
case "AU: AusPat":
GOTOURL = "http://www.ipaustralia.gov.au/auspat/index.htm"
break
case "KR: Korea":
GOTOURL = "http://patent2.kipris.or.kr/pateng/searchLogina.do?next=GeneralSearch"
break
case "HK: PatentSearch":
GOTOURL = "http://ipsearch.ipd.gov.hk/patent/main.jsp?LANG=en"
break
case "TW: Taiwan IPO":
GOTOURL = "http://www.tipo.gov.tw/en/index.aspx"
break
case "SG: IPOS":
GOTOURL = "http://www.epatents.gov.sg/default_redirect.asp"
break
case "DE: DPMA":
GOTOURL = "http://register.dpma.de/DPMAregister/Uebersicht"
break
case "RU: FIPS":
GOTOURL = "http://www1.fips.ru/wps/wcm/connect/content_en/en/main+/"
break
case "ID: IPDL":
GOTOURL = "http://ipdl.dgip.go.id"
break
}
break
}

URI testUrl = new URI(GOTOURL)

Desktop desktop = Desktop.getDesktop()
desktop.browse(testUrl)
}

Versions: This script has been tested on IJC versions 5.8


Copyright © 1999-2012 ChemAxon Ltd.    All rights reserved.