Permalink
Browse files

Merge branch 'master' of https://github.com/SciGraph/SciGraph into up…

…stream
  • Loading branch information...
tgbugs committed Jun 15, 2017
2 parents 3e1c0e1 + 46049b9 commit 4633a799cc67f5c48e2a52aee1f77e47cae13dac
Showing with 3,365 additions and 14,059 deletions.
  1. +0 −2 .travis.yml
  2. +1 −1 README.md
  3. +2 −2 SciGraph-analysis/pom.xml
  4. +7 −8 SciGraph-analysis/src/main/java/io/scigraph/analyzer/HyperGeometricAnalyzer.java
  5. +1 −1 SciGraph-analysis/src/test/java/io/scigraph/analyzer/HyperGeometricAnalyzerTest.java
  6. +19 −9 SciGraph-core/pom.xml
  7. +24 −13 SciGraph-core/src/main/java/io/scigraph/bbop/BbopGraphUtil.java
  8. +5 −6 SciGraph-core/src/main/java/io/scigraph/internal/CypherUtil.java
  9. +29 −25 SciGraph-core/src/main/java/io/scigraph/internal/EvidenceAspect.java
  10. +97 −29 SciGraph-core/src/main/java/io/scigraph/internal/GraphApi.java
  11. +73 −41 SciGraph-core/src/main/java/io/scigraph/internal/TinkerGraphUtil.java
  12. +3 −5 SciGraph-core/src/main/java/io/scigraph/internal/reachability/ReachabilityIndex.java
  13. +8 −10 SciGraph-core/src/main/java/io/scigraph/lucene/ExactAnalyzer.java
  14. +16 −14 SciGraph-core/src/main/java/io/scigraph/lucene/LuceneUtils.java
  15. +47 −18 SciGraph-core/src/main/java/io/scigraph/lucene/VocabularyIndexAnalyzer.java
  16. +33 −17 SciGraph-core/src/main/java/io/scigraph/lucene/VocabularyQueryAnalyzer.java
  17. +1 −2 SciGraph-core/src/main/java/io/scigraph/neo4j/DirectedRelationshipType.java
  18. +1 −1 SciGraph-core/src/main/java/io/scigraph/neo4j/Graph.java
  19. +11 −10 SciGraph-core/src/main/java/io/scigraph/neo4j/GraphBatchImpl.java
  20. +5 −5 SciGraph-core/src/main/java/io/scigraph/neo4j/GraphTransactionalImpl.java
  21. +3 −3 SciGraph-core/src/main/java/io/scigraph/neo4j/GraphUtil.java
  22. +10 −0 SciGraph-core/src/main/java/io/scigraph/neo4j/Neo4jConfiguration.java
  23. +53 −18 SciGraph-core/src/main/java/io/scigraph/neo4j/Neo4jModule.java
  24. +1 −2 SciGraph-core/src/main/java/io/scigraph/owlapi/CategoryLabeler.java
  25. +81 −46 SciGraph-core/src/main/java/io/scigraph/owlapi/GraphOwlVisitor.java
  26. +3 −3 SciGraph-core/src/main/java/io/scigraph/owlapi/OwlApiUtils.java
  27. +16 −17 SciGraph-core/src/main/java/io/scigraph/owlapi/OwlLabels.java
  28. +31 −21 SciGraph-core/src/main/java/io/scigraph/owlapi/OwlPostprocessor.java
  29. +18 −16 SciGraph-core/src/main/java/io/scigraph/owlapi/OwlRelationships.java
  30. +4 −2 SciGraph-core/src/main/java/io/scigraph/owlapi/curies/CurieAdder.java
  31. +0 −111 SciGraph-core/src/main/java/io/scigraph/owlapi/curies/CurieUtil.java
  32. +71 −27 SciGraph-core/src/main/java/io/scigraph/owlapi/loader/BatchOwlLoader.java
  33. +43 −20 SciGraph-core/src/main/java/io/scigraph/owlapi/loader/OwlLoadConfiguration.java
  34. +7 −6 SciGraph-core/src/main/java/io/scigraph/owlapi/loader/OwlLoadConfigurationLoader.java
  35. +61 −39 SciGraph-core/src/main/java/io/scigraph/owlapi/loader/OwlLoaderModule.java
  36. +17 −0 SciGraph-core/src/main/java/io/scigraph/owlapi/loader/OwlOntologyProducer.java
  37. +29 −37 ....java → SciGraph-core/src/main/java/io/scigraph/owlapi/loader/bindings/IndicatesAddEdgeLabel.java
  38. +29 −0 SciGraph-core/src/main/java/io/scigraph/owlapi/loader/bindings/IndicatesAllNodesLabel.java
  39. +29 −0 SciGraph-core/src/main/java/io/scigraph/owlapi/loader/bindings/IndicatesAnonymousNodeProperty.java
  40. +64 −0 SciGraph-core/src/main/java/io/scigraph/owlapi/postprocessors/AllNodesLabeler.java
  41. +64 −0 SciGraph-core/src/main/java/io/scigraph/owlapi/postprocessors/AnonymousNodeTagger.java
  42. +55 −50 SciGraph-core/src/main/java/io/scigraph/owlapi/postprocessors/Clique.java
  43. +9 −0 SciGraph-core/src/main/java/io/scigraph/owlapi/postprocessors/CliqueConfiguration.java
  44. +89 −0 SciGraph-core/src/main/java/io/scigraph/owlapi/postprocessors/EdgeLabeler.java
  45. +5 −4 SciGraph-core/src/main/java/io/scigraph/vocabulary/Vocabulary.java
  46. +90 −64 SciGraph-core/src/main/java/io/scigraph/vocabulary/VocabularyNeo4jImpl.java
  47. +7 −9 SciGraph-core/src/test/java/io/scigraph/internal/CypherUtilTest.java
  48. +15 −11 SciGraph-core/src/test/java/io/scigraph/internal/EvidenceAspectTest.java
  49. +8 −9 SciGraph-core/src/test/java/io/scigraph/internal/GraphApiNeighborhoodTest.java
  50. +97 −10 SciGraph-core/src/test/java/io/scigraph/internal/GraphApiTest.java
  51. +39 −23 SciGraph-core/src/test/java/io/scigraph/internal/TinkerGraphUtilTest.java
  52. +1 −1 SciGraph-core/src/test/java/io/scigraph/internal/reachability/ReachabilityIndexPerfIT.java
  53. +1 −2 SciGraph-core/src/test/java/io/scigraph/internal/reachability/ReachabilityIndexTest.java
  54. +9 −9 SciGraph-core/src/test/java/io/scigraph/lucene/VocabularyAnalyzerTest.java
  55. +4 −5 SciGraph-core/src/test/java/io/scigraph/neo4j/DirectedRelationshipTypeTest.java
  56. +12 −17 SciGraph-core/src/test/java/io/scigraph/neo4j/GraphBatchImplIT.java
  57. +5 −7 SciGraph-core/src/test/java/io/scigraph/neo4j/GraphBatchImplMultipleLoadTest.java
  58. +1 −1 SciGraph-core/src/test/java/io/scigraph/neo4j/GraphBatchImplTest.java
  59. +2 −3 SciGraph-core/src/test/java/io/scigraph/neo4j/GraphDump.java
  60. +11 −13 SciGraph-core/src/test/java/io/scigraph/neo4j/GraphTestBase.java
  61. +3 −4 SciGraph-core/src/test/java/io/scigraph/neo4j/GraphUtilTest.java
  62. +2 −2 SciGraph-core/src/test/java/io/scigraph/neo4j/Neo4jIndexingTest.java
  63. +2 −2 SciGraph-core/src/test/java/io/scigraph/neo4j/Neo4jModuleTest.java
  64. +5 −6 SciGraph-core/src/test/java/io/scigraph/neo4j/RelationshipMapTest.java
  65. +124 −0 SciGraph-core/src/test/java/io/scigraph/neo4j/SchemaIndexesTest.java
  66. +2 −1 SciGraph-core/src/test/java/io/scigraph/owlapi/GraphOwlVisitorBatchGraphTest.java
  67. +40 −4 SciGraph-core/src/test/java/io/scigraph/owlapi/GraphOwlVisitorTestBase.java
  68. +1 −1 SciGraph-core/src/test/java/io/scigraph/owlapi/GraphOwlVisitorTransactionalGraphTest.java
  69. +1 −2 SciGraph-core/src/test/java/io/scigraph/owlapi/OntologyGraphRuleTest.java
  70. +2 −4 SciGraph-core/src/test/java/io/scigraph/owlapi/OwlApiUtilsTest.java
  71. +11 −13 SciGraph-core/src/test/java/io/scigraph/owlapi/OwlPostprocessorTest.java
  72. +6 −6 SciGraph-core/src/test/java/io/scigraph/owlapi/cases/TestAnnotationAssertionObject.java
  73. +7 −7 SciGraph-core/src/test/java/io/scigraph/owlapi/cases/TestEquivalentToIntersectionOf.java
  74. +5 −5 SciGraph-core/src/test/java/io/scigraph/owlapi/cases/TestExistentialClassAssertion.java
  75. +1 −2 SciGraph-core/src/test/java/io/scigraph/owlapi/cases/TestGCISubClassOf.java
  76. +1 −2 SciGraph-core/src/test/java/io/scigraph/owlapi/cases/TestObjectPropertyAssertion.java
  77. +1 −2 SciGraph-core/src/test/java/io/scigraph/owlapi/cases/TestPun.java
  78. +6 −6 SciGraph-core/src/test/java/io/scigraph/owlapi/cases/TestSubClassOfExistential.java
  79. +4 −3 SciGraph-core/src/test/java/io/scigraph/owlapi/cases/TestSubObjectPropertyChainOf.java
  80. +6 −5 SciGraph-core/src/test/java/io/scigraph/owlapi/curies/CurieAdderTest.java
  81. +3 −4 SciGraph-core/src/test/java/io/scigraph/owlapi/curies/CurieUtilTest.java
  82. +1 −1 SciGraph-core/src/test/java/io/scigraph/owlapi/loader/BatchOwlLoaderIT.java
  83. +86 −0 SciGraph-core/src/test/java/io/scigraph/owlapi/loader/EquivalentToInverseTest.java
  84. +83 −0 SciGraph-core/src/test/java/io/scigraph/owlapi/loader/InverseOfTautologyTest.java
  85. +1 −1 SciGraph-core/src/test/java/io/scigraph/owlapi/loader/OwlLoadConfigurationLoaderTest.java
  86. +4 −6 SciGraph-core/src/test/java/io/scigraph/owlapi/loader/OwlOntologyProducerTest.java
  87. +51 −0 SciGraph-core/src/test/java/io/scigraph/owlapi/postprocessors/AllNodesLabelerTest.java
  88. +51 −0 SciGraph-core/src/test/java/io/scigraph/owlapi/postprocessors/AnonymousNodeTaggerTest.java
  89. +14 −5 SciGraph-core/src/test/java/io/scigraph/owlapi/postprocessors/CliqueConfigurationTest.java
  90. +1 −3 SciGraph-core/src/test/java/io/scigraph/owlapi/postprocessors/CliqueOntologyTest.java
  91. +16 −19 SciGraph-core/src/test/java/io/scigraph/owlapi/postprocessors/CliqueTest.java
  92. +102 −0 SciGraph-core/src/test/java/io/scigraph/owlapi/postprocessors/EdgeLabelerTest.java
  93. +14 −13 SciGraph-core/src/test/java/io/scigraph/util/GraphTestBase.java
  94. +58 −43 SciGraph-core/src/test/java/io/scigraph/vocabulary/VocabularyNeo4jImplTest.java
  95. +7 −6 SciGraph-core/src/test/java/io/scigraph/vocabulary/VocabularyNeo4jScoringTest.java
  96. +1 −0 SciGraph-core/src/test/resources/cliqueConfiguration.yaml
  97. +10 −0 SciGraph-core/src/test/resources/ontologies/cases/TestEquivalentToInverse.owl
  98. +9 −0 SciGraph-core/src/test/resources/ontologies/cases/TestInverseOfTautology.owl
  99. +5 −0 SciGraph-core/src/test/resources/ontologies/family.owl
  100. +7 −0 SciGraph-core/src/test/resources/pizzaExample.yaml
  101. +1 −1 SciGraph-entity/pom.xml
  102. +9 −7 SciGraph-entity/src/main/java/io/scigraph/annotation/EntityAnalyzer.java
  103. +7 −6 SciGraph-entity/src/main/java/io/scigraph/annotation/EntityRecognizer.java
  104. +10 −10 SciGraph-entity/src/main/java/io/scigraph/annotation/ShingleProducer.java
  105. +1 −1 SciGraph-entity/src/test/java/io/scigraph/annotation/EntityRecognizerTest.java
  106. +1 −1 SciGraph-entity/src/test/java/io/scigraph/annotation/TokenTest.java
  107. +53 −9 SciGraph-services/pom.xml
  108. +25 −21 SciGraph-services/src/main/java/io/scigraph/services/MainApplication.java
  109. +3 −3 SciGraph-services/src/main/java/io/scigraph/services/SciGraphApplicationModule.java
  110. +2 −2 SciGraph-services/src/main/java/io/scigraph/services/auth/BasicAuthFilter.java
  111. +19 −5 SciGraph-services/src/main/java/io/scigraph/services/auth/BasicAuthenticator.java
  112. +134 −8 SciGraph-services/src/main/java/io/scigraph/services/configuration/ApplicationConfiguration.java
  113. +1 −2 SciGraph-services/src/main/java/io/scigraph/services/health/Neo4jHealthCheck.java
  114. +2 −2 SciGraph-services/src/main/java/io/scigraph/services/jersey/JaxRsUtil.java
  115. +4 −4 SciGraph-services/src/main/java/io/scigraph/services/jersey/MultivaluedMapUtils.java
  116. +38 −11 SciGraph-services/src/main/java/io/scigraph/services/jersey/dynamic/CypherInflector.java
  117. +2 −2 SciGraph-services/src/main/java/io/scigraph/services/jersey/dynamic/CypherInflectorFactory.java
  118. +5 −5 SciGraph-services/src/main/java/io/scigraph/services/jersey/dynamic/DynamicCypherResource.java
  119. +2 −2 ...raph-services/src/main/java/io/scigraph/services/jersey/dynamic/DynamicCypherResourceFactory.java
  120. +40 −19 SciGraph-services/src/main/java/io/scigraph/services/jersey/dynamic/SwaggerFilter.java
  121. +1 −1 SciGraph-services/src/main/java/io/scigraph/services/jersey/writers/DelimitedWriter.java
  122. +8 −8 SciGraph-services/src/main/java/io/scigraph/services/jersey/writers/ImageWriter.java
  123. +2 −1 SciGraph-services/src/main/java/io/scigraph/services/refine/RefineModule.java
  124. +4 −5 SciGraph-services/src/main/java/io/scigraph/services/refine/RefineQuery.java
  125. +6 −3 SciGraph-services/src/main/java/io/scigraph/services/resources/AnalyzerService.java
  126. +6 −3 SciGraph-services/src/main/java/io/scigraph/services/resources/AnnotateService.java
  127. +12 −8 SciGraph-services/src/main/java/io/scigraph/services/resources/CypherUtilService.java
  128. +0 −59 SciGraph-services/src/main/java/io/scigraph/services/resources/DynamicSwaggerService.java
  129. +185 −112 SciGraph-services/src/main/java/io/scigraph/services/resources/GraphService.java
  130. +6 −3 SciGraph-services/src/main/java/io/scigraph/services/resources/LexicalService.java
  131. +22 −18 SciGraph-services/src/main/java/io/scigraph/services/resources/RefineService.java
  132. +48 −0 SciGraph-services/src/main/java/io/scigraph/services/resources/SwaggerJsonBareService.java
  133. +24 −19 SciGraph-services/src/main/java/io/scigraph/services/resources/VocabularyService.java
  134. +0 −48 SciGraph-services/src/main/java/io/scigraph/services/swagger/beans/api/Swagger.java
  135. +0 −68 SciGraph-services/src/main/java/io/scigraph/services/swagger/beans/resource/Apis.java
  136. +0 −103 SciGraph-services/src/main/java/io/scigraph/services/swagger/beans/resource/Operations.java
  137. +0 −73 SciGraph-services/src/main/java/io/scigraph/services/swagger/beans/resource/Parameters.java
  138. +0 −85 SciGraph-services/src/main/java/io/scigraph/services/swagger/beans/resource/Resource.java
  139. +0 −125 SciGraph-services/src/main/resources/swagger/css/reset.css
  140. +0 −1,256 SciGraph-services/src/main/resources/swagger/css/screen.css
  141. +0 −26 SciGraph-services/src/main/resources/swagger/css/typography.css
  142. BIN SciGraph-services/src/main/resources/swagger/favicon-16x16.png
  143. BIN SciGraph-services/src/main/resources/swagger/favicon-32x32.png
  144. BIN SciGraph-services/src/main/resources/swagger/fonts/droid-sans-v6-latin-700.eot
  145. +0 −411 SciGraph-services/src/main/resources/swagger/fonts/droid-sans-v6-latin-700.svg
  146. BIN SciGraph-services/src/main/resources/swagger/fonts/droid-sans-v6-latin-700.ttf
  147. BIN SciGraph-services/src/main/resources/swagger/fonts/droid-sans-v6-latin-700.woff
  148. BIN SciGraph-services/src/main/resources/swagger/fonts/droid-sans-v6-latin-700.woff2
  149. BIN SciGraph-services/src/main/resources/swagger/fonts/droid-sans-v6-latin-regular.eot
  150. +0 −403 SciGraph-services/src/main/resources/swagger/fonts/droid-sans-v6-latin-regular.svg
  151. BIN SciGraph-services/src/main/resources/swagger/fonts/droid-sans-v6-latin-regular.ttf
  152. BIN SciGraph-services/src/main/resources/swagger/fonts/droid-sans-v6-latin-regular.woff
  153. BIN SciGraph-services/src/main/resources/swagger/fonts/droid-sans-v6-latin-regular.woff2
  154. BIN SciGraph-services/src/main/resources/swagger/images/explorer_icons.png
  155. BIN SciGraph-services/src/main/resources/swagger/images/logo_small.png
  156. BIN SciGraph-services/src/main/resources/swagger/images/pet_store_api.png
  157. BIN SciGraph-services/src/main/resources/swagger/images/throbber.gif
  158. BIN SciGraph-services/src/main/resources/swagger/images/wordnik_api.png
  159. +94 −95 SciGraph-services/src/main/resources/swagger/index.html
  160. +0 −53 SciGraph-services/src/main/resources/swagger/lib/URI.js
  161. +0 −15 SciGraph-services/src/main/resources/swagger/lib/backbone-min.js
  162. +0 −28 SciGraph-services/src/main/resources/swagger/lib/handlebars-2.0.0.js
  163. +0 −1 SciGraph-services/src/main/resources/swagger/lib/highlight.7.3.pack.js
  164. +0 −2 SciGraph-services/src/main/resources/swagger/lib/jquery-1.8.0.min.js
  165. +0 −18 SciGraph-services/src/main/resources/swagger/lib/jquery.ba-bbq.min.js
  166. +0 −1 SciGraph-services/src/main/resources/swagger/lib/jquery.slideto.min.js
  167. +0 −8 SciGraph-services/src/main/resources/swagger/lib/jquery.wiggle.min.js
  168. +0 −1,272 SciGraph-services/src/main/resources/swagger/lib/marked.js
  169. +0 −2,765 SciGraph-services/src/main/resources/swagger/lib/shred.bundle.js
  170. +0 −193 SciGraph-services/src/main/resources/swagger/lib/shred/content.js
  171. +0 −2,976 SciGraph-services/src/main/resources/swagger/lib/swagger-client.js
  172. +0 −279 SciGraph-services/src/main/resources/swagger/lib/swagger-oauth.js
  173. +0 −6 SciGraph-services/src/main/resources/swagger/lib/underscore-min.js
  174. +0 −20 SciGraph-services/src/main/resources/swagger/o2c.html
  175. +53 −0 SciGraph-services/src/main/resources/swagger/oauth2-redirect.html
  176. +0 −2 SciGraph-services/src/main/resources/swagger/robots.txt
  177. +106 −0 SciGraph-services/src/main/resources/swagger/swagger-ui-bundle.js
  178. +1 −0 SciGraph-services/src/main/resources/swagger/swagger-ui-bundle.js.map
  179. +8 −0 SciGraph-services/src/main/resources/swagger/swagger-ui-standalone-preset.js
  180. +1 −0 SciGraph-services/src/main/resources/swagger/swagger-ui-standalone-preset.js.map
  181. +2 −0 SciGraph-services/src/main/resources/swagger/swagger-ui.css
  182. +1 −0 SciGraph-services/src/main/resources/swagger/swagger-ui.css.map
  183. +15 −2,242 SciGraph-services/src/main/resources/swagger/swagger-ui.js
  184. +1 −0 SciGraph-services/src/main/resources/swagger/swagger-ui.js.map
  185. +0 −2 SciGraph-services/src/main/resources/swagger/swagger-ui.min.js
  186. +2 −2 SciGraph-services/src/test/java/io/scigraph/services/jersey/MapUtilsTest.java
  187. +18 −14 SciGraph-services/src/test/java/io/scigraph/services/jersey/dynamic/CypherInflectorTest.java
  188. +7 −10 SciGraph-services/src/test/java/io/scigraph/services/jersey/dynamic/DynamicCypherResourceTest.java
  189. +12 −14 SciGraph-services/src/test/java/io/scigraph/services/jersey/dynamic/DynamicResourceModuleIT.java
  190. +1 −1 SciGraph-services/src/test/java/io/scigraph/services/jersey/writers/BbopJsGraphWriterTest.java
  191. +16 −1 SciGraph-services/src/test/java/io/scigraph/services/resources/CypherUtilServiceTest.java
  192. +18 −17 SciGraph-services/src/test/java/io/scigraph/services/resources/GraphServiceTest.java
  193. +9 −9 SciGraph-services/src/test/java/io/scigraph/services/resources/RefineServiceTest.java
  194. +7 −7 SciGraph-services/src/test/java/io/scigraph/services/resources/VocabularyServiceTest.java
  195. +52 −0 SciGraph-services/src/test/resources/pizzaConfiguration.swagger1.yaml
  196. +18 −15 SciGraph-services/src/test/resources/pizzaConfiguration.yaml
  197. +9 −29 pom.xml
View
@@ -1,8 +1,6 @@
language: java
jdk:
- oraclejdk8
- oraclejdk7
- openjdk7
before_install:
- "export DISPLAY=:99.0"
View
@@ -100,7 +100,7 @@ Also browse the [generated REST documentation](http://localhost:9000/scigraph/do
to see some of the other resources.
-------
<img src="http://github.nfsdb.org/images/yklogo.png" />
<img src="https://www.yourkit.com/images/yklogo.png" />
-------
Thanks to YourKit for providing an Open Source license.
@@ -20,7 +20,7 @@
<parent>
<groupId>io.scigraph</groupId>
<artifactId>scigraph</artifactId>
<version>1.5-SNAPSHOT</version>
<version>2.1-SNAPSHOT</version>
</parent>
<artifactId>scigraph-analysis</artifactId>
<name>SciGraph - analysis</name>
@@ -41,7 +41,7 @@
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-math3</artifactId>
<version>3.5</version>
<version>3.6.1</version>
</dependency>
</dependencies>
@@ -15,19 +15,14 @@
*/
package io.scigraph.analyzer;
import io.scigraph.frames.CommonProperties;
import io.scigraph.frames.NodeProperties;
import io.scigraph.internal.CypherUtil;
import io.scigraph.neo4j.Graph;
import io.scigraph.owlapi.curies.CurieUtil;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import javax.inject.Inject;
@@ -38,8 +33,12 @@
import org.neo4j.graphdb.Node;
import org.neo4j.graphdb.Result;
import org.neo4j.graphdb.Transaction;
import org.prefixcommons.CurieUtil;
import com.google.common.base.Optional;
import io.scigraph.frames.CommonProperties;
import io.scigraph.frames.NodeProperties;
import io.scigraph.internal.CypherUtil;
import io.scigraph.neo4j.Graph;
public class HyperGeometricAnalyzer {
@@ -206,7 +205,7 @@ AnalyzeRequest processRequest(AnalyzeRequest request) throws Exception {
hypergeometricDistribution.upperCumulativeProbability((int) n.getCount())
* bonferroniCoeff;
String iri = graph.getNodeProperty(n.getNodeId(), CommonProperties.IRI, String.class).get();
String curie = curieUtil.getCurie(iri).or(iri);
String curie = curieUtil.getCurie(iri).orElse(iri);
String labels =
StringUtils.join(
graph.getNodeProperties(n.getNodeId(), NodeProperties.LABEL, String.class), ", ");
@@ -26,7 +26,6 @@
import io.scigraph.internal.CypherUtil;
import io.scigraph.owlapi.GraphOwlVisitor;
import io.scigraph.owlapi.OwlPostprocessor;
import io.scigraph.owlapi.curies.CurieUtil;
import io.scigraph.owlapi.loader.OwlLoadConfiguration.MappedProperty;
import io.scigraph.util.GraphTestBase;
@@ -38,6 +37,7 @@
import org.junit.BeforeClass;
import org.junit.Test;
import org.neo4j.graphdb.Transaction;
import org.prefixcommons.CurieUtil;
import org.semanticweb.owlapi.apibinding.OWLManager;
import org.semanticweb.owlapi.model.IRI;
import org.semanticweb.owlapi.model.OWLOntologyManager;
View
@@ -20,13 +20,13 @@
<parent>
<artifactId>scigraph</artifactId>
<groupId>io.scigraph</groupId>
<version>1.5-SNAPSHOT</version>
<version>2.1-SNAPSHOT</version>
</parent>
<artifactId>scigraph-core</artifactId>
<name>SciGraph - core</name>
<properties>
<lucene.version>3.6.2</lucene.version>
<lucene.version>5.5.0</lucene.version>
<openrdf.version>2.7.6</openrdf.version>
</properties>
@@ -68,34 +68,39 @@
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-analyzers</artifactId>
<artifactId>lucene-suggest</artifactId>
<version>${lucene.version}</version>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-spellchecker</artifactId>
<artifactId>lucene-analyzers-common</artifactId>
<version>${lucene.version}</version>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-misc</artifactId>
<version>${lucene.version}</version>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-queryparser</artifactId>
<version>${lucene.version}</version>
</dependency>
<dependency>
<groupId>commons-cli</groupId>
<artifactId>commons-cli</artifactId>
<version>1.3.1</version>
<version>1.4</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
<version>2.5</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.4</version>
<version>3.5</version>
</dependency>
<dependency>
@@ -114,7 +119,7 @@
<dependency>
<groupId>commons-validator</groupId>
<artifactId>commons-validator</artifactId>
<version>1.4.1</version>
<version>1.6</version>
</dependency>
<dependency>
<groupId>org.semanticweb.elk</groupId>
@@ -126,6 +131,11 @@
<artifactId>mapdb</artifactId>
<version>1.0.9</version>
</dependency>
<dependency>
<groupId>org.prefixcommons</groupId>
<artifactId>curie-util</artifactId>
<version>0.0.2</version>
</dependency>
</dependencies>
<build>
@@ -16,10 +16,6 @@
package io.scigraph.bbop;
import static com.google.common.collect.Iterables.getFirst;
import io.scigraph.frames.CommonProperties;
import io.scigraph.frames.NodeProperties;
import io.scigraph.internal.TinkerGraphUtil;
import io.scigraph.owlapi.curies.CurieUtil;
import java.util.Collection;
@@ -31,35 +27,43 @@
import com.tinkerpop.blueprints.Graph;
import com.tinkerpop.blueprints.Vertex;
import io.scigraph.frames.CommonProperties;
import io.scigraph.frames.NodeProperties;
import io.scigraph.internal.TinkerGraphUtil;
import org.prefixcommons.CurieUtil;
public class BbopGraphUtil {
private final CurieUtil curieUtil;
private static final ImmutableSet<String> IGNORED_PROPERTY_KEYS =
ImmutableSet.of(CommonProperties.IRI, NodeProperties.LABEL, CommonProperties.CURIE);
private static final ImmutableSet<String> IGNORED_PROPERTY_KEYS_FOR_EDGES =
ImmutableSet.of(CommonProperties.IRI);
@Inject
public BbopGraphUtil(CurieUtil curieUtil) {
this.curieUtil = curieUtil;
}
String getCurieOrIri(Vertex vertex) {
String iri = (String)vertex.getProperty(CommonProperties.IRI);
return curieUtil.getCurie(iri).or(iri);
String iri = (String) vertex.getProperty(CommonProperties.IRI);
return curieUtil.getCurie(iri).orElse(iri);
}
/***
* @param graph The graph to convert
* @return a bbop representation of a {@link Graph}
*/
public BbopGraph convertGraph(Graph graph) {
BbopGraph bbopGraph = new BbopGraph();
for (Vertex vertex: graph.getVertices()) {
for (Vertex vertex : graph.getVertices()) {
BbopNode bbopNode = new BbopNode();
bbopNode.setId(getCurieOrIri(vertex));
String label = getFirst(TinkerGraphUtil.getProperties(vertex, NodeProperties.LABEL, String.class), null);
String label =
getFirst(TinkerGraphUtil.getProperties(vertex, NodeProperties.LABEL, String.class), null);
bbopNode.setLbl(label);
for (String key: vertex.getPropertyKeys()) {
for (String key : vertex.getPropertyKeys()) {
if (IGNORED_PROPERTY_KEYS.contains(key)) {
continue;
}
@@ -68,13 +72,20 @@ public BbopGraph convertGraph(Graph graph) {
}
bbopGraph.getNodes().add(bbopNode);
}
for (Edge edge: graph.getEdges()) {
for (Edge edge : graph.getEdges()) {
BbopEdge bbopEdge = new BbopEdge();
Vertex subject= edge.getVertex(Direction.OUT);
Vertex object= edge.getVertex(Direction.IN);
Vertex subject = edge.getVertex(Direction.OUT);
Vertex object = edge.getVertex(Direction.IN);
bbopEdge.setSub(getCurieOrIri(subject));
bbopEdge.setObj(getCurieOrIri(object));
bbopEdge.setPred(edge.getLabel());
for (String key : edge.getPropertyKeys()) {
if (IGNORED_PROPERTY_KEYS_FOR_EDGES.contains(key)) {
continue;
}
Collection<Object> values = TinkerGraphUtil.getProperties(edge, key, Object.class);
bbopEdge.getMeta().put(key, values);
}
bbopGraph.getEdges().add(bbopEdge);
}
return bbopGraph;
@@ -19,7 +19,6 @@
import static com.google.common.collect.Collections2.transform;
import static com.google.common.collect.Iterables.getFirst;
import static com.google.common.collect.Sets.newHashSet;
import io.scigraph.owlapi.curies.CurieUtil;
import java.util.Collection;
import java.util.Collections;
@@ -35,7 +34,6 @@
import org.apache.commons.lang3.text.StrLookup;
import org.apache.commons.lang3.text.StrSubstitutor;
import org.neo4j.graphdb.DynamicRelationshipType;
import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.graphdb.RelationshipType;
import org.neo4j.graphdb.Result;
@@ -45,6 +43,7 @@
import com.google.common.base.Splitter;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap;
import org.prefixcommons.CurieUtil;
/***
* A utility for more expressive Cypher queries.
@@ -101,7 +100,7 @@ public Result execute(String query) {
relationshipTypes = transform(relationshipNames, new Function<String, RelationshipType>() {
@Override
public RelationshipType apply(String name) {
return DynamicRelationshipType.withName(name);
return RelationshipType.withName(name);
}
});
tx.success();
@@ -136,7 +135,7 @@ public RelationshipType apply(String name) {
new Function<String, String>() {
@Override
public String apply(String type) {
return curieUtil.getIri(type).or(type);
return curieUtil.getIri(type).orElse(type);
}
});
if (entail) {
@@ -161,7 +160,7 @@ public String resolveStartQuery(String cypher) {
Matcher m = p.matcher(cypher);
while (m.find()) {
String curie = m.group(1);
String iri = curieUtil.getIri(curie).or(curie);
String iri = curieUtil.getIri(curie).orElse(curie);
resolvedCypher = resolvedCypher.replace(curie, iri);
}
@@ -196,7 +195,7 @@ public String apply(Object input) {
throw new IllegalArgumentException(
"Cypher relationship templates must not contain spaces");
}
return curieUtil.getIri(input.toString()).or(input.toString());
return curieUtil.getIri(input.toString()).orElse(input.toString());
}
});
Oops, something went wrong.

0 comments on commit 4633a79

Please sign in to comment.