diff --git a/karma-app/build b/karma-app/build index 67073ff07..73b3ddebe 100755 --- a/karma-app/build +++ b/karma-app/build @@ -10,6 +10,7 @@ # 6. Navigates to the electron app folder and copies the tomcat folder to app/app directory. # 7. Runs the release script there to build karma app for linux, windows and mac. ######################################## +set -e CURRENT=`pwd` rm -rf ./target @@ -18,6 +19,8 @@ mkdir target cd .. mvn clean install -Dmaven.test.skip=true cd karma-web/ + +set +e rm src/main/webapp/publish/CSV/*.csv rm src/main/webapp/publish/AVRO/*.avro rm src/main/webapp/publish/JSON/*.json @@ -29,6 +32,7 @@ rm src/main/webapp/publish/RDF/*.rdf rm src/main/webapp/publish/RDF/*.ttl rm src/main/webapp/publish/RDF/*.txt rm src/main/webapp/publish/REPORT/*.md +set -e mvn package -Pshaded cp target/karma-web*.war $CURRENT/target/ROOT.war @@ -45,9 +49,9 @@ mv karma-app-deps-master/*.tar.gz . rm -rf karma-app-deps-master master.zip # download tomcat binary -wget http://apache.cs.utah.edu/tomcat/tomcat-8/v8.5.29/bin/apache-tomcat-8.5.29.zip -unzip apache-tomcat-8.5.29.zip -rm apache-tomcat-8.5.29.zip +wget http://mirror.cc.columbia.edu/pub/software/apache/tomcat/tomcat-8/v8.5.30/bin/apache-tomcat-8.5.30.zip +unzip apache-tomcat-*.zip +rm apache-tomcat-*.zip mv apache-tomcat* tomcat rm -rf tomcat/webapps/* @@ -84,11 +88,14 @@ rm -rf jre* cp -rf Karma-darwin* $CURRENT/target/Karma-Mac cp -rf Karma-linux* $CURRENT/target/Karma-Linux cp -rf Karma-win* $CURRENT/target/Karma-Windows + +set +e rm -rf Karma-* cd $CURRENT/target rm *.tar.gz +set -e #put our license for build_folder in `ls |grep Karma` do diff --git a/karma-app/desktop/package.json b/karma-app/desktop/package.json index cea336f3c..338ae0539 100644 --- a/karma-app/desktop/package.json +++ b/karma-app/desktop/package.json @@ -30,7 +30,7 @@ }, "devDependencies": { "chai": "^3.5.0", - "electron": "1.8.4", + "electron": "2.0.0-beta.7", "electron-builder": "^5.12.1", "electron-mocha": "^3.0.0", "fs-jetpack": "^0.9.0", diff --git a/karma-commands/commands-alignment/src/main/java/edu/isi/karma/controller/command/alignment/GetPropertiesCommand.java b/karma-commands/commands-alignment/src/main/java/edu/isi/karma/controller/command/alignment/GetPropertiesCommand.java index defbb0e28..4417bf973 100644 --- a/karma-commands/commands-alignment/src/main/java/edu/isi/karma/controller/command/alignment/GetPropertiesCommand.java +++ b/karma-commands/commands-alignment/src/main/java/edu/isi/karma/controller/command/alignment/GetPropertiesCommand.java @@ -44,7 +44,7 @@ public enum INTERNAL_PROP_RANGE { } private enum JsonKeys { - updateType, label, id, properties, uri, type, rdfsLabel + updateType, label, id, properties, uri, type, rdfsLabel, literaltype, } private String classURI, domainURI, rangeURI, linkId; @@ -86,7 +86,7 @@ public UpdateContainer doIt(Workspace workspace) throws CommandException { final OntologyManager ontMgr = workspace.getOntologyManager(); Set properties = new HashSet<>(); - logger.debug("GetPropertiesCommand:" + propertiesRange + ":" + classURI + "," + domainURI + ", " + rangeURI); +// logger.z("GetPropertiesCommand:" + propertiesRange + ":" + classURI + "," + domainURI + ", " + rangeURI); if (propertiesRange == INTERNAL_PROP_RANGE.allObjectProperties) { HashMap linkList = ontMgr.getObjectProperties(); @@ -164,14 +164,15 @@ public void generateJson(String prefix, PrintWriter pw, Label linkLabel = link.getLabel(); String edgeLabelStr = linkLabel.getDisplayName(); JSONObject edgeObj = new JSONObject(); - if (linkLabel.getUri() !=null && linkLabel.getNs() != null + if (linkLabel.getUri() !=null && linkLabel.getNs() != null && linkLabel.getUri().equalsIgnoreCase(linkLabel.getNs())) { edgeLabelStr = linkLabel.getUri(); } - + + edgeObj.put(JsonKeys.label.name(), edgeLabelStr); edgeObj.put(JsonKeys.rdfsLabel.name(), linkLabel.getRdfsLabel()); - + edgeObj.put(JsonKeys.literaltype.name(), linkLabel.getRdfsRange()); edgeObj.put(JsonKeys.uri.name(), linkLabel.getUri()); edgeObj.put(JsonKeys.id.name(), link.getId()); diff --git a/karma-commands/commands-alignment/src/main/java/edu/isi/karma/controller/command/alignment/SetMetaPropertyCommand.java b/karma-commands/commands-alignment/src/main/java/edu/isi/karma/controller/command/alignment/SetMetaPropertyCommand.java index c9220d707..791539e2b 100644 --- a/karma-commands/commands-alignment/src/main/java/edu/isi/karma/controller/command/alignment/SetMetaPropertyCommand.java +++ b/karma-commands/commands-alignment/src/main/java/edu/isi/karma/controller/command/alignment/SetMetaPropertyCommand.java @@ -197,7 +197,7 @@ public UpdateContainer doIt(Workspace workspace) throws CommandException { newType = new SemanticType(hNodeId, ClassInstanceLink.getFixedLabel(), classNode.getLabel(), classNode.getId(), - false, + false, false, SemanticType.Origin.User, 1.0); } else if (metaPropertyName .equals(METAPROPERTY_NAME.isSpecializationForEdge)) { @@ -238,7 +238,7 @@ public UpdateContainer doIt(Workspace workspace) throws CommandException { DataPropertyOfColumnLink.getFixedLabel(), classInstanceNode.getLabel(), classInstanceNode.getId(), - false, + false, false, SemanticType.Origin.User, 1.0); } else if (propertyLink instanceof ObjectPropertyLink) { @@ -252,7 +252,7 @@ public UpdateContainer doIt(Workspace workspace) throws CommandException { ObjectPropertySpecializationLink.getFixedLabel(), classInstanceNode.getLabel(), classInstanceNode.getId(), - false, + false, false, SemanticType.Origin.User, 1.0); } @@ -278,7 +278,7 @@ public UpdateContainer doIt(Workspace workspace) throws CommandException { // Create the semantic type object newType = new SemanticType(hNodeId, - ColumnSubClassLink.getFixedLabel(), classNode.getLabel(), classNode.getId(), false, + ColumnSubClassLink.getFixedLabel(), classNode.getLabel(), classNode.getId(), false, false, SemanticType.Origin.User, 1.0); } diff --git a/karma-commands/commands-alignment/src/main/java/edu/isi/karma/controller/command/alignment/SetSemanticTypeCommand.java b/karma-commands/commands-alignment/src/main/java/edu/isi/karma/controller/command/alignment/SetSemanticTypeCommand.java index c0ef87ea9..26c04fd2c 100644 --- a/karma-commands/commands-alignment/src/main/java/edu/isi/karma/controller/command/alignment/SetSemanticTypeCommand.java +++ b/karma-commands/commands-alignment/src/main/java/edu/isi/karma/controller/command/alignment/SetSemanticTypeCommand.java @@ -21,6 +21,7 @@ package edu.isi.karma.controller.command.alignment; import java.util.*; +import java.lang.System; import org.jgrapht.graph.DirectedWeightedMultigraph; import org.json.JSONArray; @@ -86,6 +87,8 @@ protected SetSemanticTypeCommand(String id, String model, String worksheetId, St this.language = language; this.hasProvenanceType = false; addTag(CommandTag.SemanticType); + +// System.out.println("types array" + this.typesArr.toString()); } @Override @@ -172,6 +175,7 @@ public UpdateContainer doIt(Workspace workspace) throws CommandException { } } this.typesArr = newTypesArr; +// System.out.println("types array 2" + this.typesArr.toString()); /*** Preprocess provenance types ***/ JSONArray provTypes = new JSONArray(); @@ -217,6 +221,9 @@ public UpdateContainer doIt(Workspace workspace) throws CommandException { JSONArray inputParams = new JSONArray(this.getInputParameterJson()); HistoryJsonUtil.setArgumentValue(Arguments.SemanticTypesArray.name(), typesArr, inputParams); this.setInputParameterJson(inputParams.toString()); + + +// System.out.println("input params" + inputParams.toString()); /*** Add the appropriate nodes and links in alignment graph ***/ ArrayList typesList = new ArrayList<>(); @@ -259,6 +266,10 @@ public UpdateContainer doIt(Workspace workspace) throws CommandException { boolean isProvenance = false; if(type.has(ClientJsonKeys.isProvenance.name())) isProvenance = type.getBoolean(ClientJsonKeys.isProvenance.name()); + + boolean isPrimary = false; + if(type.has(ClientJsonKeys.isPrimary.name())) + isPrimary = type.getBoolean(ClientJsonKeys.isPrimary.name()); Node source = alignment.getNodeById(sourceId); if (source == null) { @@ -284,7 +295,7 @@ public UpdateContainer doIt(Workspace workspace) throws CommandException { } newLink = alignment.addDataPropertyLink(source, columnNode, linkLabel, isProvenance); SemanticType newType = new SemanticType(hNodeId, linkLabel, source.getLabel(), source.getId(), - isProvenance, + isProvenance, isPrimary, SemanticType.Origin.User, 1.0); List userSemanticTypes = columnNode.getUserSemanticTypes(); diff --git a/karma-commands/commands-alignment/src/main/java/edu/isi/karma/controller/command/alignment/SuggestAutoModelCommand.java b/karma-commands/commands-alignment/src/main/java/edu/isi/karma/controller/command/alignment/SuggestAutoModelCommand.java index 044185415..b0f9ded5d 100644 --- a/karma-commands/commands-alignment/src/main/java/edu/isi/karma/controller/command/alignment/SuggestAutoModelCommand.java +++ b/karma-commands/commands-alignment/src/main/java/edu/isi/karma/controller/command/alignment/SuggestAutoModelCommand.java @@ -128,7 +128,7 @@ public UpdateContainer doIt(Workspace workspace) throws CommandException { alignment.addDataPropertyLink(classNode, columnNode, propertyLabel, false); // Create a semantic type object - SemanticType type = new SemanticType(hNode.getId(), propertyLabel, internalNodeLabel, classNode.getId(), false, SemanticType.Origin.User, 1.0); + SemanticType type = new SemanticType(hNode.getId(), propertyLabel, internalNodeLabel, classNode.getId(), false, false, SemanticType.Origin.User, 1.0); worksheet.getSemanticTypes().addType(type); List userSemanticTypes = columnNode.getUserSemanticTypes(); diff --git a/karma-commands/commands-alignment/src/main/java/edu/isi/karma/controller/command/alignment/SuggestAutoModelCommandFactory.java b/karma-commands/commands-alignment/src/main/java/edu/isi/karma/controller/command/alignment/SuggestAutoModelCommandFactory.java index ec8e25808..0f725f999 100644 --- a/karma-commands/commands-alignment/src/main/java/edu/isi/karma/controller/command/alignment/SuggestAutoModelCommandFactory.java +++ b/karma-commands/commands-alignment/src/main/java/edu/isi/karma/controller/command/alignment/SuggestAutoModelCommandFactory.java @@ -122,7 +122,7 @@ public Command createCommand(JSONArray inputJson, String model, Workspace worksp if (typeName != null) { type = new SemanticType(hNodeId, typeName, domainName, domainId, - false, Origin.User, 1.00); + false, false, Origin.User, 1.00); worksheet.getSemanticTypes().addType(type); } } diff --git a/karma-commands/commands-alignment/src/main/java/edu/isi/karma/controller/command/alignment/SuggestModelCommandFactory.java b/karma-commands/commands-alignment/src/main/java/edu/isi/karma/controller/command/alignment/SuggestModelCommandFactory.java index 3a8225631..79072b80e 100644 --- a/karma-commands/commands-alignment/src/main/java/edu/isi/karma/controller/command/alignment/SuggestModelCommandFactory.java +++ b/karma-commands/commands-alignment/src/main/java/edu/isi/karma/controller/command/alignment/SuggestModelCommandFactory.java @@ -84,7 +84,7 @@ public Command createCommand(JSONArray inputJson, String model, Workspace worksp domainName = ontMgr.getUriLabel(domain); if(typeName != null) { - type = new SemanticType(hNodeId, typeName, domainName, domainId, false, Origin.User, 1.00); + type = new SemanticType(hNodeId, typeName, domainName, domainId, false, false, Origin.User, 1.00); worksheet.getSemanticTypes().addType(type); } } diff --git a/karma-commands/commands-python/src/main/java/edu/isi/karma/controller/command/transformation/MutatingPythonTransformationCommand.java b/karma-commands/commands-python/src/main/java/edu/isi/karma/controller/command/transformation/MutatingPythonTransformationCommand.java index dbc6739a3..1825114df 100644 --- a/karma-commands/commands-python/src/main/java/edu/isi/karma/controller/command/transformation/MutatingPythonTransformationCommand.java +++ b/karma-commands/commands-python/src/main/java/edu/isi/karma/controller/command/transformation/MutatingPythonTransformationCommand.java @@ -112,7 +112,7 @@ protected UpdateContainer applyPythonTransformation(Workspace workspace, /** Add the alignment update **/ c.append(computeAlignmentAndSemanticTypesAndCreateUpdates(workspace)); - c.add(new InfoUpdate("Transformation complete")); + c.add(new InfoUpdate("Transformation updated")); return c; } diff --git a/karma-common/src/main/java/edu/isi/karma/controller/history/WorksheetCommandHistoryExecutor.java b/karma-common/src/main/java/edu/isi/karma/controller/history/WorksheetCommandHistoryExecutor.java index b4720ed0a..d031b80cf 100644 --- a/karma-common/src/main/java/edu/isi/karma/controller/history/WorksheetCommandHistoryExecutor.java +++ b/karma-common/src/main/java/edu/isi/karma/controller/history/WorksheetCommandHistoryExecutor.java @@ -121,6 +121,10 @@ private UpdateContainer executeCommand(JSONObject commObject, boolean saveToHist } catch(Exception e) { logger.error("Error executing command: "+ commandName + ". Please notify this error. \nInputs:" + inputParamArr, e); //make these InfoUpdates so that the UI can still process the rest of the model + if(commandName.equals("SetSemanticTypeCommand")) { + System.out.println("commandName equal to SetSemanticTypeCommand"); + return new UpdateContainer(new TrivialErrorUpdate("Error executing command " + commandName + " from history, since you may have deleted the related column.")); + } return new UpdateContainer(new TrivialErrorUpdate("Error executing command " + commandName + " from history")); } } diff --git a/karma-common/src/main/java/edu/isi/karma/controller/update/SemanticTypesUpdate.java b/karma-common/src/main/java/edu/isi/karma/controller/update/SemanticTypesUpdate.java index faaa9c602..932daffb5 100644 --- a/karma-common/src/main/java/edu/isi/karma/controller/update/SemanticTypesUpdate.java +++ b/karma-common/src/main/java/edu/isi/karma/controller/update/SemanticTypesUpdate.java @@ -25,6 +25,7 @@ import java.util.HashMap; import java.util.Map; import java.util.Set; +import java.lang.System; import org.json.JSONException; import org.json.JSONStringer; @@ -106,7 +107,7 @@ public void generateJson(String prefix, PrintWriter pw, VWorkspace vWorkspace) { } writer.endArray(); writer.endObject(); - +// System.out.println("writer " + writer.toString()); pw.print(writer.toString()); } catch (JSONException e) { logger.error("Error occured while writing to JSON!", e); @@ -131,7 +132,8 @@ private void writeType(SemanticType type, JSONWriter writer, Map> results = service.invokeAll(plan.workers); for(Future result : results) { - result.get(3, TimeUnit.MINUTES); + + result.get(10, TimeUnit.MINUTES); } } else @@ -81,7 +82,7 @@ public Boolean call() throws Exception { } }); - result.get(1, TimeUnit.MINUTES); + result.get(10, TimeUnit.MINUTES); } } catch (Exception e) { diff --git a/karma-common/src/main/java/edu/isi/karma/modeling/Uris.java b/karma-common/src/main/java/edu/isi/karma/modeling/Uris.java index 346ac5308..7bcc3f685 100644 --- a/karma-common/src/main/java/edu/isi/karma/modeling/Uris.java +++ b/karma-common/src/main/java/edu/isi/karma/modeling/Uris.java @@ -36,6 +36,7 @@ public abstract class Uris { public static final String RDFS_CLASS_URI = Namespaces.RDFS + "Class"; public static final String RDFS_LABEL_URI = Namespaces.RDFS + "label"; public static final String RDFS_COMMENT_URI = Namespaces.RDFS + "comment"; + public static final String RDFS_RANGE_URI = Namespaces.RDFS + "range"; public static final String RDF_VALUE_URI = Namespaces.RDF + "value"; public static final String OWL_SAMEAS_URI = Namespaces.OWL + "sameAs"; diff --git a/karma-common/src/main/java/edu/isi/karma/modeling/alignment/Alignment.java b/karma-common/src/main/java/edu/isi/karma/modeling/alignment/Alignment.java index 4af23617f..fa533779e 100644 --- a/karma-common/src/main/java/edu/isi/karma/modeling/alignment/Alignment.java +++ b/karma-common/src/main/java/edu/isi/karma/modeling/alignment/Alignment.java @@ -1110,7 +1110,7 @@ public void updateAlignment(SemanticModel model, List semanticType if (target instanceof ColumnNode) { SemanticType st = new SemanticType(((ColumnNode)target).getHNodeId(), newLink.getLabel(), source.getLabel(), source.getId(), - false, + false, false, SemanticType.Origin.User, 1.0); semanticTypes.add(st); } diff --git a/karma-common/src/main/java/edu/isi/karma/modeling/alignment/GraphUtil.java b/karma-common/src/main/java/edu/isi/karma/modeling/alignment/GraphUtil.java index 32f09babf..cd2eb01b5 100644 --- a/karma-common/src/main/java/edu/isi/karma/modeling/alignment/GraphUtil.java +++ b/karma-common/src/main/java/edu/isi/karma/modeling/alignment/GraphUtil.java @@ -968,7 +968,7 @@ private static SemanticType readSemanticType(JsonReader reader) throws IOExcepti } reader.endObject(); - SemanticType semanticType = new SemanticType(hNodeId, type, domain, null, false, origin, confidenceScore); + SemanticType semanticType = new SemanticType(hNodeId, type, domain, null, false, false, origin, confidenceScore); return semanticType; } diff --git a/karma-common/src/main/java/edu/isi/karma/modeling/alignment/SemanticModel.java b/karma-common/src/main/java/edu/isi/karma/modeling/alignment/SemanticModel.java index 0ce263301..196aa4ee0 100644 --- a/karma-common/src/main/java/edu/isi/karma/modeling/alignment/SemanticModel.java +++ b/karma-common/src/main/java/edu/isi/karma/modeling/alignment/SemanticModel.java @@ -250,7 +250,7 @@ private void setUserTypesForColumnNodes() { for (LabeledLink link : incomingLinks) { Node domain = link.getSource(); SemanticType st = new SemanticType(cn.getHNodeId(), link.getLabel(), - domain.getLabel(), domain.getId(), false, + domain.getLabel(), domain.getId(), false, false, Origin.User, 1.0); cn.assignUserType(st); } diff --git a/karma-common/src/main/java/edu/isi/karma/modeling/ontology/OntologyCache.java b/karma-common/src/main/java/edu/isi/karma/modeling/ontology/OntologyCache.java index 4406d52d9..219c225fb 100644 --- a/karma-common/src/main/java/edu/isi/karma/modeling/ontology/OntologyCache.java +++ b/karma-common/src/main/java/edu/isi/karma/modeling/ontology/OntologyCache.java @@ -571,12 +571,20 @@ private void loadProperties() { // if (p.isAnnotationProperty()) // continue; + + if (!properties.containsKey(p.getURI())) properties.put(p.getURI(), ontHandler.getResourceLabel(p)); - + //datatype property put ? in hashmap if (p.isDatatypeProperty() || !p.isObjectProperty()) { if (!dataProperties.containsKey(p.getURI())) +// if (p.getRange() != null){ +// logger.error("data type pro " + p); +// logger.error("get range " + p.getRange()); +// logger.error("dp " + ontHandler.getResourceLabel(p)); +// } + dataProperties.put(p.getURI(), ontHandler.getResourceLabel(p)); } diff --git a/karma-common/src/main/java/edu/isi/karma/modeling/ontology/OntologyHandler.java b/karma-common/src/main/java/edu/isi/karma/modeling/ontology/OntologyHandler.java index 01dd3ecde..01c389542 100644 --- a/karma-common/src/main/java/edu/isi/karma/modeling/ontology/OntologyHandler.java +++ b/karma-common/src/main/java/edu/isi/karma/modeling/ontology/OntologyHandler.java @@ -23,9 +23,11 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; +import java.util.regex.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.apache.commons.lang3.StringUtils; import com.hp.hpl.jena.ontology.ConversionException; import com.hp.hpl.jena.ontology.DatatypeProperty; @@ -40,10 +42,12 @@ import com.hp.hpl.jena.ontology.UnionClass; import com.hp.hpl.jena.rdf.model.ModelFactory; import com.hp.hpl.jena.rdf.model.Property; +import com.hp.hpl.jena.rdf.model.RDFNode; import com.hp.hpl.jena.rdf.model.Resource; import com.hp.hpl.jena.util.iterator.ExtendedIterator; import edu.isi.karma.rep.alignment.Label; +import edu.isi.karma.modeling.Uris; class OntologyHandler { @@ -71,7 +75,7 @@ public Label getUriLabel(String uri) { public Label getResourceLabel(Resource r) { if (r == null || !ontModel.containsResource(r)) { - logger.debug("Could not find the resource in the ontology model."); + logger.error("Could not find the resource in the ontology model."); return null; } String ns = r.getNameSpace(); @@ -96,6 +100,7 @@ public Label getResourceLabel(Resource r) { logger.error("No rdfs:label for resource:" + r.toString()); rdfsLabel = ""; } + String rdfsComment; try { rdfsComment = ontR.getComment("EN"); @@ -105,7 +110,31 @@ public Label getResourceLabel(Resource r) { logger.error("No Comment for resource:" + r.toString()); rdfsComment = ""; } - return new Label(r.getURI(), ns, prefix, rdfsLabel, rdfsComment); + + String rdfsRange; + try { + rdfsRange = null; + String temp = ""; + if(ontR.isDatatypeProperty()) { + OntProperty ontP = null; + ontP = ontR.asProperty(); + if (ontP != null) { + temp = ontP.getRange().toString(); + temp = StringUtils.substringAfterLast(temp, "http://www.w3.org/2001/XMLSchema#"); + if (temp.length() > 0){ + rdfsRange = "xsd:"; + rdfsRange = rdfsRange.concat(temp); + + } + } + } + + } catch(Exception e) { +// logger.error("No rdfs:range for resource: " + r.toString() + " " + e.toString()); + rdfsRange = ""; + } + + return new Label(r.getURI(), ns, prefix, rdfsLabel, rdfsRange, rdfsComment); } diff --git a/karma-common/src/main/java/edu/isi/karma/modeling/ontology/OntologyManager.java b/karma-common/src/main/java/edu/isi/karma/modeling/ontology/OntologyManager.java index d4c4fae4a..14214c8c0 100644 --- a/karma-common/src/main/java/edu/isi/karma/modeling/ontology/OntologyManager.java +++ b/karma-common/src/main/java/edu/isi/karma/modeling/ontology/OntologyManager.java @@ -104,7 +104,7 @@ public boolean doImportAndUpdateCache(File sourceFile, String encoding) throws I return false; } - logger.debug("Importing " + sourceFile.getName() + " OWL Ontology ..."); +// logger.error("Importing " + sourceFile.getName() + " OWL Ontology ..."); if(!sourceFile.exists()){ logger.error("file does not exist " + sourceFile.getAbsolutePath()); @@ -115,8 +115,9 @@ public boolean doImportAndUpdateCache(File sourceFile, String encoding) throws I InputStreamReader s = EncodingDetector.getInputStreamReader(sourceFile, encoding); if (Files.getFileExtension(sourceFile.getName()).equalsIgnoreCase("N3")) ontHandler.getOntModel().read(s, null, "N3"); - else if (Files.getFileExtension(sourceFile.getName()).equalsIgnoreCase("TTL")) + else if (Files.getFileExtension(sourceFile.getName()).equalsIgnoreCase("TTL")){ ontHandler.getOntModel().read(s, null, "TURTLE"); + } else ontHandler.getOntModel().read(s, null); // default lang = "RDF/XML" @@ -138,8 +139,6 @@ public boolean doImport(File sourceFile, String encoding) throws IOException { logger.debug("input file is null."); return false; } - - logger.debug("Importing " + sourceFile.getName() + " OWL Ontology ..."); if(!sourceFile.exists()){ logger.error("file does not exist " + sourceFile.getAbsolutePath()); @@ -159,8 +158,9 @@ public boolean doImport(File sourceFile, String encoding) throws IOException { InputStreamReader s = EncodingDetector.getInputStreamReader(sourceFile, encoding); if (Files.getFileExtension(sourceFile.getName()).equalsIgnoreCase("N3")) ontHandler.getOntModel().read(s, null, "N3"); - else if (Files.getFileExtension(sourceFile.getName()).equalsIgnoreCase("TTL")) + else if (Files.getFileExtension(sourceFile.getName()).equalsIgnoreCase("TTL")) { ontHandler.getOntModel().read(s, null, "TURTLE"); + } else if (Files.getFileExtension(sourceFile.getName()).equalsIgnoreCase("NT")) ontHandler.getOntModel().read(s, null, "N-TRIPLE"); else diff --git a/karma-common/src/main/java/edu/isi/karma/modeling/semantictypes/SemanticTypeUtil.java b/karma-common/src/main/java/edu/isi/karma/modeling/semantictypes/SemanticTypeUtil.java index 0d3107d74..b0796a68e 100644 --- a/karma-common/src/main/java/edu/isi/karma/modeling/semantictypes/SemanticTypeUtil.java +++ b/karma-common/src/main/java/edu/isi/karma/modeling/semantictypes/SemanticTypeUtil.java @@ -304,7 +304,7 @@ public List getSuggestedTypes(OntologyManager ontologyManager, Label propertyLabel = ontologyManager.getUriLabel(propertyUri); if (propertyLabel == null) continue; - SemanticType semanticType = new SemanticType(columnNode.getHNodeId(), propertyLabel, domainLabel, null, false, Origin.TfIdfModel, confidence); + SemanticType semanticType = new SemanticType(columnNode.getHNodeId(), propertyLabel, domainLabel, null, false, false, Origin.TfIdfModel, confidence); logger.info("\t" + propertyUri + " of " + domainUri + ": " + confidence); suggestedSemanticTypes.add(semanticType); } @@ -339,7 +339,7 @@ public ArrayList getColumnSemanticSuggestions(Workspace workspace, Label propertyLabel = ontologyManager.getUriLabel(propertyUri); if (propertyLabel == null) continue; - SemanticType semanticType = new SemanticType(hNodeId, propertyLabel, domainLabel, null, false, Origin.TfIdfModel, confidence); + SemanticType semanticType = new SemanticType(hNodeId, propertyLabel, domainLabel, null, false, false, Origin.TfIdfModel, confidence); logger.info("\t" + propertyUri + " of " + domainUri + ": " + confidence); suggestedSemanticTypes.add(semanticType); } diff --git a/karma-common/src/main/java/edu/isi/karma/rep/alignment/ColumnNode.java b/karma-common/src/main/java/edu/isi/karma/rep/alignment/ColumnNode.java index f195e17c0..d49a4ac8f 100644 --- a/karma-common/src/main/java/edu/isi/karma/rep/alignment/ColumnNode.java +++ b/karma-common/src/main/java/edu/isi/karma/rep/alignment/ColumnNode.java @@ -79,6 +79,7 @@ public void setLearnedSemanticTypes(List learnedSemanticTypes) { st.getDomain(), st.getDomainId(), st.isProvenance(), + st.isPrimary(), st.getOrigin(), confidence / sum); this.learnedSemanticTypes.add(semType); diff --git a/karma-common/src/main/java/edu/isi/karma/rep/alignment/Label.java b/karma-common/src/main/java/edu/isi/karma/rep/alignment/Label.java index 1fdc106f0..25a5036c9 100644 --- a/karma-common/src/main/java/edu/isi/karma/rep/alignment/Label.java +++ b/karma-common/src/main/java/edu/isi/karma/rep/alignment/Label.java @@ -32,13 +32,15 @@ public class Label implements Serializable { private String ns; private String prefix; private String rdfsLabel; + private String rdfsRange; private String rdfsComment; - public Label(String uri, String ns, String prefix, String rdfsLabel, String rdfsComment) { + public Label(String uri, String ns, String prefix, String rdfsLabel, String rdfsRange, String rdfsComment) { this.uri = uri; this.ns = ns; this.prefix = prefix; this.rdfsLabel = rdfsLabel; + this.rdfsRange = rdfsRange; this.rdfsComment = rdfsComment; } @@ -62,6 +64,7 @@ public Label(Label uri) { this.ns = uri.getNs(); this.prefix = uri.getPrefix(); this.rdfsLabel = uri.getRdfsLabel(); + this.rdfsRange = uri.getRdfsRange(); this.rdfsComment = uri.getRdfsComment(); } } @@ -71,6 +74,7 @@ private void init() { this.ns = null; this.prefix = null; this.rdfsLabel = null; + this.rdfsRange = null; this.rdfsComment = null; } @@ -78,12 +82,10 @@ public void setUri(String uri) { this.uri = uri; } - public void setNs(String ns) { this.ns = ns; } - public void setPrefix(String prefix) { this.prefix = prefix; } @@ -91,6 +93,10 @@ public void setPrefix(String prefix) { public void setRdfsLabel(String label) { this.rdfsLabel = label; } + + public void setRdfsRange(String range) { + this.rdfsRange = range; + } public void setRdfsComment(String comment) { this.rdfsComment = comment; @@ -136,11 +142,14 @@ public String getDisplayName() { name = uri; return name; } - public String getRdfsLabel() { return rdfsLabel; } + public String getRdfsRange() { + return rdfsRange; + } + public String getRdfsComment() { return rdfsComment; } diff --git a/karma-common/src/main/java/edu/isi/karma/rep/alignment/SemanticType.java b/karma-common/src/main/java/edu/isi/karma/rep/alignment/SemanticType.java index 0dd5eded5..9d786cca0 100644 --- a/karma-common/src/main/java/edu/isi/karma/rep/alignment/SemanticType.java +++ b/karma-common/src/main/java/edu/isi/karma/rep/alignment/SemanticType.java @@ -42,6 +42,7 @@ public class SemanticType implements Jsonizable, Serializable, Comparable 0.8) @@ -102,6 +104,10 @@ public Double getConfidenceScore() { public boolean isProvenance() { return this.isProvenance; } + + public boolean isPrimary() { + return this.isPrimary; + } @Override public String toString() { diff --git a/karma-common/src/main/java/edu/isi/karma/rep/sources/DataSource.java b/karma-common/src/main/java/edu/isi/karma/rep/sources/DataSource.java index 396be8514..2772504e8 100644 --- a/karma-common/src/main/java/edu/isi/karma/rep/sources/DataSource.java +++ b/karma-common/src/main/java/edu/isi/karma/rep/sources/DataSource.java @@ -162,7 +162,7 @@ private void updateModel(DirectedWeightedMultigraph treeModel continue; Label classPredicate = new Label(n.getLabel().getUri(), n.getLabel().getNs(), n.getLabel().getPrefix(), - n.getLabel().getRdfsLabel(), n.getLabel().getRdfsComment()); + n.getLabel().getRdfsLabel(), n.getLabel().getRdfsRange(), n.getLabel().getRdfsComment()); ClassAtom classAtom = new ClassAtom(classPredicate, vertexIdToArgument.get(n.getId())); m.getAtoms().add(classAtom); @@ -175,7 +175,7 @@ private void updateModel(DirectedWeightedMultigraph treeModel continue; Label propertyPredicate = new Label(e.getLabel().getUri(), e.getLabel().getNs(), e.getLabel().getPrefix(), - e.getLabel().getRdfsLabel(), e.getLabel().getRdfsComment()); + e.getLabel().getRdfsLabel(), e.getLabel().getRdfsRange(), e.getLabel().getRdfsComment()); IndividualPropertyAtom propertyAtom = null; // has_subclass is from source to target, we substitute this with a rdfs:subClassOf from target to source diff --git a/karma-common/src/main/java/edu/isi/karma/rep/sources/WebService.java b/karma-common/src/main/java/edu/isi/karma/rep/sources/WebService.java index cff3cb9d6..eb38dd62d 100644 --- a/karma-common/src/main/java/edu/isi/karma/rep/sources/WebService.java +++ b/karma-common/src/main/java/edu/isi/karma/rep/sources/WebService.java @@ -424,7 +424,7 @@ private Model getInputModel(DirectedWeightedMultigraph treeMo continue; Label classPredicate = new Label(n.getLabel().getUri(), n.getLabel().getNs(), n.getLabel().getPrefix(), - n.getLabel().getRdfsLabel(), n.getLabel().getRdfsComment()); + n.getLabel().getRdfsLabel(), n.getLabel().getRdfsRange(), n.getLabel().getRdfsComment()); ClassAtom classAtom = new ClassAtom(classPredicate, vertexIdToArgument.get(n.getId())); m.getAtoms().add(classAtom); @@ -439,7 +439,7 @@ private Model getInputModel(DirectedWeightedMultigraph treeMo continue; Label propertyPredicate = new Label(e.getLabel().getUri(), e.getLabel().getNs(), e.getLabel().getPrefix(), - e.getLabel().getRdfsLabel(), e.getLabel().getRdfsComment()); + e.getLabel().getRdfsLabel(), e.getLabel().getRdfsRange(), e.getLabel().getRdfsComment()); IndividualPropertyAtom propertyAtom; // // has_subclass is from source to target, we substitute this with a rdfs:subClassOf from target to source @@ -481,7 +481,7 @@ private Model getOutputModel(DirectedWeightedMultigraph treeM Label classPredicate = new Label(n.getLabel().getUri(), n.getLabel().getNs(), n.getLabel().getPrefix(), - n.getLabel().getRdfsLabel(), n.getLabel().getRdfsComment()); + n.getLabel().getRdfsLabel(), n.getLabel().getRdfsRange(), n.getLabel().getRdfsComment()); ClassAtom classAtom = new ClassAtom(classPredicate, vertexIdToArgument.get(n.getId())); m.getAtoms().add(classAtom); @@ -497,7 +497,7 @@ private Model getOutputModel(DirectedWeightedMultigraph treeM continue; Label propertyPredicate = new Label(e.getLabel().getUri(), e.getLabel().getNs(), e.getLabel().getPrefix(), - e.getLabel().getRdfsLabel(), e.getLabel().getRdfsComment()); + e.getLabel().getRdfsLabel(), e.getLabel().getRdfsRange(), e.getLabel().getRdfsComment()); IndividualPropertyAtom propertyAtom; // has_subclass is from source to target, we substitute this with a rdfs:subClassOf from target to source diff --git a/karma-web/src/main/webapp/index.jsp b/karma-web/src/main/webapp/index.jsp index a5db8f741..43def0cf3 100755 --- a/karma-web/src/main/webapp/index.jsp +++ b/karma-web/src/main/webapp/index.jsp @@ -190,8 +190,14 @@ and related projects, please see: http://www.isi.edu/integration
  •  Name or ID First
  • -
  •  Export Superclass +
  • Export Superclass
  • + <%----%> diff --git a/karma-web/src/main/webapp/js/ServerResponseObjectParsing.js b/karma-web/src/main/webapp/js/ServerResponseObjectParsing.js index fef76f65e..f552ec266 100755 --- a/karma-web/src/main/webapp/js/ServerResponseObjectParsing.js +++ b/karma-web/src/main/webapp/js/ServerResponseObjectParsing.js @@ -362,7 +362,7 @@ function parse(data) { var worksheetPanel = $("div#" + element["worksheetId"] + "_row"); D3ModelManager.getInstance().deleteModel(element["worksheetId"]); worksheetPanel.remove(); - $.sticky("Worksheet deleted"); + $.sticky("Worksheet updated"); } else if (element["updateType"] == "WorksheetHeadersUpdate") { console.time('header update'); var worksheetPanel = $("div.Worksheet#" + element["worksheetId"]); @@ -791,6 +791,7 @@ function parse(data) { var errExists = []; if (trivialErrors.length == 1) { errorMessage = trivialErrors[0]; + console.log("error message", errorMessage, trivialErrors); txt.append(errorMessage + "
    "); errExists[errorMessage] = true; } else { diff --git a/karma-web/src/main/webapp/js/propertyUI.js b/karma-web/src/main/webapp/js/propertyUI.js index fad326997..f6a357f51 100755 --- a/karma-web/src/main/webapp/js/propertyUI.js +++ b/karma-web/src/main/webapp/js/propertyUI.js @@ -6,6 +6,7 @@ function PropertyUI(id, propertyFuncTop, propertyFuncBottom, maxHeight, loadTre "uri": "", "label": "", "rdfsLabel": "", + "literaltype": "", "id": "" }; @@ -27,7 +28,7 @@ function PropertyUI(id, propertyFuncTop, propertyFuncBottom, maxHeight, loadTre var selectOnLoad = false; console.log("PopulatePropertyList:" + dataArray.length); - + // console.log("PopulatePropertyList data:" + dataArray[0][0]); if (dataArray.length == 0) { $(list1).jstree("destroy"); $(list1).html("none"); @@ -40,14 +41,15 @@ function PropertyUI(id, propertyFuncTop, propertyFuncBottom, maxHeight, loadTre propertyData.rdfsLabel = selectedNodeData.metadata.rdfsLabel; propertyData.uri = selectedNodeData.metadata.uri; propertyData.id = selectedNodeData.metadata.id; + propertyData.literaltype = selectedNodeData.metadata.literaltype; propertyData.other = selectedNodeData.metadata.other; var treeId = PropertyUI.getNodeID(propertyData.label, propertyData.rdfsLabel, propertyData.id, propertyData.uri); $(list1).jstree('open_node', treeId); //Open node will scroll to that pos $(list2).jstree("deselect_all"); - $("#" + id + "_propertyKeyword").val(Settings.getInstance().getDisplayLabel(propertyData.label, propertyData.rdfsLabel, true)); + $("#literalTypeSelect").val(propertyData.literaltype); if (!selectOnLoad && propertySelectorCallback != null) { propertySelectorCallback(propertyData); } @@ -57,6 +59,7 @@ function PropertyUI(id, propertyFuncTop, propertyFuncBottom, maxHeight, loadTre console.log("property jstree Type: " + $(list1).attr("id")); if (propertyData.label.length > 0) { $("#" + id + "_propertyKeyword").val(Settings.getInstance().getDisplayLabel(propertyData.label, propertyData.rdfsLabel, true)); + $("#literalTypeSelect").val(propertyData.literaltype); } window.setTimeout(function() { if (propertyData.label.length > 0) { @@ -162,7 +165,7 @@ function PropertyUI(id, propertyFuncTop, propertyFuncBottom, maxHeight, loadTre window.clearTimeout(searchTimer); searchTimer = window.setTimeout(function() { var keyword = $(textbox).val(); - //console.log("Property keyup: " + keyword); + console.log("Property keyup: " + keyword); $("div#" + id + "_propertyList1").jstree("search", keyword); $("div#" + id + "_propertyList2").jstree("search", keyword); }, 1000); //Wait 1 secs before searching @@ -281,7 +284,7 @@ function PropertyUI(id, propertyFuncTop, propertyFuncBottom, maxHeight, loadTre }; //Static declarations -PropertyUI.getNodeObject = function(label, rdfsLabel, cId, uri, other) { +PropertyUI.getNodeObject = function(label, rdfsLabel, cId, uri, literaltype, other) { var treeId = PropertyUI.getNodeID(label, rdfsLabel, cId, uri); var text = Settings.getInstance().getDisplayLabel(label, rdfsLabel); @@ -295,16 +298,18 @@ PropertyUI.getNodeObject = function(label, rdfsLabel, cId, uri, other) { id: cId, "label": label, "rdfsLabel": rdfsLabel, + "literaltype": literaltype, "other": other } }; + // var nodeData = { attr: { id : treeId }, data: label, metadata:{"uri": uri, id : cId, "label":label} } ; return nodeData; }; PropertyUI.parseNodeObject = function(nodeData) { //return [nodeData.data.title, nodeData.metadata.id, nodeData.metadata.uri]; - return [nodeData.metadata.label, nodeData.metadata.rdfsLabel, nodeData.metadata.id, nodeData.metadata.uri, nodeData.metadata.other]; + return [nodeData.metadata.label, nodeData.metadata.rdfsLabel, nodeData.metadata.id, nodeData.metadata.uri, nodeData.metadata.literaltype, nodeData.metadata.other]; }; PropertyUI.getNodeID = function(label, rdfsLabel, id, uri) { diff --git a/karma-web/src/main/webapp/js/semanticTypes.js b/karma-web/src/main/webapp/js/semanticTypes.js index b033ba628..0c5777223 100755 --- a/karma-web/src/main/webapp/js/semanticTypes.js +++ b/karma-web/src/main/webapp/js/semanticTypes.js @@ -63,13 +63,14 @@ var SetSemanticTypeDialog = (function() { propertyList = null; loadTree = true; + hideError(); $("#semanticType_columnName", dialog).text(columnTitle); $("table#semanticTypesTable tr.semTypeRow", dialog).remove(); $("table#semanticTypesTable tr.editRow", dialog).remove(); - $("#literalTypeSelect").val(""); + // $("#literalTypeSelect").val(""); $("#languageSelect").val(""); dialog.removeData("selectedPrimaryRow"); @@ -84,6 +85,7 @@ var SetSemanticTypeDialog = (function() { var typeJsonObject = $(tdTag).data("typesJsonObject"); if (typeJsonObject) { existingTypes = typeJsonObject["SemanticTypesArray"]; + console.log("existingTypes", existingTypes); } else { existingTypes = []; } @@ -95,6 +97,8 @@ var SetSemanticTypeDialog = (function() { var suggestedTypes = getSuggestedTypes(); var addSemTypeOrAdvOption = function(type, isPrimary, isProvenance, isSelected, isCrfModelSuggested) { + // console.log("addSemTypeOrAdvOption", type); + if (type["DisplayLabel"] == "km-dev:classLink") { addUriSemanticType(type["DisplayDomainLabel"], type["DomainRDFSLabel"], type["DomainUri"], type["DomainId"], isPrimary, isProvenance, isSelected, isCrfModelSuggested); @@ -115,11 +119,13 @@ var SetSemanticTypeDialog = (function() { // Populate the table with existing types and CRF suggested types $.each(existingTypes, function(index, type) { + // console.log("type in existingTypes", type); // Take care of the special meta properties that are set through the advanced options addSemTypeOrAdvOption(type, type["isPrimary"], type["isProvenance"], true, false); }); if (suggestedTypes) { $.each(suggestedTypes["Labels"], function(index, type) { + // console.log("type in suggestedTypes", type); if(type["DisplayLabel"] == "km-dev:columnSubClassOfLink" || type["DisplayLabel"] == "km-dev:dataPropertyOfColumnLink" || type["DisplayLabel"] == "km-dev:objectPropertySpecialization") { @@ -234,6 +240,8 @@ var SetSemanticTypeDialog = (function() { var fullType = $(row).data("FullType"); var domainUri = $(row).data("DomainUri"); var domainId = $(row).data("DomainId"); + console.log("literalType of this row", $(row).data("literalType")); + // Check if the user selected a fake semantic type object if (domainUri == "fakeDomainURI" || fullType == "fakePropertyURI") { @@ -259,9 +267,11 @@ var SetSemanticTypeDialog = (function() { newType["DomainUri"] = domainUri; newType["DomainId"] = domainId; newType["DomainLabel"] = $(row).data("DisplayDomainLabel"); + // newType["literaltype"] = "test"; // Check if it was chosen primary - newType["isPrimary"] = $("input[name='isPrimaryGroup']:radio", $(row)).is(":checked"); + console.log("isPrimary",$("input[name='isPrimaryGroup']:radio", row).prop("checked")); + newType["isPrimary"] = $("input[name='isPrimaryGroup']:radio", row).prop("checked"); newType["isProvenance"] = $("input[name='isProvenanceGroup']:checkbox", $(row)).is(":checked"); existingTypes.push(newType); }); @@ -288,6 +298,7 @@ var SetSemanticTypeDialog = (function() { // Check if any meta property (advanced options) was selected var semTypesArray = getCurrentSelectedTypes(); + console.log("semTypesArray", semTypesArray); if ($("#isSubclassOfClass").prop("checked") || $("#isSpecializationForEdge").prop("checked") || (semTypesArray != null && semTypesArray.length == 1 && semTypesArray[0]["FullType"] == "http://isi.edu/integration/karma/dev#classLink")) { info["command"] = "SetMetaPropertyCommand"; @@ -361,7 +372,7 @@ var SetSemanticTypeDialog = (function() { newInfo.push(getParamObject("language", $("#languageSelect").val(), "other")); info["newInfo"] = JSON.stringify(newInfo); - console.log(info); + console.log("info", info); showLoading(info["worksheetId"]); var returned = $.ajax({ url: "RequestController", @@ -462,6 +473,16 @@ var SetSemanticTypeDialog = (function() { if(semTypeObject["isProvenance"]) { isProvenance = semTypeObject["isProvenance"]; } + var dataPropertyList = getAllDataProperties(worksheetId); + var literalType = ""; + // //add literal type to each row + $.each(dataPropertyList, function(index, prop) { + if(prop.label == semTypeObject["DisplayLabel"]){ + // console.log("prop.label", prop.label); + literalType = prop.literaltype; + return; + } + }); var trTag = $("").addClass("semTypeRow") .data("FullType", semTypeObject["FullType"]) @@ -471,6 +492,7 @@ var SetSemanticTypeDialog = (function() { .data("DisplayDomainLabel", semTypeObject["DisplayDomainLabel"]) .data("DisplayLabel", semTypeObject["DisplayLabel"]) .data("DisplayRDFSLabel",semTypeObject["DisplayRDFSLabel"]) + .data("literalType",literalType) .append($("").append($("") .attr("type", "checkbox") .attr("name", "currentSemanticTypeCheckBoxGroup") @@ -484,6 +506,7 @@ var SetSemanticTypeDialog = (function() { .attr("type", "radio") .attr("name", "isPrimaryGroup") .attr("value", semTypeObject["DisplayLabel"]) + .change(semanticTypesTableRadioHandler) .val(semTypeObject["DisplayLabel"]))) .append($("").append($("") .attr("type", "checkbox") @@ -505,9 +528,10 @@ var SetSemanticTypeDialog = (function() { trTag.addClass("selected"); if (semTypeObject["isPrimary"]) { + console.log("is P and the literalType is", trTag.data("literalType")); $("input[name='isPrimaryGroup']:radio", trTag).prop('checked', true); selectedPrimaryRow = trTag; - $("#literalTypeSelect").val(semTypeObject["rdfLiteralType"]); + $("#literalTypeSelect").val(trTag.data("literalType")); $("#languageSelect").val(semTypeObject["language"]); } @@ -527,17 +551,22 @@ var SetSemanticTypeDialog = (function() { // Deselect any meta property checkbox $("div#semanticTypesAdvacedOptionsDiv input:checkbox").prop('checked', false); - // If it was checked if ($(this).is(':checked')) { + console.log("checked", parentTr); //if(parentTr.data("DisplayLabel") == "km-dev:classLink"){ var rows = $("tr.selected", table); + for (var i = 0; i < rows.length; i++) { var row = rows[i]; + console.log("row", row); if ($(row).data("DisplayLabel") == "km-dev:classLink" || parentTr.data("DisplayLabel") == "km-dev:classLink") { $("input[name='currentSemanticTypeCheckBoxGroup']:checkbox", row).prop('checked', false); - $("input[name='isPrimaryGroup']:radio", row).prop('checked', false); - $(row).removeClass("selected"); + if ($("input[name='isPrimaryGroup']:radio", row).is(':checked')) { + $("input[name='isPrimaryGroup']:radio", row).prop('checked', false); + $(row).removeClass("selected"); + } + } } @@ -545,29 +574,40 @@ var SetSemanticTypeDialog = (function() { //} parentTr.addClass("selected"); var numRows = $("tr.selected", table).length; - if (numRows == 1) - $("input[name='isPrimaryGroup']:radio", parentTr).prop('checked', true); + if (numRows == 1){ + $("input[name='isPrimaryGroup']:radio", parentTr).prop('checked', true); + $("#literalTypeSelect").val(parentTr.data("literalType")); + } + } // If it was unchecked else { parentTr.removeClass("selected"); - // If the row was marked as primary, make some other selected row as primary + console.log("unchecked", parentTr); + // If the row was marked as primary, if ($("input[name='isPrimaryGroup']:radio", parentTr).is(':checked')) { - if ($("tr.selected", table).length == 0) - $("input[name='isPrimaryGroup']:radio", parentTr).prop('checked', false); - else { - $.each($("tr.selected", table), function(index, row) { - if (index == 0) { - $("input[name='isPrimaryGroup']:radio", row).prop('checked', true); - return false; - } - }); - } + $("input[name='isPrimaryGroup']:radio", parentTr).prop('checked', false); + $("#literalTypeSelect").val(""); } } } - function getClasses() { + function semanticTypesTableRadioHandler(){ + console.log("semanticTypesTableRadioHandler"); + + var parentTr = $(this).parents("tr"); + + // If it was checked + if ($(this).is(':checked')) { + $("#literalTypeSelect").val(parentTr.data("literalType")); + $("input[name='isPrimaryGroup']:radio", parentTr).prop('checked', true); + }else{ + $("input[name='isPrimaryGroup']:radio", parentTr).prop('checked', false); + } + + } + + function getClasses() { if (classList == null) { classList = getAllClasses(worksheetId); @@ -603,7 +643,7 @@ var SetSemanticTypeDialog = (function() { var result = []; $.each(propertyList, function(index, prop) { - result.push(PropertyUI.getNodeObject(prop.label, prop.rdfsLabel, prop.id, prop.uri)); + result.push(PropertyUI.getNodeObject(prop.label, prop.rdfsLabel, prop.id, prop.uri, prop.literaltype)); }); return result; } @@ -618,7 +658,7 @@ var SetSemanticTypeDialog = (function() { var props = getAllPropertiesForClass(worksheetId, thisClass.uri); var result = []; $.each(props, function(index, prop) { - result.push(PropertyUI.getNodeObject(prop.label, prop.rdfsLabel, prop.id, prop.uri)); + result.push(PropertyUI.getNodeObject(prop.label, prop.rdfsLabel, prop.id, prop.uri, prop.literaltype)); }); return result; } @@ -1241,6 +1281,7 @@ var IncomingOutgoingLinksDialog = (function() { if (allProperties != null) { for (var i = 0; i < allProperties.length; i++) { var prop = allProperties[i]; + console.log(prop); var propElem = PropertyUI.parseNodeObject(prop); var propLbl = propElem[0]; var propRdfsLabel = propElem[1]; @@ -1397,7 +1438,7 @@ var IncomingOutgoingLinksDialog = (function() { props = getAllObjectProperties(worksheetId); var result = []; $.each(props, function(index, prop) { - result.push(PropertyUI.getNodeObject(prop.label, prop.rdfsLabel, prop.id, prop.uri)); + result.push(PropertyUI.getNodeObject(prop.label, prop.rdfsLabel, prop.id, prop.uri, prop.literaltype)); }); allProperties = result; @@ -1425,7 +1466,7 @@ var IncomingOutgoingLinksDialog = (function() { var props = getAllPropertiesForDomainRange(worksheetId, domain, range); $.each(props, function(index, prop) { - result.push(PropertyUI.getNodeObject(prop.label, prop.rdfsLabel, prop.id, prop.uri)); + result.push(PropertyUI.getNodeObject(prop.label, prop.rdfsLabel, prop.id, prop.uri, prop.literaltype)); }); selectedProperties = result; } @@ -1800,7 +1841,7 @@ var ManageIncomingOutgoingLinksDialog = (function() { props = getAllObjectProperties(worksheetId); var result = []; $.each(props, function(index, prop) { - result.push(PropertyUI.getNodeObject(prop.label, prop.rdfsLabel, prop.id, prop.uri)); + result.push(PropertyUI.getNodeObject(prop.label, prop.rdfsLabel, prop.id, prop.uri, prop.literaltype)); }); allProperties = result; if (loadTree) @@ -1827,7 +1868,7 @@ var ManageIncomingOutgoingLinksDialog = (function() { var props = getAllPropertiesForDomainRange(worksheetId, domain, range); var result = []; $.each(props, function(index, prop) { - result.push(PropertyUI.getNodeObject(prop.label, prop.rdfsLabel, prop.id, prop.uri)); + result.push(PropertyUI.getNodeObject(prop.label, prop.rdfsLabel, prop.id, prop.uri, prop.literaltype)); }); selectedProperties = result; return result; @@ -2698,7 +2739,7 @@ var AddLiteralNodeDialog = (function() { var result = []; $.each(propertyList, function(index, prop) { - result.push(PropertyUI.getNodeObject(prop.label, prop.rdfsLabel, prop.id, prop.uri, prop.type)); + result.push(PropertyUI.getNodeObject(prop.label, prop.rdfsLabel, prop.id, prop.uri, prop.literaltypee)); }); return result; diff --git a/karma-web/src/main/webapp/js/tableColumnOptions.js b/karma-web/src/main/webapp/js/tableColumnOptions.js index b7def225d..bef1acbb6 100755 --- a/karma-web/src/main/webapp/js/tableColumnOptions.js +++ b/karma-web/src/main/webapp/js/tableColumnOptions.js @@ -4,7 +4,8 @@ function TableColumnOptions(wsId, wsColumnId, wsColumnTitle, isLeafNode, isOutof var columnTitle = wsColumnTitle; var columnId = wsColumnId; - var options = [{ + var options = [ + { name: "Set Semantic Type", func: setSemanticType, leafOnly: true, @@ -127,6 +128,7 @@ function TableColumnOptions(wsId, wsColumnId, wsColumnTitle, isLeafNode, isOutof console.log("addRows"); hideDropdown(); $("#pyTransformSelectionDialog").data("operation", "Union"); + console.log("tco", wsColumnId); PyTransformSelectionDialog.getInstance(wsId, wsColumnId).show(); } diff --git a/karma-web/src/main/webapp/js/util.js b/karma-web/src/main/webapp/js/util.js index 4fd18c95c..1bdbe5717 100755 --- a/karma-web/src/main/webapp/js/util.js +++ b/karma-web/src/main/webapp/js/util.js @@ -349,6 +349,7 @@ function parseClassJSON(clazz, result, allLabels) { function getSuggestedSemanticTypes(worksheetId, columnId, classUri) { var info = generateInfoObject(worksheetId, columnId, "GetSemanticSuggestionsCommand"); + var newInfo = info['newInfo']; // Used for commands that take JSONArray as input and are saved in the history if(classUri) { info["classUri"] = classUri; @@ -366,6 +367,7 @@ function getSuggestedSemanticTypes(worksheetId, columnId, classUri) { complete: function(xhr, textStatus) { var json = $.parseJSON(xhr.responseText); hideLoading(info["worksheetId"]); + result = json.elements[0]; }, error: function(xhr, textStatus) { @@ -597,6 +599,7 @@ function parsePropertyJSON(prop, result) { "rdfsLabel": prop.rdfsLabel, "id": prop.id, "uri": prop.uri, + "literaltype": prop.literaltype, "type": prop.type }; result.push(node); diff --git a/karma-web/src/main/webapp/js/worksheetOptions.js b/karma-web/src/main/webapp/js/worksheetOptions.js index fd5f230e8..c1b3be333 100755 --- a/karma-web/src/main/webapp/js/worksheetOptions.js +++ b/karma-web/src/main/webapp/js/worksheetOptions.js @@ -153,6 +153,7 @@ function WorksheetOptions(wsId, wsTitle) { console.log("addRows"); hideDropdown(); $("#pyTransformSelectionDialog").data("operation", "Union"); + console.log(PyTransformSelectionDialog.getInstance(wsId, "")); PyTransformSelectionDialog.getInstance(wsId, "").show(); } diff --git a/karma-web/src/main/webapp/publish/GRAPHVIZ/temp b/karma-web/src/main/webapp/publish/GRAPHVIZ/temp new file mode 100644 index 000000000..e69de29bb diff --git a/karma-web/src/main/webapp/publish/REPORT/temp b/karma-web/src/main/webapp/publish/REPORT/temp new file mode 100644 index 000000000..e69de29bb diff --git a/karma-web/src/main/webapp/uiLibs/swfobject/js/swfobject.js b/karma-web/src/main/webapp/uiLibs/swfobject/js/swfobject.js index 8eafe9dd8..d816b6598 100755 --- a/karma-web/src/main/webapp/uiLibs/swfobject/js/swfobject.js +++ b/karma-web/src/main/webapp/uiLibs/swfobject/js/swfobject.js @@ -1,4 +1,4 @@ -/* SWFObject v2.2 +/* SWFObject v2.2 is released under the MIT License */ var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y0){for(var af=0;af0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad'}}aa.outerHTML='"+af+"";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab