-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#4 added num distinct rdf nodes property
- Loading branch information
1 parent
7c8f0fe
commit ad66bd5
Showing
1 changed file
with
47 additions
and
0 deletions.
There are no files selected for viewing
47 changes: 47 additions & 0 deletions
47
src/main/java/lodanalysis/model/statements/NumDistinctRDFNodes.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package lodanalysis.model.statements; | ||
|
||
import java.io.File; | ||
import java.io.IOException; | ||
|
||
import org.apache.commons.io.FileUtils; | ||
|
||
import lodanalysis.Paths; | ||
import lodanalysis.model.CreateModel; | ||
import lodanalysis.model.CreateModelStatement; | ||
import lodanalysis.model.CreateModel.Namespace; | ||
|
||
import com.hp.hpl.jena.datatypes.xsd.XSDDatatype; | ||
|
||
|
||
public class NumDistinctRDFNodes extends CreateModelStatement { | ||
|
||
|
||
public NumDistinctRDFNodes(CreateModel factory) { | ||
super(factory); | ||
} | ||
|
||
@Override | ||
public void createDescription() throws IOException { | ||
int bnodes = 0; | ||
try { | ||
bnodes = countLines(new File(dir, Paths.BNODE_COUNTS)); | ||
} catch (Exception IOException) { | ||
//just skip | ||
} | ||
int literals = 0; | ||
try { | ||
literals = Integer.parseInt(FileUtils.readFileToString(new File(dir, Paths.DISTINCT_LITERALS))); | ||
} catch(Exception e) { | ||
//just skip | ||
} | ||
int uris = 0; | ||
try { | ||
uris = Integer.parseInt(FileUtils.readFileToString(new File(dir, Paths.DISTINCT_URIS))); | ||
} catch(Exception e) { | ||
//just skip | ||
} | ||
|
||
doc.addProperty(getProp(Namespace.LLM, "distinctRDFNodes"), Integer.toString(bnodes + literals + uris), XSDDatatype.XSDlong); | ||
} | ||
|
||
} |