private static void writeSemanticType(JsonWriter writer, SemanticType semanticType) throws IOException { if (semanticType == null) return; String nullStr = null; writer.beginObject(); writer.name("hNodeId").value(semanticType.getHNodeId()); writer.name("domain"); if (semanticType.getDomain() == null) writer.value(nullStr); else writeLabel(writer, semanticType.getDomain()); writer.name("type"); if (semanticType.getType() == null) writer.value(nullStr); else writeLabel(writer, semanticType.getType()); writer.name("origin").value(semanticType.getOrigin().toString()); writer.name("confidenceScore").value(semanticType.getConfidenceScore()); writer.endObject(); }
public void setLearnedSemanticTypes(List<SemanticType> learnedSemanticTypes) { double sum = 0.0; // normalizing the confidence scores if (learnedSemanticTypes != null) { for (SemanticType st : learnedSemanticTypes) { sum += st.getConfidenceScore() != null ? st.getConfidenceScore().doubleValue() : 0.0; } double confidence; this.learnedSemanticTypes = new ArrayList<>(); for (SemanticType st : learnedSemanticTypes) { confidence = st.getConfidenceScore() != null ? st.getConfidenceScore() : 0.0; SemanticType semType = new SemanticType(st.getHNodeId(), st.getType(), st.getDomain(), st.getDomainId(), st.isProvenance(), st.getOrigin(), confidence / sum); this.learnedSemanticTypes.add(semType); } } if (this.learnedSemanticTypes != null) Collections.sort(this.learnedSemanticTypes, Collections.reverseOrder()); }
private boolean hasType(SemanticType type, String property, String domain) { String typeURI = type.getType().getUri(); String domainURI = type.getDomain().getUri(); if ((typeURI.equals(property) && domainURI.equals(domain)) || (isSubPropertyOf(typeURI, property, true) && isSubClassOf( domainURI, domain, true))) return true; else return false; }
writer.key(JsonKeys.language.name()).value(language); String index = type.getDomainId().substring(type.getDomain().getUri().length()); String domainDisplayLabel = type.getDomain().getDisplayName() + index; if (!type.isClass()) { writer .key(JsonKeys.DisplayRDFSComment.name()).value(type.getType().getRdfsComment()) .key(JsonKeys.DomainId.name()).value(type.getDomainId()) .key(JsonKeys.DomainUri.name()).value(type.getDomain().getUri()) .key(JsonKeys.DisplayDomainLabel.name()).value(domainDisplayLabel) .key(JsonKeys.DomainRDFSLabel.name()).value(type.getDomain().getRdfsLabel()) .key(JsonKeys.DomainRDFSComment.name()).value(type.getDomain().getRdfsComment()) .key(JsonKeys.isProvenance.name()).value(type.isProvenance()) .key(JsonKeys.FullType.name()).value(type.getDomainId()) .key(JsonKeys.DisplayLabel.name()).value(domainDisplayLabel) .key(JsonKeys.DisplayRDFSLabel.name()).value(type.getDomain().getRdfsLabel()) .key(JsonKeys.DisplayRDFSComment.name()).value(type.getDomain().getRdfsComment()) .key(JsonKeys.DomainId.name()).value("") .key(JsonKeys.DomainUri.name()).value("")
public String getModelLabelString() { return this.getDomain().getUri() + "|" + this.getType().getUri(); }
public static HashMap<SemanticType, LabeledLink> getDomainLinks(DirectedGraph<Node, DefaultLink> g, ColumnNode n, List<SemanticType> semanticTypes) { HashMap<SemanticType, LabeledLink> domainLinks = new HashMap<>(); if (g == null || n == null || semanticTypes == null || !g.vertexSet().contains(n)) return domainLinks; Set<DefaultLink> incomingLinks = g.incomingEdgesOf(n); if (incomingLinks != null) { for (SemanticType st : semanticTypes) { for (DefaultLink l : incomingLinks) { if (st.getDomain().getUri().equalsIgnoreCase(l.getSource().getUri()) && st.getType().getUri().equalsIgnoreCase(l.getUri())) { if (l instanceof LabeledLink) domainLinks.put(st, (LabeledLink)l); } } } } return domainLinks; }
semanticType.getDomain() == null || semanticType.getType() == null) continue; domainUri = semanticType.getDomain().getUri(); propertyUri = semanticType.getType().getUri(); semanticType.getDomain() == null || semanticType.getType() == null) continue; domainUri = semanticType.getDomain().getUri(); propertyUri = semanticType.getType().getUri(); Integer countOfSemanticType = semanticTypesCount.get(domainUri + propertyUri);
for (SemanticType type : worksheet.getSemanticTypes().getListOfTypes()) { if (type.getType().getUri().equals(SRID_PROPERTY) && type.getDomain().getUri().equals(SRID_CLASS)){ && type.getDomain().getUri().equals(POINT_CLASS)) { && type.getDomain().getUri().equals(POINT_CLASS)) { && type.getDomain().getUri().equals(POINT_CLASS)) { coordinateHNodeIds.add(0, type.getHNodeId()); currentCase = CoordinateCase.POINT_POS; && type.getDomain().getUri().equals(LINE_CLASS)) { coordinateHNodeIds.add(0, type.getHNodeId()); currentCase = CoordinateCase.LINE_POS_LIST; && type.getDomain().getUri().equals(POLYGON_CLASS)) { coordinateHNodeIds.add(0, type.getHNodeId()); currentCase = CoordinateCase.POLYGON_POS_LIST;
for (SemanticType st : suggestedTypes) targetLabel += "\n[" + getLocalName(st.getDomain().getUri()) + "," + getLocalName(st.getType().getUri()) +