Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
leipert committed May 12, 2014
2 parents 41fa700 + 21b7306 commit 6a1959d
Show file tree
Hide file tree
Showing 1,213 changed files with 177,878 additions and 72,022 deletions.
5 changes: 5 additions & 0 deletions .bowerrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"directory": "app/lib",
"json": "bower.json"
}

36 changes: 35 additions & 1 deletion app/css/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ div.startPointCSS > select {
div.subjectCSS {
background-color: #ffff99;
border-color: #A4A019;
width: 350px;
width: 400px;
}

div.highlight-subject {
Expand Down Expand Up @@ -142,3 +142,37 @@ div.subjectCSS div.inversePropertyCSS select {
div.subjectCSS div.inversePropertyCSS div.inversePropertyHeadCSS i {
color: #0000bb;
}


#saveLink a:hover
{
color: #000000;
text-underline: none;
text-decoration: none;
}
#saveLink a:link
{
color: #ffffff;
text-underline: none;
}
#saveLink a:active
{
color: #ffffff;
text-underline: none;
}
#saveLink a:visited
{
color: #ffffff;
text-underline: none;
}

.ui-select-bootstrap > .ui-select-choices {
width:400px;
max-height: 600px;
}

.dropdown-menu {
width: 400px;
right:0;
left:auto;
}
58 changes: 33 additions & 25 deletions app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@
<meta charset="utf-8">
<title>GSB: Prototyp</title>
<!-- Import bootstrap CSS Framework for Styles, see http://getbootstrap.com -->
<link rel="stylesheet" href="lib/bootstrap/bootstrap.css">
<link rel="stylesheet" href="lib/bootstrap/dist/css/bootstrap.css">
<!-- Import ui-select files -->
<link rel="stylesheet" href="lib/ui-select/select.css">
<link rel="stylesheet" href="lib/angular-ui-select/dist/select.css">
<!-- Import our own styles -->
<link rel="stylesheet" href="css/app.css"/>

</head>

<body ng-controller="MainCtrl">
<!-- WORKSPACE, this is where most of the magic happens -->
<!-- See @js/controllers/main.js -->
Expand All @@ -26,11 +27,11 @@ <h1>Graphical SPARQL Builder</h1>
<a href="#" class="btn btn-warning" ng-click="showArea = 'query'; translate()">Run Query</a>
<a href="#" class="btn btn-danger" ng-click="initializeWorkspace()">Reset Workspace</a>
<a href="#" class="btn btn-info" ng-click="expertView = !expertView"><i class="glyphicon glyphicon-tower"></i></a>
<a href="#" class="btn btn-success" ng-click="saveJSON()"><i class="glyphicon glyphicon-save"></i> query as JSON</a>
<a href="#" class="btn btn-success" ng-click="loadJSON()"><i class="glyphicon glyphicon-open"></i> Open JSON-Query</a>
</span>
<span ng-show="showArea == 'query'">
<a href="#" class="btn btn-warning" ng-click="showArea = 'workspace'">Back to Workspace</a>
<a href="#" class="btn btn-success" ng-click="saveJSON()"><i class="glyphicon glyphicon-save"></i> query as JSON</a>
<a href="#" class="btn btn-success" ng-click=""><div id="saveLink"><i class="glyphicon glyphicon-save"></i></div></a>
</span>
</div>
</div>
Expand All @@ -50,16 +51,21 @@ <h1>Graphical SPARQL Builder</h1>
<div class="addSubjectBox form-group pull-right" style="z-index: 0; position: fixed; top: 165px;right:25px;">
<div class="input-group">
<!-- UI-SELECT Directive, taken from here: https://github.com/angular-ui/ui-select -->
<ui-select ng-model="$parent.selectedSubjectClass" theme="lib/ui-select/bootstrap">
<ui-select ng-model="$parent.selectedSubjectClass">
<match placeholder="Please choose a subject.">

{{$select.selected.alias}}
</match>
<!-- IMPORTANT: it has to be item in 'repeat="item in...',
as ui-select defines it internally. Anything else wont work! -->
<choices repeat="item in availableSubjectClasses | filter: $select.search">
<div ng-bind-html="item.alias | highlight: $select.search"></div>
<small ng-bind-html="item.uri | highlight: $select.search"></small>
<choices repeat="item in availableSubjectClasses | filter: $select.search | limitTo: 10">
<p>
<span class="h4" ng-bind-html="item.alias | highlight: $select.search"></span>
<small ng-bind-html="item.uri | highlight: $select.search"></small>
</p>
<p style="white-space:normal;">
<small ng-bind-html="item.comment | highlight: $select.search"></small>
</p>
</choices>
</ui-select>
<span class="input-group-btn">
Expand All @@ -79,43 +85,43 @@ <h1>Graphical SPARQL Builder</h1>
<div class="container" ng-show="showArea == 'query'" style="top:165px;position: relative">
<div ng-hide="hideQueries" class="col-sm-12">
<div class="col-sm-12 text-center">
<a ng-click="hideQueries = true"> Hide Queries</a>
</div>
<a ng-click="hideQueries = true"> Hide Queries</a>
</div>
<h3>Queries</h3>
<div class="col-sm-6">
<p>JSON:</p>
<pre id="json-query">{{translatedJSON}}</pre>
</div>
<div class="col-sm-6">
<p>SPARQL:&nbsp;<a href="#" ng-click="openInNewTab()">Starte dbpedia-query!</a></p>
<pre id="sparql-query">{{translatedSPARQL}}</pre>
</div>
<div class="col-sm-6">
<p>JSON:</p>
<pre id="json-query">{{translatedJSON}}</pre>
</div>
<div class="col-sm-6">
<p>SPARQL:&nbsp;<a href="#" ng-click="openInNewTab()">Starte dbpedia-query!</a></p>
<pre id="sparql-query">{{translatedSPARQL}}</pre>
</div>
</div>
<div class="col-sm-12 text-center">
<a ng-hide="hideQueries" ng-click="hideQueries = true"> Hide Queries</a>
<a ng-show="hideQueries" ng-click="hideQueries = false"> Show Queries</a>
</div>
<div class="col-sm-12" style="">
<h3>Results</h3>
<h3>Results</h3>

</div>
</div>
</div>
</div>
<!-- Always import JQuery before angular, so angular uses the FULL power of it -->
<script src="lib/jquery-1.11.0.min.js"></script>
<script src="lib/jquery/dist/jquery.js"></script>
<!-- Import Angular JS Framework, see http://angularjs.org -->
<script src="lib/angular/angular.js"></script>
<!-- Import angular-sanitize for ui-select -->
<script src="lib/angular/angular-sanitize.js"></script>
<script src="lib/angular-sanitize/angular-sanitize.js"></script>
<!-- Import Angular-UI bootstrap for Bootstrap JS, see https://github.com/angular-ui/bootstrap/ -->
<!-- Not used, at the moment: <script src="lib/ui-bootstrap/ui-bootstrap-tpls-0.9.0.js"></script>-->
<script src="lib/angular-bootstrap/ui-bootstrap.js"></script>
<!-- UI-SELECT Directive, taken from here: https://github.com/angular-ui/ui-select -->
<script src="lib/ui-select/select.js"></script>
<script src="lib/angular-ui-select/dist/select.js"></script>
<!-- Import our app and controllers and directives -->
<script src="js/app.js"></script>
<script src="js/config.js"></script>
<script src="js/filters.js"></script>
<script src="js/services/availableClasses.js"></script>
<script src="js/services/endPoint.js"></script>
<script src="js/services/translatorManager.js"></script>
<script src="js/services/translatorToJSON.js"></script>
<script src="js/services/translatorToSPARQL.js"></script>
Expand All @@ -126,11 +132,13 @@ <h3>Results</h3>
<script src="js/controllers/propertyInstance.js"></script>
<script src="js/controllers/propertyType/object.js"></script>
<script src="js/controllers/propertyType/number.js"></script>
<script src="js/controllers/propertyType/aggregate.js"></script>
<script src="js/controllers/propertyType/string.js"></script>
<script src="js/directives/subject.js"></script>
<script src="js/directives/property.js"></script>
<script src="js/directives/propertyType/object.js"></script>
<script src="js/directives/propertyType/number.js"></script>
<script src="js/directives/propertyType/aggregate.js"></script>
<script src="js/directives/propertyType/string.js"></script>
<script src="js/directives/startPoint.js"></script>
</body>
Expand Down
8 changes: 6 additions & 2 deletions app/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ angular.module('GSB', [
'GSB.controllers.propertyCollection',
'GSB.controllers.propertyInstance',
'GSB.controllers.propertyType.object',
'GSB.controllers.propertyType.aggregate',
'GSB.controllers.propertyType.number',
'GSB.controllers.propertyType.string',
'GSB.directives.subject',
Expand All @@ -18,11 +19,14 @@ angular.module('GSB', [
'GSB.directives.propertyType.object',
'GSB.directives.propertyType.number',
'GSB.directives.propertyType.string',
'GSB.services.availableClasses',
'GSB.directives.propertyType.aggregate',
'GSB.services.endPoint',
'GSB.services.translatorManager',
'GSB.services.translatorToJSON',
'GSB.services.translatorToSPARQL'
]);
]).config(function(uiSelectConfig) {
uiSelectConfig.theme = 'bootstrap';
});;

//Global functions

Expand Down
79 changes: 74 additions & 5 deletions app/js/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ angular.module('GSB.config', [])
},
resultURL: 'http://dbpedia-live.openlinksw.com/sparql?default-graph-uri=http%3A%2F%2Fdbpedia.org&format=text%2Fhtml&timeout=5000&debug=on&query=',
queryURL: 'http://dbpedia-live.openlinksw.com/sparql?default-graph-uri=http%3A%2F%2Fdbpedia.org&format=json&timeout=5000&debug=on&query=',
baseURL: 'http://' + (location.host + location.pathname).substring(0,(location.host + location.pathname).lastIndexOf('app/') + 4),
allowedLanguages : ['*','de','en','pl'],
propertyOperators : [
{
Expand All @@ -31,12 +30,82 @@ angular.module('GSB.config', [])
],
inversePropertyOperators : [
{
label: 'is of',
value: 'IS_OF'
label: 'is_of',
value: 'MUST'
},
{
label: 'is not of',
value: 'IS_NOT_OF'
value: 'MUST_NOT'
}
],
aggregateFunctions : [
{
alias:"cnt",
operator:"COUNT(%alias%)",
restrictTo:null
},
{
alias:"sum",
operator:"SUM(%alias%)",
restrictTo:"NUMBER_PROPERTY"
},
{
alias:"min",
operator:"MIN(%alias%)",
restrictTo:"NUMBER_PROPERTY"
},
{
alias:"max",
operator:"MAX(%alias%)",
restrictTo:"NUMBER_PROPERTY"
},
{
alias:"avg",
operator:"AVG(%alias%)",
restrictTo:"NUMBER_PROPERTY"
},
{
alias:"gct",
operator:'GROUP_CONCAT(%alias%,",")',
restrictTo:"STRING_PROPERTY"
}
]
],
getPropertiesSPARQLQuery:
'SELECT DISTINCT ?uri ?inverse (STR(?comment_temp) AS ?comment) ?range (STR(?alias_temp) AS ?alias)' +
'WHERE {' +
' {' +
' <%uri%> rdfs:subClassOf* ?class.' +
' {' +
' ?uri rdfs:domain ?class . ' +
' BIND("D" as ?inverse)' +
' OPTIONAL { ?uri rdfs:range ?range}' +
' } UNION {' +
' ?uri rdfs:range ?class .' +
' BIND("I" as ?inverse)' +
' OPTIONAL { ?uri rdfs:domain ?range}' +
' }' +
' }' +
' OPTIONAL {' +
' ?uri rdfs:comment ?comment_temp .' +
' FILTER(LANGMATCHES(LANG(?comment_temp), "%lang%"))' +
' }' +
' OPTIONAL {' +
' ?uri rdfs:label ?alias_temp .' +
' FILTER(LANGMATCHES(LANG(?alias_temp), "%lang%"))' +
' }' +
'}',
standardLang: "en",
getClassesSPARQLQuery:
'SELECT DISTINCT ?uri (STR(?comment_temp) as ?comment) (STR(?alias_temp) AS ?alias)' +
'WHERE {' +
' ?uri a owl:Class .' +
' OPTIONAL {' +
' ?uri rdfs:comment ?comment_temp .' +
' FILTER(LANG(?comment_temp) = "" || LANGMATCHES(LANG(?comment_temp), "%lang%"))' +
' }' +
' OPTIONAL {' +
' ?uri rdfs:label ?alias_temp .' +
' FILTER(LANGMATCHES(LANG(?alias_temp), "%lang%"))' +
' }' +
'}'
});
18 changes: 16 additions & 2 deletions app/js/controllers/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,27 @@ angular.module('GSB.controllers.main', ['GSB.config'])

};


/**
* Saves JSON...
*/
$scope.saveJSON = function () {

$scope.$broadcast('saveJsonEvent');

};



/**
* Load JSON...
*/
$scope.loadJSON = function () {

$scope.$broadcast('loadJsonEvent');

};



/**
* Initializes the Workspace
*/
Expand Down
Loading

0 comments on commit 6a1959d

Please sign in to comment.