Merge pull request #618 from afs/fuseki-ui

 JENA-1766: (more) Handle the case of dataset endpoint (service name = "")
diff --git a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/server/Operation.java b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/server/Operation.java
index 76f0b8e..a4719a3 100644
--- a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/server/Operation.java
+++ b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/server/Operation.java
@@ -56,22 +56,22 @@
      * Create an Operation - this operation interns operations so there is only
      * one object for each operation. It is an extensible enum.
      */
-    static public Operation alloc(String iriStr, String shortName, String description) {
+    static public Operation alloc(String iriStr, String name, String description) {
         IRI iri = IRIResolver.parseIRI(iriStr);
         if ( iri.hasViolation(false) )
             Log.warn(Operation.class, "Poor Operation name: "+iriStr+" : Not an IRI");
         if ( iri.isRelative() )
             Log.warn(Operation.class, "Poor Operation name: "+iriStr+" : Relative IRI");
         Node node = NodeFactory.createURI(iriStr);
-        return alloc(node, shortName, description);
+        return alloc(node, name, description);
     }
 
     /**
      * Create an Operation - this operation interns operations so there is only
      * object for each operation. It is an extensible enum.
      */
-    static public Operation alloc(Node op, String shortName, String description) {
-        return mgr.computeIfAbsent(op, (x)->create(x, shortName, description));
+    static public Operation alloc(Node op, String name, String description) {
+        return mgr.computeIfAbsent(op, (x)->create(x, name, description));
     }
 
     /** Create; not registered */
diff --git a/jena-fuseki2/jena-fuseki-webapp/src/main/webapp/js/app/models/dataset.js b/jena-fuseki2/jena-fuseki-webapp/src/main/webapp/js/app/models/dataset.js
index 55a677d..69c69cd 100644
--- a/jena-fuseki2/jena-fuseki-webapp/src/main/webapp/js/app/models/dataset.js
+++ b/jena-fuseki2/jena-fuseki-webapp/src/main/webapp/js/app/models/dataset.js
@@ -103,24 +103,24 @@
       /** Return the first endpoint of the first service that has the given type */
       endpointOfType: function( serviceType ) {
           var service = this.serviceOfType( serviceType );
-	  if ( ! service )
-	      return null;
-	  var x = service["srv.endpoints"];
-	  x = x.filter(function(v){return v!==''});
-	  var ep = _.first(x);
-	  return ep;
-          /* return service && _.first( service["srv.endpoints"] );*/
+          if ( ! service )
+              return null;
+          var x = service["srv.endpoints"];
+          var ep = _.first(x);
+          return ep;
       },
 
       /* Return URL for a service of a given type or null, if no such service */
       endpointURL: function( serviceType ) {
-        var endpoint = this.endpointOfType( serviceType );
-        return endpoint ? this.datasetEndpointURL( endpoint ) : null;
+          var endpoint = this.endpointOfType( serviceType );
+          return endpoint != null  ? this.datasetEndpointURL( endpoint ) : null ;
       },
 
       /** Return the URL for the given endpoint */
       datasetEndpointURL: function( endpoint ) {
-        return sprintf( "%s%s/%s", this.baseURL(), this.name(), endpoint );
+	  return endpoint == ""
+	      ? sprintf( "%s%s", this.baseURL(), this.name() )
+              : sprintf( "%s%s/%s", this.baseURL(), this.name(), endpoint );
       },
 
       /** Return the sparql query URL for this dataset, if it has one, or null */