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

Arbitrary uris dc #96

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -648,8 +648,8 @@ protected ComponentRole getRole(KBObject argobj) {
arg.setParam(true);
else if (type.getID().equals(this.pcns + "DataArgument"))
arg.setParam(false);
else if (type.getNamespace().equals(this.dcdomns)
|| type.getNamespace().equals(this.dcns))
else /*if (type.getNamespace().equals(this.dcdomns)
|| type.getNamespace().equals(this.dcns))*/
arg.setType(type.getID());
}
KBObject role = kb.getPropertyValue(argobj, argidProp);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ private void initializeMetrics() {
}

protected KBObject copyObjectIntoKB(String id, KBObject obj, KBAPI tkb, String includeNS,
String excludeNS, boolean direct) {
ArrayList<String> excludeNS, boolean direct) {
// Add component to the temporary KB (add all its classes explicitly)
for(KBTriple triple : this.getTriplesForObject(id, obj, includeNS, excludeNS, direct)) {
tkb.addTriple(triple);
Expand All @@ -100,7 +100,7 @@ protected KBObject copyObjectIntoKB(String id, KBObject obj, KBAPI tkb, String i
}

protected KBObject copyObjectClassesIntoKB(String id, KBObject obj, KBAPI tkb, String includeNS,
String excludeNS, boolean direct) {
ArrayList<String> excludeNS, boolean direct) {
// Add component to the temporary KB (add all its classes explicitly)
for(KBTriple triple : this.getObjectClassTriples(id, obj, includeNS, excludeNS, direct)) {
tkb.addTriple(triple);
Expand Down Expand Up @@ -129,7 +129,7 @@ protected ArrayList<String> getConcreteComponentsForAbstract(String id) {
}

protected ArrayList<KBTriple> getTriplesForObject(String id, KBObject obj,
String includeNS, String excludeNS, boolean direct) {
String includeNS, ArrayList<String> excludeNS, boolean direct) {
ArrayList<KBTriple> triples = new ArrayList<KBTriple>();
triples.add(ontologyFactory.getTriple(
ontologyFactory.getObject(id),
Expand All @@ -140,7 +140,7 @@ protected ArrayList<KBTriple> getTriplesForObject(String id, KBObject obj,
}

protected ArrayList<KBTriple> getObjectClassTriples(String id, KBObject obj,
String includeNS, String excludeNS, boolean direct) {
String includeNS, ArrayList<String> excludeNS, boolean direct) {
// Add component to the temporary KB (add all its classes explicitly)
ArrayList<KBTriple> triples = new ArrayList<KBTriple>();

Expand All @@ -158,8 +158,8 @@ protected ArrayList<KBTriple> getObjectClassTriples(String id, KBObject obj,
ArrayList<KBObject> objclses =
this.getAllCachedClassesOfInstance(obj.getID(), direct);
for (KBObject objcls : objclses) {
if ((includeNS != null && objcls.getNamespace().equals(includeNS))
|| (excludeNS != null && !objcls.getNamespace().equals(excludeNS))) {
if ( (includeNS != null && objcls.getNamespace().equals(includeNS))
|| (excludeNS != null && !excludeNS.contains(objcls.getNamespace())) ) {
triples.add(ontologyFactory.getTriple(
tobj, ontologyFactory.getObject(KBUtils.RDF + "type"), objcls));
}
Expand Down Expand Up @@ -426,8 +426,10 @@ public ArrayList<ComponentPacket> findDataDetails(ComponentPacket details, boole

// Copy over the argument's classes to the variable
KBObject argobj = this.kb.getIndividual(arg.getID());
KBObject varobj = this.copyObjectClassesIntoKB(varid, argobj, tkb, this.dcdomns,
null, false);
ArrayList<String> excludeNS = new ArrayList<String>();
excludeNS.add(this.pcns);
excludeNS.add(this.dcns);
KBObject varobj = this.copyObjectClassesIntoKB(varid, argobj, tkb, null, excludeNS, false);
if(varobj == null)
continue;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public ArrayList<String> getAllDatatypeIds() {
"SELECT ?type\n" +
"WHERE {\n" +
"?type a <"+KBUtils.OWL+"Class> .\n" +
"FILTER ( STRSTARTS(STR(?type), \"" + this.dcdomns + "\"))\n" +
//"FILTER ( STRSTARTS(STR(?type), \"" + this.dcdomns + "\"))\n" +
"}";

this.start_read();
Expand All @@ -114,7 +114,8 @@ public ArrayList<String> getAllDatatypeIds() {
if(vals.get("type") == null)
continue;
String typeid = vals.get("type").getID();
list.add(typeid);
if(!typeid.equals(this.dcns + "Metrics"))
list.add(typeid);
}
this.end();
return list;
Expand Down Expand Up @@ -719,9 +720,11 @@ private DataTree createHierarchy(String classid, boolean types_only) {
}
ArrayList<KBObject> subclasses = this.getSubClasses(cls);
for (KBObject subcls : subclasses) {
/*
if (!subcls.getNamespace().equals(this.dcdomns)
&& !subcls.getNamespace().equals(this.dcdomns))
&& !subcls.getNamespace().equals(this.dcns))
continue;
*/
DataItem institem = new DataItem(subcls.getID(), DataItem.DATATYPE);
DataTreeNode childnode = new DataTreeNode(institem);
node.addChild(childnode);
Expand Down Expand Up @@ -775,8 +778,10 @@ private ArrayList<MetadataProperty> createMetadataProperties(ArrayList<KBObject>
ArrayList<MetadataProperty> list = new ArrayList<MetadataProperty>();
for (KBObject property : properties) {
// Ignore properties not declared in this domain
/*
if (!property.getNamespace().equals(this.dcdomns))
continue;
*/
MetadataProperty prop = this.createMetadataProperty(property);
if (prop != null)
list.add(prop);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -388,9 +388,11 @@ private ArrayList<VariableBindingsList> selectInputDataForVariables(
}

Variable[] variables = specializedTemplate.getVariables();
String varNS = null;
ArrayList<String> blacklist = new ArrayList<String>(variables.length);
String variableNS = null;
for (Variable variable : variables) {
varNS = variable.getNamespace();
blacklist.add(variable.getID());
variableNS = variable.getNamespace();
}
Expand Down Expand Up @@ -487,6 +489,7 @@ private ArrayList<VariableBindingsList> selectInputDataForVariables(

this.addExplanation("Querying the DataReasoningAPI with the following constraints: <br/>"
+ inputConstraints.toString().replaceAll(",", "<br/>"));

ArrayList<VariableBindingsList> partialList = dc.findDataSources(inputConstraints, variableNS);

if (partialList == null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,7 @@
import edu.isi.wings.catalog.provenance.api.ProvenanceAPI;
import edu.isi.wings.catalog.provenance.classes.ProvActivity;
import edu.isi.wings.catalog.provenance.classes.Provenance;
import edu.isi.wings.catalog.resource.classes.GridkitCloud;
import edu.isi.wings.catalog.resource.classes.Machine;
import edu.isi.wings.common.kb.KBUtils;
import edu.isi.wings.opmm.HashUtils;
import edu.isi.wings.portal.classes.config.Config;
import edu.isi.wings.portal.classes.config.ServerDetails;
import edu.isi.wings.portal.classes.JsonHandler;
Expand All @@ -57,13 +54,10 @@
import com.google.gson.JsonParser;

import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.util.concurrent.ExecutionException;

import org.asynchttpclient.*;
import org.asynchttpclient.request.body.multipart.InputStreamPart;
import org.tukaani.xz.check.None;

import static java.nio.charset.StandardCharsets.UTF_8;
import static org.asynchttpclient.Dsl.basicAuthRealm;
Expand Down Expand Up @@ -171,7 +165,7 @@ public String publishData(String dataid) {
return null;
}
}
return null;
return null;
}

private String uploadFile(ServerDetails server, File datafile) {
Expand Down
62 changes: 46 additions & 16 deletions portal/src/main/webapp/js/gui/DataViewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,13 +264,13 @@ DataViewer.prototype.openDataTypeEditor = function(args) {
}
if (mine)
myProperties.push({
prop: getLocalName(prop.id),
range: This.getPrefixedDataRange(prop.range)
prop: prop.id,
range: This.getPrefixedDataRange(prop.range)
});
else
inhProperties.push({
prop: getLocalName(prop.id),
range: This.getPrefixedDataRange(prop.range)
prop: prop.id,
range: This.getPrefixedDataRange(prop.range)
});
});

Expand Down Expand Up @@ -298,10 +298,10 @@ DataViewer.prototype.openDataTypeEditor = function(args) {
rec.set('prop', sdata.prop);
var mod = rec.modified;
if (!mod.prop && !mod.range) {
propmods.addedProperties[This.ontns + sdata.prop] = sdata;
propmods.addedProperties[sdata.prop] = sdata;
} else {
var prop = mod.prop ? mod.prop: sdata.prop;
propmods.modifiedProperties[This.ontns + prop] = sdata;
propmods.modifiedProperties[prop] = sdata;
}
}
});
Expand Down Expand Up @@ -445,6 +445,7 @@ DataViewer.prototype.openDataTypeEditor = function(args) {

var typeTabPanel = new Ext.tab.Panel({
plain: true,
region: 'center',
margin: 5
});

Expand Down Expand Up @@ -474,6 +475,7 @@ DataViewer.prototype.openDataTypeEditor = function(args) {
handler: function() {
var p = new dataPropRange();
p.set('range', "xsd:string");
p.set('prop', This.ontns);
var pos = dataTypeStore.getCount();
editorPlugin.cancelEdit();
dataTypeStore.insert(pos, p);
Expand All @@ -498,7 +500,7 @@ DataViewer.prototype.openDataTypeEditor = function(args) {
// This property was just added, don't mark it as a
// deletedProperty for the server
} else if (prop != "") {
propmods.deletedProperties[This.ontns + prop] = 1;
propmods.deletedProperties[prop] = 1;
}
dataTypeStore.remove(r);
}
Expand All @@ -517,6 +519,9 @@ DataViewer.prototype.openDataTypeEditor = function(args) {
flex: 1,
header: 'Property',
editor: propEditor,
renderer: function(url) {
return getLocalName(url);
},
editable: This.advanced_user ? true: false,
menuDisabled: true
}, {
Expand Down Expand Up @@ -609,7 +614,22 @@ DataViewer.prototype.openDataTypeEditor = function(args) {
layout: 'fit',
tbar: mainTbar,
//autoScroll: true,
items: typeTabPanel
items: [
{
layout: 'border',
border: false,
items: [
typeTabPanel,
{
html: '<a href="'+id+'">'+id+'</a>',
margins: '0 0 6 6',
border: false,
region: 'south',
bodyStyle: { background: 'transparent' }
}
]
}
]
});
tab.add(mainPanel);
};
Expand Down Expand Up @@ -666,14 +686,19 @@ DataViewer.prototype.confirmAndRenameDatatype = function(node) {

var dtypeid = node.data.id;
var dtypeName = getLocalName(dtypeid);
var title = "Rename " + dtypeName;
for(var i=0; i<150; i++)
title += "&nbsp;";
title += ".";

Ext.Msg.prompt("Rename " + dtypeName, "Enter new name:", function(btn, text) {
Ext.Msg.prompt(title, "Enter new name:", function(btn, text) {
if (btn == 'ok' && text) {
var newName = getRDFID(text);
var newid = This.ontns + newName;
var newName = getRDFID(getLocalName(text));
var newid = getNamespace(text) + newName;

var enode = This.dataTreePanel.getStore().getNodeById(newid);
if (enode) {
showError(getRDFID(text) + ' already exists ! Choose a different name.');
showError(newName + ' already exists ! Choose a different name.');
This.confirmAndRenameDatatype(node);
return;
}
Expand Down Expand Up @@ -704,7 +729,7 @@ DataViewer.prototype.confirmAndRenameDatatype = function(node) {
}
});
}
}, this, false, dtypeName);
}, this, false, dtypeid);
};

DataViewer.prototype.confirmAndDeleteData = function(node) {
Expand Down Expand Up @@ -1500,9 +1525,14 @@ DataViewer.prototype.addDatatype = function(parentNode) {
}
var parentType = parentNode.data.id;

Ext.Msg.prompt("Add Datatype", "Enter name for the new Datatype:", function(btn, text) {
var title = "Add Datatype";
for(var i=0; i<150; i++)
title += "&nbsp;";
title += ".";

Ext.Msg.prompt(title, "Enter name for the new Datatype:", function(btn, text) {
if (btn == 'ok' && text) {
var newid = This.ontns + getRDFID(text);
var newid = getNamespace(text) + getRDFID(getLocalName(text));
var enode = This.dataTreePanel.getStore().getNodeById(newid);
if (enode) {
showError('Datatype ' + text + ' already exists');
Expand Down Expand Up @@ -1540,7 +1570,7 @@ DataViewer.prototype.addDatatype = function(parentNode) {
}
});
}
}, window, false);
}, window, false, this.ontns);
};

DataViewer.prototype.saveDatatype = function(
Expand Down