-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSWDiscoveryHelperJs.scala
36 lines (27 loc) · 1.5 KB
/
SWDiscoveryHelperJs.scala
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package fr.inrae.metabohub.semantic_web
import fr.inrae.metabohub.semantic_web.rdf.URI
import scala.scalajs.js
import scala.scalajs.js.Promise
import scala.scalajs.js.annotation.{JSExport, JSExportTopLevel}
import scala.scalajs.js.JSConverters._
@JSExportTopLevel(name="SWDiscoveryHelper")
case class SWDiscoveryHelperJs(sw : SWDiscovery) {
implicit val ec: scala.concurrent.ExecutionContext = scala.concurrent.ExecutionContext.global
@JSExport
def count(lRef: js.Array[String],distinct : Boolean=false): Promise[Int] = { sw.finder.count(lRef.toSeq,distinct).toJSPromise }
@JSExport
def classes(regex : String = "",uri:URI = URI(""), page : Int = 0 ): Promise[js.Array[URI]] =
{ sw.finder.classes(regex,uri,page).map(array => array.toJSArray).toJSPromise }
@JSExport
def objectProperties(regex : String = "",motherClassProperties: URI = URI(""), page : Int = 0 ) : Promise[js.Array[URI]] = {
sw.finder.objectProperties(regex,motherClassProperties,page).map(array => array.toJSArray).toJSPromise
}
@JSExport
def datatypeProperties(regex : String = "",motherClassProperties: URI = URI("") , page : Int = 0) : Promise[js.Array[URI]] = {
sw.finder.datatypeProperties(regex,motherClassProperties,page).map(array => array.toJSArray).toJSPromise
}
@JSExport
def subjectProperties(regex : String = "",motherClassProperties: URI = URI("") , page : Int = 0) : Promise[js.Array[URI]] = {
sw.finder.subjectProperties(regex,motherClassProperties,page).map(array => array.toJSArray).toJSPromise
}
}