Skip to content

Instantly share code, notes, and snippets.

@bjfish
Created April 18, 2010 20:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bjfish/370521 to your computer and use it in GitHub Desktop.
Save bjfish/370521 to your computer and use it in GitHub Desktop.
import groovy.grape.Grape
import groovy.net.xmlrpc.*
// Gets dependencies
@Grab(group='org.codehaus.groovy', module='groovy-xmlrpc', version='0.7')
def getGrapes(){}
def c = new XMLRPCServerProxy("http://localhost:8090/ZXmlRpcServer/zXmlRpcServlet")
//Gets all hierarchy classes
def results = c.ZXmlRpcApi.listHierachyClasses()
println(results)
//Gets concept instances
def conceptId = "WorkProduct,Document"
def results1 = c.ZXmlRpcApi.getConceptInstances(conceptId)
//println(results1)
//Run SPARQL Query
def query = """
SELECT
?label ?concept
FROM
<model:BaseModel>
WHERE {
?concept rdf:type owl:Class .
?concept rdfs:label ?label .
}
"""
def results2 = c.ZXmlRpcApi.doQuery(query)
println(results2)
//Get Instance Properties
def propInstanceId = "WorkProduct,docId"
def results4 = c.ZXmlRpcApi.getInstanceProperties(propInstanceId)
println(results4)
//Get Concept Properties
def concInstanceId = "WorkProduct,Document"
def results5 = c.ZXmlRpcApi.getConceptProperties(concInstanceId)
println(results5)
//Remove an individual - untested
def delInstanceId = ""
def results3 = c.ZXmlRpcApi.removeInstance(delInstanceId)
println(results3)
// Get Page Concept Instances - untested
def conceptId = ""
def pageNumber = ""
def individualPerPage = ""
def results6 = c.ZXmlRpcApi.getPageConceptInstances(conceptId, pageNumber, individualPerPage)
println(results6)
// Get Instance From Reference URL - untested
def url = ""
def results7 = c.ZXmlRpcApi.getInstanceFromReferenceUrl(url)
println(results7)
// Create instance of an individual - untested
def map = [:]
def results8 = c.ZXmlRpcApi.createInstance(map)
println(results8)
// Gets Individuals By Label - untested
def conceptId = ""
def label = ""
def results9 = c.ZXmlRpcApi.getIndividualsByLabel(conceptId, label)
println(results9)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment