diff --git a/case-uco/java/src/org/sleuthkit/caseuco/CaseUcoExporter.java b/case-uco/java/src/org/sleuthkit/caseuco/CaseUcoExporter.java index 600bc647ec5d400cbf2529d0021646cb56ec950b..ce061a0b273957b163315847082e7d66b2f1677c 100644 --- a/case-uco/java/src/org/sleuthkit/caseuco/CaseUcoExporter.java +++ b/case-uco/java/src/org/sleuthkit/caseuco/CaseUcoExporter.java @@ -992,7 +992,7 @@ private void assembleMetadataExif(String uuid, BlackboardArtifact artifact, List .addFacet(new DeviceFacet() .setManufacturer(getValueIfPresent(artifact, StandardAttributeTypes.TSK_DEVICE_MAKE)) .setModel(getValueIfPresent(artifact, StandardAttributeTypes.TSK_DEVICE_MODEL))) - .addFacet(new LatLongCoordinatesFacets() + .addFacet(new LatLongCoordinatesFacet() .setAltitude(getDoubleIfPresent(artifact, StandardAttributeTypes.TSK_GEO_ALTITUDE)) .setLatitude(getDoubleIfPresent(artifact, StandardAttributeTypes.TSK_GEO_LATITUDE)) .setLongitude(getDoubleIfPresent(artifact, StandardAttributeTypes.TSK_GEO_LONGITUDE))); @@ -1075,17 +1075,19 @@ private void assembleBluetoothPairing(String uuid, BlackboardArtifact artifact, private void assembleGpsBookmark(String uuid, BlackboardArtifact artifact, List<JsonElement> output) throws TskCoreException { ObservableObject export = new ObservableObject(uuid) - .addFacet(new LatLongCoordinatesFacets() + .addFacet(new LatLongCoordinatesFacet() .setAltitude(getDoubleIfPresent(artifact, StandardAttributeTypes.TSK_GEO_ALTITUDE)) .setLatitude(getDoubleIfPresent(artifact, StandardAttributeTypes.TSK_GEO_LATITUDE)) .setLongitude(getDoubleIfPresent(artifact, StandardAttributeTypes.TSK_GEO_LONGITUDE))) .addFacet(new ApplicationFacet() .setApplicationIdentifier(getValueIfPresent(artifact, StandardAttributeTypes.TSK_PROG_NAME))); - + SimpleAddressFacet simpleAddress = new SimpleAddressFacet(); - simpleAddress.setDescription(getValueIfPresent(artifact, StandardAttributeTypes.TSK_LOCATION)); - export.addFacet(simpleAddress); + if (getValueIfPresent(artifact, StandardAttributeTypes.TSK_LOCATION) != null) { + simpleAddress.setDescription(getValueIfPresent(artifact, StandardAttributeTypes.TSK_LOCATION)); + export.addFacet(simpleAddress); + } export.setCreatedTime(getLongIfPresent(artifact, StandardAttributeTypes.TSK_DATETIME)); export.setName(getValueIfPresent(artifact, StandardAttributeTypes.TSK_NAME)); @@ -1094,7 +1096,7 @@ private void assembleGpsBookmark(String uuid, BlackboardArtifact artifact, List< private void assembleGpsLastKnownLocation(String uuid, BlackboardArtifact artifact, List<JsonElement> output) throws TskCoreException { ObservableObject export = new ObservableObject(uuid) - .addFacet(new LatLongCoordinatesFacets() + .addFacet(new LatLongCoordinatesFacet() .setAltitude(getDoubleIfPresent(artifact, StandardAttributeTypes.TSK_GEO_ALTITUDE)) .setLatitude(getDoubleIfPresent(artifact, StandardAttributeTypes.TSK_GEO_LATITUDE)) .setLongitude(getDoubleIfPresent(artifact, StandardAttributeTypes.TSK_GEO_LONGITUDE))); @@ -1105,9 +1107,11 @@ private void assembleGpsLastKnownLocation(String uuid, BlackboardArtifact artifa locationNode.setName(getValueIfPresent(artifact, StandardAttributeTypes.TSK_NAME)); SimpleAddressFacet simpleAddress = new SimpleAddressFacet(); - simpleAddress.setDescription(getValueIfPresent(artifact, StandardAttributeTypes.TSK_LOCATION)); - export.addFacet(simpleAddress); - + if (getValueIfPresent(artifact, StandardAttributeTypes.TSK_LOCATION) != null) { + simpleAddress.setDescription(getValueIfPresent(artifact, StandardAttributeTypes.TSK_LOCATION)); + export.addFacet(simpleAddress); + } + serializeObjectToOutput(export, output); serializeObjectToOutput(locationNode, output); serializeObjectToOutput(new BlankRelationshipNode() @@ -1117,7 +1121,7 @@ private void assembleGpsLastKnownLocation(String uuid, BlackboardArtifact artifa private void assembleGpsSearch(String uuid, BlackboardArtifact artifact, List<JsonElement> output) throws TskCoreException { ObservableObject export = new ObservableObject(uuid) - .addFacet(new LatLongCoordinatesFacets() + .addFacet(new LatLongCoordinatesFacet() .setAltitude(getDoubleIfPresent(artifact, StandardAttributeTypes.TSK_GEO_ALTITUDE)) .setLatitude(getDoubleIfPresent(artifact, StandardAttributeTypes.TSK_GEO_LATITUDE)) .setLongitude(getDoubleIfPresent(artifact, StandardAttributeTypes.TSK_GEO_LONGITUDE))); @@ -1128,8 +1132,11 @@ private void assembleGpsSearch(String uuid, BlackboardArtifact artifact, List<Js locationNode.setName(getValueIfPresent(artifact, StandardAttributeTypes.TSK_NAME)); SimpleAddressFacet simpleAddress = new SimpleAddressFacet(); - simpleAddress.setDescription(getValueIfPresent(artifact, StandardAttributeTypes.TSK_LOCATION)); - export.addFacet(simpleAddress); + + if (getValueIfPresent(artifact, StandardAttributeTypes.TSK_LOCATION) != null) { + simpleAddress.setDescription(getValueIfPresent(artifact, StandardAttributeTypes.TSK_LOCATION)); + export.addFacet(simpleAddress); + } serializeObjectToOutput(export, output); serializeObjectToOutput(locationNode, output); @@ -1190,8 +1197,10 @@ private void assembleGPSRoute(String uuid, BlackboardArtifact artifact, List<Jso export.setCreatedTime(getLongIfPresent(artifact, StandardAttributeTypes.TSK_DATETIME)); SimpleAddressFacet simpleAddress = new SimpleAddressFacet(); - simpleAddress.setDescription(getValueIfPresent(artifact, StandardAttributeTypes.TSK_LOCATION)); - export.addFacet(simpleAddress); + if (getValueIfPresent(artifact, StandardAttributeTypes.TSK_LOCATION) != null) { + simpleAddress.setDescription(getValueIfPresent(artifact, StandardAttributeTypes.TSK_LOCATION)); + export.addFacet(simpleAddress); + } Location location = new BlankLocationNode(); location.setName(getValueIfPresent(artifact, StandardAttributeTypes.TSK_NAME)); @@ -1468,7 +1477,7 @@ private void assembleGpsTrack(String uuid, BlackboardArtifact artifact, List<Jso if (trackpoints != null) { GeoTrackPoints points = BlackboardJsonAttrUtil.fromAttribute(trackpoints, GeoTrackPoints.class); for (GeoTrackPoints.TrackPoint point : points) { - export.addFacet(new LatLongCoordinatesFacets() + export.addFacet(new LatLongCoordinatesFacet() .setAltitude(point.getAltitude()) .setLatitude(point.getLatitude()) .setLongitude(point.getLongitude())); diff --git a/case-uco/java/src/org/sleuthkit/caseuco/LatLongCoordinatesFacets.java b/case-uco/java/src/org/sleuthkit/caseuco/LatLongCoordinatesFacet.java similarity index 76% rename from case-uco/java/src/org/sleuthkit/caseuco/LatLongCoordinatesFacets.java rename to case-uco/java/src/org/sleuthkit/caseuco/LatLongCoordinatesFacet.java index 5ee36a1db02bf2889abcefab02e9b37b40151b32..7e0dfa94b2f1120d4e0d717b54cd7051cda5dacb 100644 --- a/case-uco/java/src/org/sleuthkit/caseuco/LatLongCoordinatesFacets.java +++ b/case-uco/java/src/org/sleuthkit/caseuco/LatLongCoordinatesFacet.java @@ -21,10 +21,10 @@ import com.google.gson.annotations.SerializedName; /** - * This class definition mirrors the LatLongCoordinatesFacets observable described in + * This class definition mirrors the LatLongCoordinatesFacet observable described in the UCO ontology. */ -class LatLongCoordinatesFacets extends Facet { +class LatLongCoordinatesFacet extends Facet { @SerializedName("location:altitude") private Double altitude; @@ -35,21 +35,21 @@ class LatLongCoordinatesFacets extends Facet { @SerializedName("location:longitude") private Double longitude; - LatLongCoordinatesFacets() { - super(UcoObject.UCO_LOCATION + LatLongCoordinatesFacets.class.getSimpleName()); + LatLongCoordinatesFacet() { + super(UcoObject.UCO_LOCATION + LatLongCoordinatesFacet.class.getSimpleName()); } - LatLongCoordinatesFacets setAltitude(Double altitude) { + LatLongCoordinatesFacet setAltitude(Double altitude) { this.altitude = altitude; return this; } - LatLongCoordinatesFacets setLatitude(Double latitude) { + LatLongCoordinatesFacet setLatitude(Double latitude) { this.latitude = latitude; return this; } - LatLongCoordinatesFacets setLongitude(Double longitude) { + LatLongCoordinatesFacet setLongitude(Double longitude) { this.longitude = longitude; return this; } diff --git a/case-uco/java/src/org/sleuthkit/caseuco/ObservableObject.java b/case-uco/java/src/org/sleuthkit/caseuco/ObservableObject.java index b87a84af34b296620b4d41365659dcdbac7f1f33..18e43cff7fb8c21759cc1f709908e442289276b7 100644 --- a/case-uco/java/src/org/sleuthkit/caseuco/ObservableObject.java +++ b/case-uco/java/src/org/sleuthkit/caseuco/ObservableObject.java @@ -29,7 +29,7 @@ class ObservableObject extends UcoObject { static final String OBSERVABLE = "observable:"; - @SerializedName("uco-core:hasFacet") + @SerializedName("core:hasFacet") private final List<Facet> facets; ObservableObject(String uuid) { diff --git a/case-uco/java/src/org/sleuthkit/caseuco/UcoObject.java b/case-uco/java/src/org/sleuthkit/caseuco/UcoObject.java index a43ddf0148447793a0426ba8b33d702cfcaa5b69..adfd6f8d76edafbb99e6d83dafe60bae9a8f9824 100755 --- a/case-uco/java/src/org/sleuthkit/caseuco/UcoObject.java +++ b/case-uco/java/src/org/sleuthkit/caseuco/UcoObject.java @@ -27,9 +27,9 @@ */ abstract class UcoObject { - static final String UCO_OBSERV = "uco-observable:"; + static final String UCO_OBSERV = "observable:"; static final String UCO_ACTION = "action:"; - static final String UCO_LOCATION = "Location:"; + static final String UCO_LOCATION = "location:"; static final String UCO_CORE = "core:"; static final String UCO_IDENTITY = "identity:"; static final String UCO_TYPES = "types:"; @@ -37,9 +37,6 @@ abstract class UcoObject { @SerializedName("@id") private String id; - @SerializedName("@type") - private final String type; - @SerializedName("core:createdTime") private String createdTime; @@ -55,6 +52,9 @@ abstract class UcoObject { @SerializedName("core:tag") private String tag; + @SerializedName("@type") + private final String type; + UcoObject(String id, String type) { this.id = id; this.type = type;