Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SemanticWebImport plugin update #300

Open
wants to merge 64 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
e939bd3
Updating plugin for gephi 0.9
ErwanDemairy Jan 6, 2016
a1f547b
Creates the columns in the table and fills them.
ErwanDemairy Jan 7, 2016
543842c
Merge branch 'master' of github.com:gephi/gephi-plugins into semantic…
ErwanDemairy Jan 8, 2016
3c9c08b
Removed misplaced files.
ErwanDemairy Jan 12, 2016
1bd086f
Merge branch 'master' of github.com:gephi/gephi-plugins
ErwanDemairy Jan 12, 2016
ba31668
Merge branch 'semantic-web-i'
ErwanDemairy Jan 12, 2016
3dd6b21
Merge branch 'master' of github.com:gephi/gephi-plugins
ErwanDemairy Feb 9, 2016
468e555
Relaxing the tests on the path so that the plugin can run.
ErwanDemairy Feb 9, 2016
09bec61
Return of the SOAP endpoint driver.
ErwanDemairy Feb 9, 2016
61686d2
Turned a constructor public to remove an exception when creating the …
ErwanDemairy Feb 9, 2016
259fe0f
Removed the SemanticTweet crawler, since the service does not exist a…
ErwanDemairy Feb 9, 2016
af01cec
Catch the exception if the URL is not correct, and display a dialog.
ErwanDemairy Feb 9, 2016
d5b4452
Removed a dependency already asked by corese modules.
ErwanDemairy Feb 9, 2016
086872d
Removed the calls to AttributeColumnsController. Addition of addAttri…
ErwanDemairy Feb 10, 2016
72d25e7
Replaced the e.printStackTrace() occurences by Exceptions.printStackT…
ErwanDemairy Feb 10, 2016
6fd59ed
Updated/cleaned the examples of configurations. Corrected a lack of n…
ErwanDemairy Feb 11, 2016
a467e24
Updating the corese version used to 3.2.0.
ErwanDemairy Feb 11, 2016
7e439b6
Setting Corese version used as 3.2.1 (remove the jws internal depende…
ErwanDemairy Feb 12, 2016
da76075
Removed any reference to the SOAP client until it is properly fixed.
ErwanDemairy Feb 23, 2016
2a46c73
Merge branch 'master' of github.com:gephi/gephi-plugins
ErwanDemairy Feb 23, 2016
1f6dad4
Updating to gephi 0.9.1.
ErwanDemairy Feb 23, 2016
7468927
Merge remote-tracking branch 'gephi-plugins/master'
ErwanDemairy Oct 25, 2022
9caa5b3
- update to gephi 0.9.7;
ErwanDemairy Jan 3, 2023
bd9c44a
Merge remote-tracking branch 'gephi-plugins/master'
ErwanDemairy Feb 13, 2023
c56ba50
- update to gephi 0.10.1;
ErwanDemairy Apr 4, 2023
e654b98
Changed http: to https:
ErwanDemairy Apr 4, 2023
2af1621
Update to corese 4.4.0.
ErwanDemairy Apr 4, 2023
89816fb
Merge remote-tracking branch 'gephi-plugins/master'
ErwanDemairy Apr 4, 2023
efa12b5
Add a changelog.
ErwanDemairy Apr 4, 2023
cce69e6
update of the gephi-plugin-parent dependency.
ErwanDemairy Apr 4, 2023
f079aea
ignore the log file.
ErwanDemairy Apr 4, 2023
ba7e2b8
Create codeql.yml
ErwanDemairy Apr 5, 2023
a56467c
Solves issue #1.
ErwanDemairy Apr 5, 2023
4a9262a
Cleaning suggested by code analyzer.
ErwanDemairy Apr 5, 2023
a49126e
Cleaning suggested by code analyzer.
ErwanDemairy Apr 6, 2023
5dc9b02
Configuration to use sonarqube.
ErwanDemairy Apr 6, 2023
ac8da8c
correction of the configuration to use sonarqube.
ErwanDemairy Apr 6, 2023
88aef6a
Added the lacking try-with-resources.
ErwanDemairy Apr 7, 2023
099400a
Cleaning.
ErwanDemairy Apr 7, 2023
291825d
Check if a diviser is not 0. More some cleaning.
ErwanDemairy Apr 7, 2023
967816d
Removed a nullable reference.
ErwanDemairy Apr 7, 2023
f4589f9
Cleaning nullpointerexception problems.
ErwanDemairy Apr 7, 2023
ee0276a
Prevent node from being null.
ErwanDemairy Apr 7, 2023
d64a5ed
Resolved some problems given by sonar.
ErwanDemairy Apr 7, 2023
3db5071
Coding style update.
ErwanDemairy Apr 19, 2023
f748896
Removed annotations considered useless.
ErwanDemairy Apr 20, 2023
00e5251
Removed redundant local variables.
ErwanDemairy Apr 20, 2023
1f44f50
Cleaning code.
ErwanDemairy Apr 20, 2023
8181588
Cleaning code.
ErwanDemairy Apr 20, 2023
6c84cab
[Cleaning] renamed classes to make them consistent with others.
ErwanDemairy Apr 20, 2023
1bff13e
Merge remote-tracking branch 'origin/develop'
ErwanDemairy Apr 20, 2023
e1e22cd
Close #2.
ErwanDemairy Apr 20, 2023
17b2d66
Correction of the build for codeql.
ErwanDemairy Apr 25, 2023
9004211
update of maven plugin for new release.
ErwanDemairy Jun 15, 2023
5990f7d
Update of the readme to help knowing how to install the plugin.
ErwanDemairy Nov 16, 2023
b9abbb1
Update README-plugin.md
ErwanDemairy Nov 20, 2023
b269f45
Update README-plugin.md
ErwanDemairy Nov 20, 2023
a67379d
Build ok for gephi 0.10.0
ErwanDemairy Nov 7, 2024
c8dfc0a
Upgrade to corese-core and corese-gui 4.5.0.
ErwanDemairy Nov 12, 2024
639ee65
update to python 3 syntax.
ErwanDemairy Nov 12, 2024
43140c8
get rid of non-used deprecated observer/observable usage.
ErwanDemairy Nov 12, 2024
fd25956
added some template parameters to reduce the number of warnings.
ErwanDemairy Nov 12, 2024
9c0c2bf
Merge pull request #7 from Wimmics/feature/gephi_10_1
ErwanDemairy Nov 14, 2024
296bcfc
Update README-plugin.md
ErwanDemairy Nov 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 28 additions & 10 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,39 @@ name: build

on:
push:
branches-ignore:
- master-forge
branches:
- master
- parent-pom
- gh-pages
- develop
pull_request:
types: [ opened, synchronize, reopened ]

jobs:
build_and_test:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up JDK 11
uses: actions/setup-java@v2
uses: actions/setup-java@v1
with:
java-version: 11
- name: Cache SonarQube packages
uses: actions/cache@v1
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache Maven packages
uses: actions/cache@v1
with:
java-version: '11'
distribution: 'temurin'
- name: Build and validate project
run: mvn -B package --file pom.xml
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Build and analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=gephi_semanticwebimport
78 changes: 78 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ "master" ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "master" ]
schedule:
- cron: '27 6 * * 1'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'java', 'python' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Use only 'java' to analyze code written in Java, Kotlin or both
# Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

steps:
- name: Checkout repository
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality


# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
# If this step fails, then you should remove it and run the build manually (see below)

# Does not work.
#- name: Autobuild
# uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

- run: |
echo "Run, Build Application using script"
mvn clean package

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
.DS_Store
**/target/**
/target/
/nb-configuration.xml

# Created by https://www.gitignore.io/api/maven,eclipse,netbeans,intellij
# Edit at https://www.gitignore.io/?templates=maven,eclipse,netbeans,intellij
Expand Down Expand Up @@ -178,4 +180,6 @@ nbdist/

# End of https://www.gitignore.io/api/maven,eclipse,netbeans,intellij

.java-version
.java-version
>>>>>>> gephi-plugins/master
/log.txt
214 changes: 214 additions & 0 deletions README-plugin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,214 @@
# Licensing

This plugin is developped inside [Inria](http://www.inria.fr), by the [Wimmics](http://wimmics.inria.fr) research team, with the support of the [Dream](http://www-sop.inria.fr/dream) team.

This plugin is made available through the [CeCILL-B licence](http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html).

# Installation

**Follow the procedure described at https://github.com/Wimmics/update-semanticwebimport**

# Versions

- SemanticWebImport: 1.4.0
- Embedded Corese: 4.4.0

# Main Repositories

- Source code: https://github.com/Wimmics/gephi-semantic-web-import.
- The update center repository: https://github.com/Wimmics/update-semanticwebimport

# Installation

The installation is done through a custom "update center". See [installation](https://github.com/Wimmics/update-semanticwebimport).

# Disclaimer

All the description below requires a complete update and is provided only as is, since some informations could still be
useful.

# Videos

The main page for the following videos can found at [SemanticWebImport Plugin Videos](http://wimmics.inria.fr/node/35).

* [Installation of the plugin](http://www-sop.inria.fr/teams/edelweiss/media/installation.swf)
* [Overview of the parts of the plugin](http://www-sop.inria.fr/teams/edelweiss/media/parts_overview.swf)
* [Access to local RDF data](http://www-sop.inria.fr/teams/edelweiss/media/first_example_local.swf)

# Description

The SemanticWebImport plugin is intended to allow the import of semantic data into Gephi. The imported data are obtained by processing a SPARQL request on the semantic data. The data can be accessed following three manners:

1. by accessing local rdf, rdfs, rul files and using the embedded Corese engine to apply the SPARQL request;
2. by accessing a remote REST SPARQL endpoint. In that case, the SPARQL request is applied remotely and the graph is built locally by analyzing the result sent by the REST endpoint;
3. by accessing a remote SOAP SPARQL endpoint. As for the REST endpoint, the resulting graph is built from the result returned by the endpoint.

We begin by showing how to make run the preset examples which come with the plugin. Then we detail the three drivers allowing to import semantic data.

**In all the following cases, it is required there is a currently opened project, otherwise the graph can not be built.**

# General Description of the GUI

The plugin consist of fourth tabs:

## How to access the data

![First tab of the plugin](https://cloud.githubusercontent.com/assets/197285/13900370/d67a6006-ee04-11e5-8ed2-0bc788e252a2.png)

First tab of the plugin

This tab allows to select among the available SPARQL drivers how the semantic data can be accessed. Currently, the choice can be made between (i) access to local data through the Corese engine; (ii) access to a remote REST SPARQL endpoint; (iii) access to a remote SOAP SPARQL enpoint.

## Write the SPARQL query

![Second tab of the plugin](https://cloud.githubusercontent.com/assets/197285/13900373/d84b21c2-ee04-11e5-99c5-6ffa80919f34.png)

Second tab of the plugin

The SPARQL editor to enter a SPARQL request that extract the data used to build the graph. **It is mandatory to be a construct request.**

## Execution log

![Third tab of the plugin](https://cloud.githubusercontent.com/assets/197285/13900374/d8aa9526-ee04-11e5-967e-5dabc30c66e7.png)

Third tab of the plugin

This tab contains the log, i.e. the outputs of the plugin.

## Configurations management

![Fourth tab of the plugin](https://cloud.githubusercontent.com/assets/197285/13900375/d97158c8-ee04-11e5-856b-8c3a71c96fbb.png)

Fourth tab of the plugin

This tab allows to manage the configurations. I.e. it contains: (i) the selector for preset examples and the load button to activate them.

## Launch the query

Note that to launch the query, the Run button is set at the bottom of the window.

# Use

To use the plugin, follow these steps:

1. choose in tab 1 a driver between the three available;
2. parameterize the driver (tab 1, and see the following sections for more details);
3. enter the SPARQL request, making sure it is a construct SPARQL request. All the relations "?x ?r ?y" in the construct part are creating nodes ?x and ?y and an edge to connect both;
4. In tab 4, choose:
1. Wether the workspace has to be reset;
2. If blank nodes muste be ignored;
3. Which level of follow your nose recursion you want.
4. The Python pre and post processing scripts can be used, using the python scripting plugin (see https://github.com/gephi/gephi/wiki/Scripting-Plugin for more details). The /fr/inria/edelweiss/examples/autolayout.py comes as a example of script.
5. The processing of the query can be launched by clicking on the Run button (at bottom).

# BBC Preset Examples

To obtain the BBC example, foolow the following steps:

1. Create a new empty project;
2. Select in the Load Examples/Configurations (i.e. the part 4 in previous image) the "BBC" example;
3. Click on load. The GUI should be similar to ![View of the SemanticWebPlugin after loading the BBC example](https://cloud.githubusercontent.com/assets/197285/13900376/da5a36d8-ee04-11e5-8ba1-3f2a9142a562.png) (View of the SemanticWebPlugin after loading the BBC example)
4. Launch the SPARQL driver by clicking on the start button (part 5). The BBC example connects to a SOAP SPARQL endpoint, and the SPARQL request is processed remotely, then the result is returned to the plugin. The graph obtained should be similar to ![View of the SemanticWebPlugin after processing the BBC example](https://cloud.githubusercontent.com/assets/197285/13900377/daf7547c-ee04-11e5-9930-2e5798509721.png) (View of the SemanticWebPlugin after processing the BBC example)

# Using Local Files

The Corese driver allows to process locally a SPARQL request on RDF files. The RDF files can be provided as:

1. local files.
2. internet files, i.e. beginning with http://. For example, http://dbpedia.org/data/The_Beatles.rdf can be added and used as an input.
3. resource files (i.e. RDF files coming from a jar file run by gephi). The file must begin with /. Three such files are coming embedded inside the plugin, /fr/inria/edelweis/examples/human_2007_09_11.rdf, /fr/inria/edelweis/examples/human_2007_09_11.rdfs, /fr/inria/edelweis/examples/human_2007_09_11.rul.

![CoreseDriver Panel](https://cloud.githubusercontent.com/assets/197285/13900378/dba7609c-ee04-11e5-8aaa-9cf8196b2210.png)

CoreseDriver Panel

The CoreseDriver is made of three parts:

1. buttons allowing to add a local file (+) or remove a resource (-);
2. the list of resources;
3. a text field and a button to add external resources, i.e. rdf files on the internet.

# Access with REST

The REST SPARQL driver allows to make process a SPARQL request on a remote SPARQL endpoint with REST interface.

![Rest Driver Panel](https://cloud.githubusercontent.com/assets/197285/13900379/dc4c2596-ee04-11e5-8bee-cfeb7f856c23.png)

Rest Driver Panel

The Rest panel is made of the following parts:

1. the URL for the endpoint;
2. the name given to the query tag. Most often it is "query"; some endpoints use "q".
3. some parameters to be added the request. For example "debug=on" can be provided by:
1. Writing "debug" instead of "REST name" in the part 3.
2. Writing "on" instead of "REST value" in the part 3.
3. Clicking on +.

## Access with SOAP

The SOAP SPARQL driver has a single parameter, the URL of the endpoint.

![Soap Driver Panel](https://cloud.githubusercontent.com/assets/197285/13900380/dd0a4fe4-ee04-11e5-92a8-2c84e3565695.png)

Soap Driver Panel

# Gephi: extensions in the SPARQL query

When building a query, some special keywords can be used to customize the results in gephi. http://gephi.org/ is used as the namespace for this extension. It is counselled to add the line "namespace gephi: <http://gephi.org/>" at the beginning of the query.

* ?node **gephi:label** ?node_label fill the label of the node with the content of ?node_label;
* ?node **gephi:size** ?value sets the size of the node to the content of ?value;
* ?node **gephi:color** ?color_name sets the color of the node according to the content of ? color_name. The known names are those defined in http://docs.oracle.com/javase/6/docs/api/java/awt/Color.html.
* ?node **gephi:color_r** ?value sets the red part of the color of the node with ?value. ?value must be set between 0 and 255, inclusives,
* ?node **gephi:color_g** ?value sets the green part of the color of the node with ?value. ?value must be set between 0 and 255, inclusives,
* ?node **gephi:color_b** ?value sets the blue part of the color of the node with ?value. ?value must be set between 0 and 255, inclusives,
* ?node **gephi:AttributeName** ?anyValue creates a new attribute called "AttributeName" for all the nodes of the graph, and set the attribute for the current node with the content of ?anyValue.

# Pre and post processing using python

As previously stated, the import of data can be pre or post processed with a script plugin.

```python
import org.openide.util.Lookup as Lookup
import org.gephi.ranking.api.RankingController
import org.gephi.ranking.api.Ranking as Ranking
import org.gephi.ranking.api.Transformer as Transformer
import java.awt.Color as Color


rankingController = Lookup.getDefault().lookup(org.gephi.ranking.api.RankingController)

# Set the color in function of the degree.
degreeRanking = rankingController.getModel().getRanking(Ranking.NODE_ELEMENT, Ranking.DEGREE_RANKING);
colorTransformer = rankingController.getModel().getTransformer(Ranking.NODE_ELEMENT, Transformer.RENDERABLE_COLOR)
colorTransformer.setColors([Color.BLUE, Color.YELLOW])

rankingController.transform(degreeRanking, colorTransformer)

# Set the size in function of the degree of the nodes.
sizeTransformer = rankingController.getModel().getTransformer(Ranking.NODE_ELEMENT, Transformer.RENDERABLE_SIZE)
sizeTransformer.setMinSize(3)
sizeTransformer.setMaxSize(40)
rankingController.transform(degreeRanking, sizeTransformer)


### Layout of the graph
# Construction of a layout object
import org.gephi.layout.plugin.forceAtlas2.ForceAtlas2Builder as ForceAtlas2Builder
import org.gephi.layout.plugin.forceAtlas2.ForceAtlas2 as ForceAtlas2
fa2builder = ForceAtlas2Builder()
fa2 = ForceAtlas2(fa2builder)

# Setting the layout object
import org.gephi.graph.api.GraphController as GraphController
graphModel = Lookup.getDefault().lookup(GraphController).getModel()
fa2.setGraphModel(graphModel)
fa2.setAdjustSizes(True) # To prevent overlap

print("executing layout")
# Run the layout.
fa2.initAlgo()
for i in range(5000):
fa2.goAlgo()
```
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
For documentation specific to this plugin, see [README-plugin.md](README-plugin.md).

What follows is the general-purpose documentation of the gephi-plugins, which can be found in [https://github.com/gephi/gephi-plugins/blob/master/README.md](README.md).

# Gephi Plugins

This repository is an out-of-the-box development environment for Gephi plugins. Gephi plugins are implemented in Java and can extend [Gephi](https://gephi.org) in many different ways, adding or improving features. Getting started is easy with this repository but also checkout the [Bootcamp](https://github.com/gephi/gephi-plugins-bootcamp) for examples of plugins you can create.
Expand Down
9 changes: 9 additions & 0 deletions modules/SemanticWebImport/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Changelog

## 1.3.0 -
- solves bug #1.

## 1.2.0 - 04/04/2023 "Easter resurrection"
- update to [java 11](https://docs.oracle.com/en/java/javase/11/);
- update to [Gephi 0.10.1](https://gephi.wordpress.com/2023/01/09/gephi-0-10-released/);
- update to [corese 4.4.0](https://github.com/Wimmics/corese/releases/tag/release-4.4.0)
Binary file not shown.
4 changes: 4 additions & 0 deletions modules/SemanticWebImport/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
## SemanticWebImport

This README supports Markdown, see [syntax](https://help.github.com/articles/markdown-basics/)

Loading