You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by ch...@apache.org on 2012/11/26 10:14:38 UTC
svn commit: r1413521 - in /jena/Scratch/Eyeball/trunk: doc/
src/main/java/com/hp/hpl/jena/extras/tools/query/
src/main/java/com/hp/hpl/jena/eyeball/assemblers/
src/main/java/com/hp/hpl/jena/eyeball/gui/
src/main/java/com/hp/hpl/jena/eyeball/inspectors/...
Author: chrisdollin
Date: Mon Nov 26 09:14:36 2012
New Revision: 1413521
URL: http://svn.apache.org/viewvc?rev=1413521&view=rev
Log:
Alled reportAll for properties and classes. Don't need file: on .rdf files that are being parsed.
Modified:
jena/Scratch/Eyeball/trunk/doc/eyeball-2.4-full-template.html
jena/Scratch/Eyeball/trunk/src/main/java/com/hp/hpl/jena/extras/tools/query/ModelQuery.java
jena/Scratch/Eyeball/trunk/src/main/java/com/hp/hpl/jena/eyeball/assemblers/EyeballAssembler.java
jena/Scratch/Eyeball/trunk/src/main/java/com/hp/hpl/jena/eyeball/gui/Eyeballer.java
jena/Scratch/Eyeball/trunk/src/main/java/com/hp/hpl/jena/eyeball/inspectors/ClassInspector.java
jena/Scratch/Eyeball/trunk/src/main/java/com/hp/hpl/jena/eyeball/inspectors/PropertyInspector.java
jena/Scratch/Eyeball/trunk/src/main/java/com/hp/hpl/jena/eyeball/loaders/FileLoader.java
jena/Scratch/Eyeball/trunk/src/main/java/com/hp/hpl/jena/eyeball/loaders/OntLoader.java
jena/Scratch/Eyeball/trunk/src/main/java/com/hp/hpl/jena/eyeball/vocabulary/EyeballAssembling.java
jena/Scratch/Eyeball/trunk/src/main/java/jena/eyeball.java
jena/Scratch/Eyeball/trunk/src/test/java/com/hp/hpl/jena/eyeball/loaders/test/TestFileLoader.java
jena/Scratch/Eyeball/trunk/src/test/java/com/hp/hpl/jena/eyeball/vocabulary/test/TestVocabulary.java
Modified: jena/Scratch/Eyeball/trunk/doc/eyeball-2.4-full-template.html
URL: http://svn.apache.org/viewvc/jena/Scratch/Eyeball/trunk/doc/eyeball-2.4-full-template.html?rev=1413521&r1=1413520&r2=1413521&view=diff
==============================================================================
--- jena/Scratch/Eyeball/trunk/doc/eyeball-2.4-full-template.html (original)
+++ jena/Scratch/Eyeball/trunk/doc/eyeball-2.4-full-template.html Mon Nov 26 09:14:36 2012
@@ -100,6 +100,7 @@
java [java options eg classpath and proxy] -jar eyeball-2.4-exec.jar
(-check | -sign | -accept) specialURL+
[-assume Reference*]
+ [-language (OWL | RDFS | profileURI)]
[-config fileOrURL*]
[-set Setting*]
[-root rootURI]
@@ -108,6 +109,7 @@ java [java options eg classpath and prox
[-exclude shortName*]
[-analyse | -repair]
[-remark] [-version]
+ [-merge [true|false]]
</pre>
<p>
@@ -291,6 +293,22 @@ $eyeball -check myConfig.ttl -sign >s
to Eyeball so that it can interpret this as a literal.
</p>
+<h3>merged RDF/XML parsing errors</h3>
+
+<pre>
+-merge
+-merge true
+-merge false
+</pre>
+
+<p>
+ If the file being checked has a <code>.rdf</code>
+ suffix, and -merge is absent, has no arguments, or
+ has final argument true, then all RDF/XML parsing
+ errors are merged into the Eyeball reports for this
+ model. Otherwise those errors are reported on stderr.
+</p>
+
<h3>-include/-exclude shortNames</h3>
<p>
@@ -330,6 +348,21 @@ $eyeball -check myConfig.ttl -sign >s
-assume owl my-ontology.owl
</pre>
+ <p>Independantly, the Jena language profile for the assumptions
+ can be set with the <code>-language</code> option. The default
+ is the RDFS profile. RDFS and OWL can be referred to by those
+ names; other profiles (as per Jena's ProfileRegistry) must be
+ specified by their full URI. The primary use of -language is
+ to ensure, by using <code>-language OWL</code>, that only
+ OWL classes are recognised by the ClassInspector.
+ </p>
+
+<pre>
+-language RDFS
+-language OWL
+-language profileURI
+</pre>
+
<h3>-sign and -accept (experimental)</h3>
<p>If <i>-sign</i> is specified, Eyeball first does a
Modified: jena/Scratch/Eyeball/trunk/src/main/java/com/hp/hpl/jena/extras/tools/query/ModelQuery.java
URL: http://svn.apache.org/viewvc/jena/Scratch/Eyeball/trunk/src/main/java/com/hp/hpl/jena/extras/tools/query/ModelQuery.java?rev=1413521&r1=1413520&r2=1413521&view=diff
==============================================================================
--- jena/Scratch/Eyeball/trunk/src/main/java/com/hp/hpl/jena/extras/tools/query/ModelQuery.java (original)
+++ jena/Scratch/Eyeball/trunk/src/main/java/com/hp/hpl/jena/extras/tools/query/ModelQuery.java Mon Nov 26 09:14:36 2012
@@ -90,7 +90,7 @@ public class ModelQuery
/**
Add a new (S P O) query triple pattern specified by <code>s</code>. Really
- for testing purposes: note that it is not possible to beuild a statement with
+ for testing purposes: note that it is not possible to build a statement with
a QueryVariable as a property (a type inconvenience).
*/
public ModelQuery add( Statement s )
@@ -118,10 +118,10 @@ public class ModelQuery
Answer an iterator over the variable bindings which satisfy this query over
the model <code>data</code>.
*/
- public ExtendedIterator<? extends List<Node>> run( Model data )
+ public ExtendedIterator<List<Node>> run( Model data )
{
query.setQueryPattern( eg );
- for (Node var: variables) query.addResultVar( var );
+ for (Node var: variables) query.addResultVar( var );
//
QueryExecution qx = QueryExecutionFactory.create( query, data );
ResultSet rs = qx.execSelect();
Modified: jena/Scratch/Eyeball/trunk/src/main/java/com/hp/hpl/jena/eyeball/assemblers/EyeballAssembler.java
URL: http://svn.apache.org/viewvc/jena/Scratch/Eyeball/trunk/src/main/java/com/hp/hpl/jena/eyeball/assemblers/EyeballAssembler.java?rev=1413521&r1=1413520&r2=1413521&view=diff
==============================================================================
--- jena/Scratch/Eyeball/trunk/src/main/java/com/hp/hpl/jena/eyeball/assemblers/EyeballAssembler.java (original)
+++ jena/Scratch/Eyeball/trunk/src/main/java/com/hp/hpl/jena/eyeball/assemblers/EyeballAssembler.java Mon Nov 26 09:14:36 2012
@@ -25,6 +25,7 @@ import com.hp.hpl.jena.eyeball.*;
import com.hp.hpl.jena.eyeball.renderers.TextRenderer;
import com.hp.hpl.jena.eyeball.vocabulary.EYE;
import com.hp.hpl.jena.ontology.OntModel;
+import com.hp.hpl.jena.ontology.ProfileRegistry;
import com.hp.hpl.jena.rdf.model.*;
import com.hp.hpl.jena.shared.JenaException;
import com.hp.hpl.jena.util.FileManager;
@@ -54,9 +55,15 @@ public class EyeballAssembler extends As
return new Eyeball( i, a, r );
}
+ /**
+ Answer an OntModel containing the union of all the assumption
+ models declared by the root. The language profile of the OntModel
+ is defined by the eye:language property, see below.
+ */
private OntModel getAssumptions( final Assembler sub, Resource root )
{
- OntModel result = ModelFactory.createOntologyModel();
+ String profile = getProfile( root );
+ OntModel result = ModelFactory.createOntologyModel( profile );
Map1<Statement, Model> openObject = new Map1<Statement, Model>()
{
public Model map1( Statement arg0 )
@@ -67,11 +74,28 @@ public class EyeballAssembler extends As
}
};
List<Model> assumptions = root.listProperties( EYE.assume ).mapWith( openObject ).toList();
- for (Iterator<Model> it = assumptions.iterator(); it.hasNext();)
- result.add( it.next() );
+ for (Model it: assumptions) result.add( it );
return result;
}
+ /**
+ Answer the profile name [URI] of the ontology language
+ to use for the assumptions of the check. If the root
+ has no eye:language property, return the RDFS profile.
+ Otherwise, if there are any eye:language properties,
+ pick one of them: if its value is RDFS or OWL, then
+ return the correspoding profile URI, otherwise assume
+ that the value is that URI and return it.
+ */
+ private String getProfile( Resource root ) {
+ Statement defineLang = root.getProperty( EYE.language );
+ if (defineLang == null) return ProfileRegistry.RDFS_LANG;
+ String lang = defineLang.getString();
+ if (lang.equals("RDFS")) return ProfileRegistry.RDFS_LANG;
+ if (lang.equals("OWL")) return ProfileRegistry.OWL_LANG;
+ return lang;
+ }
+
private Renderer getRenderer( Assembler a, Resource root )
{
Resource r = getUniqueResource( root, EYE.renderer );
@@ -121,4 +145,10 @@ public class EyeballAssembler extends As
Set<Inspector> inspectors = root.listProperties( EYE.inspector ).mapWith( asInspector ).toSet();
return Inspector.Operations.create( inspectors );
}
+
+ public static boolean getBoolean( Resource root, Property which, boolean ifAbsent )
+ {
+ Statement s = root.getProperty( which );
+ return s == null ? ifAbsent : s.getBoolean();
+ }
}
Modified: jena/Scratch/Eyeball/trunk/src/main/java/com/hp/hpl/jena/eyeball/gui/Eyeballer.java
URL: http://svn.apache.org/viewvc/jena/Scratch/Eyeball/trunk/src/main/java/com/hp/hpl/jena/eyeball/gui/Eyeballer.java?rev=1413521&r1=1413520&r2=1413521&view=diff
==============================================================================
--- jena/Scratch/Eyeball/trunk/src/main/java/com/hp/hpl/jena/eyeball/gui/Eyeballer.java (original)
+++ jena/Scratch/Eyeball/trunk/src/main/java/com/hp/hpl/jena/eyeball/gui/Eyeballer.java Mon Nov 26 09:14:36 2012
@@ -117,14 +117,6 @@ public class Eyeballer implements Contro
return result;
}
- private OntLoader createLoader()
- {
- Loader db = new JDBCLoader();
- Loader base = new FileLoader();
- OntLoader loader = new OntLoader( new JDBCSensitiveLoader( db, base ) );
- return loader;
- }
-
public void go( List<? extends JCheckBox> inspectorCheckBoxes, SomeBoxesPanel assumed, SomeBoxesPanel checked )
{
List<String> args = new ArrayList<String>();
@@ -152,7 +144,7 @@ public class Eyeballer implements Contro
while ( it.hasNext() )
{
Report problems = new Report();
- OntLoader loader = createLoader();
+ OntLoader loader = OntLoader.createLoader( true );
OntModel m = loader.ontLoad( problems, it.next() );
if ( checked.showModel() )
outputModel( m, "Input model display", "This is the input model", checked.writerLanguage() );
Modified: jena/Scratch/Eyeball/trunk/src/main/java/com/hp/hpl/jena/eyeball/inspectors/ClassInspector.java
URL: http://svn.apache.org/viewvc/jena/Scratch/Eyeball/trunk/src/main/java/com/hp/hpl/jena/eyeball/inspectors/ClassInspector.java?rev=1413521&r1=1413520&r2=1413521&view=diff
==============================================================================
--- jena/Scratch/Eyeball/trunk/src/main/java/com/hp/hpl/jena/eyeball/inspectors/ClassInspector.java (original)
+++ jena/Scratch/Eyeball/trunk/src/main/java/com/hp/hpl/jena/eyeball/inspectors/ClassInspector.java Mon Nov 26 09:14:36 2012
@@ -21,6 +21,7 @@ package com.hp.hpl.jena.eyeball.inspecto
import java.util.*;
import com.hp.hpl.jena.eyeball.Report;
+import com.hp.hpl.jena.eyeball.assemblers.EyeballAssembler;
import com.hp.hpl.jena.eyeball.vocabulary.EYE;
import com.hp.hpl.jena.ontology.*;
import com.hp.hpl.jena.rdf.model.*;
@@ -30,11 +31,16 @@ public class ClassInspector extends Insp
{
public final Set<Resource> knownClasses = builtinClasses();
+ final boolean reportAll;
+
public ClassInspector( Resource root )
- { this(); }
+ { this( EyeballAssembler.getBoolean( root, EYE.reportAll, false ) ); }
public ClassInspector()
- {}
+ { this(false); }
+
+ public ClassInspector(boolean reportAll)
+ { this.reportAll = reportAll; }
public void begin( Report r, OntModel assume )
{
@@ -58,8 +64,8 @@ public class ClassInspector extends Insp
private void addClasses( OntModel model )
{
- for (Iterator<OntClass> it = model.listClasses(); it.hasNext();)
- knownClasses.add( it.next() );
+ for (OntClass oc: model.listClasses().toList())
+ if (oc.isURIResource()) knownClasses.add( oc );
}
public void inspectStatement( Report r, Statement s )
@@ -77,8 +83,9 @@ public class ClassInspector extends Insp
protected void inspectAllegedClass( Report r, Statement source, RDFNode res )
{
- if (res.isURIResource() && seen.add( res ) && !knownClasses.contains( res ))
- r.createItem( source ).addMainProperty( EYE.unknownClass, res );
+ if (res.isURIResource() && !knownClasses.contains( res ))
+ if (seen.add( res ) || reportAll)
+ r.createItem( source ).addMainProperty( EYE.unknownClass, res );
}
private static Set<Resource> builtinClasses()
Modified: jena/Scratch/Eyeball/trunk/src/main/java/com/hp/hpl/jena/eyeball/inspectors/PropertyInspector.java
URL: http://svn.apache.org/viewvc/jena/Scratch/Eyeball/trunk/src/main/java/com/hp/hpl/jena/eyeball/inspectors/PropertyInspector.java?rev=1413521&r1=1413520&r2=1413521&view=diff
==============================================================================
--- jena/Scratch/Eyeball/trunk/src/main/java/com/hp/hpl/jena/eyeball/inspectors/PropertyInspector.java (original)
+++ jena/Scratch/Eyeball/trunk/src/main/java/com/hp/hpl/jena/eyeball/inspectors/PropertyInspector.java Mon Nov 26 09:14:36 2012
@@ -21,6 +21,7 @@ package com.hp.hpl.jena.eyeball.inspecto
import java.util.*;
import com.hp.hpl.jena.eyeball.*;
+import com.hp.hpl.jena.eyeball.assemblers.EyeballAssembler;
import com.hp.hpl.jena.eyeball.vocabulary.EYE;
import com.hp.hpl.jena.ontology.*;
import com.hp.hpl.jena.rdf.model.*;
@@ -35,11 +36,11 @@ public class PropertyInspector extends I
{ this( false ); }
public PropertyInspector( Resource root )
- { this( getBoolean( root, EYE.reportAll, false ) ); }
+ { this( EyeballAssembler.getBoolean( root, EYE.reportAll, false ) ); }
public PropertyInspector( boolean reportAll )
{
- this.reportAll = false; // TODO: reportAll;
+ this.reportAll = reportAll;
addBuiltinProperties();
}
@@ -86,10 +87,4 @@ public class PropertyInspector extends I
if (seen.add( predicate ) || reportAll)
r.createItem( s ).addMainProperty( EYE.unknownPredicate, predicate );
}
-
- private static boolean getBoolean( Resource root, Property which, boolean ifAbsent )
- {
- Statement s = root.getProperty( which );
- return s == null ? ifAbsent : s.getBoolean();
- }
}
Modified: jena/Scratch/Eyeball/trunk/src/main/java/com/hp/hpl/jena/eyeball/loaders/FileLoader.java
URL: http://svn.apache.org/viewvc/jena/Scratch/Eyeball/trunk/src/main/java/com/hp/hpl/jena/eyeball/loaders/FileLoader.java?rev=1413521&r1=1413520&r2=1413521&view=diff
==============================================================================
--- jena/Scratch/Eyeball/trunk/src/main/java/com/hp/hpl/jena/eyeball/loaders/FileLoader.java (original)
+++ jena/Scratch/Eyeball/trunk/src/main/java/com/hp/hpl/jena/eyeball/loaders/FileLoader.java Mon Nov 26 09:14:36 2012
@@ -24,7 +24,6 @@ import com.hp.hpl.jena.eyeball.vocabular
import com.hp.hpl.jena.rdf.model.*;
import com.hp.hpl.jena.shared.NotFoundException;
import com.hp.hpl.jena.util.FileManager;
-import com.hp.hpl.jena.vocabulary.RDFS;
/**
A FileLoader wraps a FileManager, providing only the load(String) method,
@@ -34,18 +33,25 @@ import com.hp.hpl.jena.vocabulary.RDFS;
public class FileLoader implements Loader
{
protected final FileManager fm;
+ protected final boolean mergeErrors;
/**
Initialise this FileLoader with the specified FileManager.
*/
public FileLoader( FileManager fm )
- { this.fm = fm; }
+ { this( true, fm ); }
+
+ public FileLoader( boolean mergeErrors, FileManager fm )
+ {
+ this.fm = fm;
+ this.mergeErrors = mergeErrors;
+ }
/**
Initialise this FileLoader with the default file manager, FileManager.get().
*/
- public FileLoader()
- { this( FileManager.get() ); }
+ public FileLoader( boolean mergeErrors )
+ { this( mergeErrors, FileManager.get() ); }
/**
Answer the model returned by our FileManager.
@@ -54,8 +60,8 @@ public class FileLoader implements Loade
{ return s.startsWith( "ja:" ) ? loadVia( problems, s.substring( 3 ) ) : loadMagically(problems, s); }
public Model loadMagically( Report problems, String s) {
- String s2 = fm.mapURI( s );
- if (s2.endsWith( ".rdf" )) return loadChecking( problems, s2 );
+ String mapped = fm.mapURI( s );
+ if (mapped.endsWith( ".rdf" ) && mergeErrors) return loadChecking( problems, mapped );
return fm.loadModel( s );
}
@@ -67,7 +73,7 @@ public class FileLoader implements Loade
Property ON_FILE = ResourceFactory.createProperty( NS + "onFile" );
- private Model loadChecking(final Report problems, final String s) {
+ private Model loadChecking(final Report problems, final String sourceName) {
Model result = ModelFactory.createDefaultModel();
RDFReader r = result.getReader();
problems
@@ -79,29 +85,34 @@ public class FileLoader implements Loade
@Override public void warning( Exception e ) {
problems.createItem()
- .addMainProperty( ON_FILE, s )
+ .addMainProperty( ON_FILE, sourceName )
.addProperty( WARN, e.toString() )
;
}
@Override public void fatalError( Exception e ) {
problems.createItem()
- .addMainProperty( ON_FILE, s )
+ .addMainProperty( ON_FILE, sourceName )
.addProperty( FATAL, e.toString() )
;
}
@Override public void error( Exception e ) {
problems.createItem()
- .addMainProperty( ON_FILE, s )
+ .addMainProperty( ON_FILE, sourceName )
.addProperty( ERROR, e.toString() )
;
}
});
- r.read( result, s );
+ r.read( result, addFileScheme(sourceName) );
return result;
}
+ private String addFileScheme(String sourceName) {
+ if (sourceName.matches("^[a-z]+:")) return sourceName;
+ return "file:" + sourceName;
+ }
+
private Model loadVia( Report problems, String rootAtFile )
{
int at = rootAtFile.indexOf( '@' );
Modified: jena/Scratch/Eyeball/trunk/src/main/java/com/hp/hpl/jena/eyeball/loaders/OntLoader.java
URL: http://svn.apache.org/viewvc/jena/Scratch/Eyeball/trunk/src/main/java/com/hp/hpl/jena/eyeball/loaders/OntLoader.java?rev=1413521&r1=1413520&r2=1413521&view=diff
==============================================================================
--- jena/Scratch/Eyeball/trunk/src/main/java/com/hp/hpl/jena/eyeball/loaders/OntLoader.java (original)
+++ jena/Scratch/Eyeball/trunk/src/main/java/com/hp/hpl/jena/eyeball/loaders/OntLoader.java Mon Nov 26 09:14:36 2012
@@ -21,7 +21,6 @@ package com.hp.hpl.jena.eyeball.loaders;
import com.hp.hpl.jena.assembler.assemblers.OntModelSpecAssembler;
import com.hp.hpl.jena.eyeball.Report;
import com.hp.hpl.jena.ontology.*;
-import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.ModelFactory;
import com.hp.hpl.jena.shared.NotFoundException;
@@ -49,6 +48,17 @@ public class OntLoader
{ this.base = base; }
/**
+ Answer a loader that will apply the ont: and jdbc: pseudo-prefixes when
+ loading a model described by a URI.
+ */
+ public static OntLoader createLoader( boolean mergeErrors )
+ {
+ Loader db = new JDBCLoader();
+ Loader base = new FileLoader( mergeErrors );
+ return new OntLoader( new JDBCSensitiveLoader( db, base ) );
+ }
+
+ /**
Answer an OWL_MEM OntModel with the base given by the base loader
applied to <code>s</code>, unless the s ~~ "ont:NAME:baseName",
in which case the constructing Spec is OntModelSpec.NAME.
Modified: jena/Scratch/Eyeball/trunk/src/main/java/com/hp/hpl/jena/eyeball/vocabulary/EyeballAssembling.java
URL: http://svn.apache.org/viewvc/jena/Scratch/Eyeball/trunk/src/main/java/com/hp/hpl/jena/eyeball/vocabulary/EyeballAssembling.java?rev=1413521&r1=1413520&r2=1413521&view=diff
==============================================================================
--- jena/Scratch/Eyeball/trunk/src/main/java/com/hp/hpl/jena/eyeball/vocabulary/EyeballAssembling.java (original)
+++ jena/Scratch/Eyeball/trunk/src/main/java/com/hp/hpl/jena/eyeball/vocabulary/EyeballAssembling.java Mon Nov 26 09:14:36 2012
@@ -22,6 +22,8 @@ import com.hp.hpl.jena.rdf.model.*;
public interface EyeballAssembling extends EyeballVocabularyBase
{
+ public static final Property language = R.p( "language" );
+
public static final Property inspector = R.p( "inspector" );
public static final Property shortName = R.p( "shortName" );
Modified: jena/Scratch/Eyeball/trunk/src/main/java/jena/eyeball.java
URL: http://svn.apache.org/viewvc/jena/Scratch/Eyeball/trunk/src/main/java/jena/eyeball.java?rev=1413521&r1=1413520&r2=1413521&view=diff
==============================================================================
--- jena/Scratch/Eyeball/trunk/src/main/java/jena/eyeball.java (original)
+++ jena/Scratch/Eyeball/trunk/src/main/java/jena/eyeball.java Mon Nov 26 09:14:36 2012
@@ -30,7 +30,6 @@ import com.hp.hpl.jena.eyeball.util.*;
import com.hp.hpl.jena.eyeball.vocabulary.EYE;
import com.hp.hpl.jena.graph.Node;
import com.hp.hpl.jena.ontology.OntModel;
-import com.hp.hpl.jena.query.ARQ;
import com.hp.hpl.jena.rdf.model.*;
import com.hp.hpl.jena.util.*;
import com.hp.hpl.jena.vocabulary.RDF;
@@ -68,13 +67,15 @@ public class eyeball
return result;
}
- static final String VERSION = "Eyeball 2.3RC1 (A Verbs Omen)";
+ static final String VERSION = "Eyeball 2.4 SNAPSHOT (OOK)";
static final String allowed =
"check sign accept config root exclude include assume render"
- + " repair analyse analyze remark"
+ + " remark"
+ " version"
+ " set"
+ + " merge"
+ + " language"
;
private Model input = null;
@@ -121,7 +122,8 @@ public class eyeball
*/
public boolean run( PrintStream out, ExportModel em )
{
- OntLoader loader = createLoader();
+ boolean mergeErrors = booleanArgument( "merge", true );
+ OntLoader loader = OntLoader.createLoader( mergeErrors );
for (Iterator<String> elements = args.listFor( "check" ).iterator(); elements.hasNext();)
checkOneModel( out, em, loader, elements.next() );
for (Iterator<String> elements = args.listFor( "sign" ).iterator(); elements.hasNext();)
@@ -133,10 +135,19 @@ public class eyeball
return allChecksPassed;
}
- private Model applyArguments( Arguments args, Resource givenRoot, Model givenConfigModel )
+ private boolean booleanArgument( String name, boolean result ) {
+ List<String> values = args.listFor( name );
+ for (String v: values)
+ if (v.equalsIgnoreCase( "true" )) result = true;
+ else if (v.equalsIgnoreCase( "false" )) result = false;
+ return result;
+ }
+
+ private Model applyArguments( Arguments args, Resource givenRoot, Model givenConfigModel )
{
Model result = copyModel( givenConfigModel );
Resource root = givenRoot.inModel( result );
+ applyLanguage( args, root, result );
applyExcludes( args, root, result );
applyIncludes( args, root, result );
applyAssumes( args, root, result );
@@ -145,7 +156,17 @@ public class eyeball
return result;
}
- private void applySettings( Arguments args, Resource root, Model result )
+ private void applyLanguage(Arguments args, Resource root, Model result)
+ {
+ List<String> languages = args.listFor( "language" );
+ if (languages.size() > 0)
+ {
+ result.removeAll( root, EYE.language, null );
+ for (String l: languages) result.add( root, EYE.language, l );
+ }
+ }
+
+ private void applySettings( Arguments args, Resource root, Model result )
{
SetPropertiesFromString setModel = new SetPropertiesFromString( result );
List<String> settings = args.listFor( "set", "" );
@@ -245,19 +266,18 @@ public class eyeball
}
private void exclude( Model model, Resource root, String shortName )
- {
- Model toRemove = ModelFactory.createDefaultModel();
+ {
ModelQuery q = ModelQuery.create();
QueryVariable iv = q.createVariable( "i" );
q.add( q.createVariable(), EYE.inspector, iv );
q.add( iv, EYE.shortName, ResourceFactory.createPlainLiteral( shortName ) );
- for (Iterator<? extends List<Node>> inspectors = q.run( model ); inspectors.hasNext();)
+ //
+ for (List<Node> row: q.run(model).toList())
{
- List<Node> row = inspectors.next();
- Resource inspector = (Resource) iv.value( row );
- toRemove.add( root, EYE.inspector, inspector );
+ Resource inspector = (Resource) iv.value( row );
+ model.remove( root, EYE.inspector, inspector );
+ model.removeAll( null, EYE.include, inspector );
}
- model.remove( toRemove );
}
/**
@@ -345,15 +365,4 @@ public class eyeball
public Eyeball getEyeball()
{ return eyeball; }
-
- /**
- Answer a loader that will apply the ont: and jdbc: pseudo-prefixes when
- loading a model described by a URI.
- */
- private OntLoader createLoader()
- {
- Loader db = new JDBCLoader();
- Loader base = new FileLoader();
- return new OntLoader( new JDBCSensitiveLoader( db, base ) );
- }
}
Modified: jena/Scratch/Eyeball/trunk/src/test/java/com/hp/hpl/jena/eyeball/loaders/test/TestFileLoader.java
URL: http://svn.apache.org/viewvc/jena/Scratch/Eyeball/trunk/src/test/java/com/hp/hpl/jena/eyeball/loaders/test/TestFileLoader.java?rev=1413521&r1=1413520&r2=1413521&view=diff
==============================================================================
--- jena/Scratch/Eyeball/trunk/src/test/java/com/hp/hpl/jena/eyeball/loaders/test/TestFileLoader.java (original)
+++ jena/Scratch/Eyeball/trunk/src/test/java/com/hp/hpl/jena/eyeball/loaders/test/TestFileLoader.java Mon Nov 26 09:14:36 2012
@@ -27,7 +27,6 @@ import com.hp.hpl.jena.eyeball.Report;
import com.hp.hpl.jena.eyeball.loaders.FileLoader;
import com.hp.hpl.jena.eyeball.util.test.TestFileInsertion;
import com.hp.hpl.jena.rdf.model.Model;
-import com.hp.hpl.jena.rdf.model.ModelFactory;
import com.hp.hpl.jena.rdf.model.test.ModelTestBase;
import com.hp.hpl.jena.shared.NotFoundException;
import com.hp.hpl.jena.util.FileManager;
@@ -41,7 +40,7 @@ import com.hp.hpl.jena.util.FileManager;
@Test public void testFileLoaderConstruction()
{
- FileLoader fl = new FileLoader();
+ FileLoader fl = new FileLoader( true );
assertSame( FileManager.get(), fl.getFileManager() );
}
Modified: jena/Scratch/Eyeball/trunk/src/test/java/com/hp/hpl/jena/eyeball/vocabulary/test/TestVocabulary.java
URL: http://svn.apache.org/viewvc/jena/Scratch/Eyeball/trunk/src/test/java/com/hp/hpl/jena/eyeball/vocabulary/test/TestVocabulary.java?rev=1413521&r1=1413520&r2=1413521&view=diff
==============================================================================
--- jena/Scratch/Eyeball/trunk/src/test/java/com/hp/hpl/jena/eyeball/vocabulary/test/TestVocabulary.java (original)
+++ jena/Scratch/Eyeball/trunk/src/test/java/com/hp/hpl/jena/eyeball/vocabulary/test/TestVocabulary.java Mon Nov 26 09:14:36 2012
@@ -134,6 +134,9 @@ import com.hp.hpl.jena.vocabulary.RDFS;
@Test public void testOnProperty()
{ assertEquals( EYE.uri + "onProperty", EYE.onProperty.getURI() ); }
+ @Test public void testLanguage()
+ { assertEquals( EYE.uri + "language", EYE.language.getURI() ); }
+
@Test public void testOnType()
{ assertEquals( EYE.uri + "onType", EYE.onType.getURI() ); }
Re: Eyeball documentation
Posted by Ian Dickinson <ia...@epimorphics.com>.
On 26/11/12 10:10, Chris Dollin wrote:
> Do I remember you saying that the html was generated from some
> markup source or is that merely a dream?
Yes, it's stored as markdown and automagically published as HTML by the
Apache CMS perl scripts when you svn commit to the web site's repo.
Ian
Re: Eyeball documentation
Posted by Chris Dollin <ch...@epimorphics.com>.
On Monday, November 26, 2012 09:45:29 AM Ian Dickinson wrote:
> Hi Chris,
> When we migrated the project to Apache, we agreed to remove the
> documentation from svn and use the web site instead. I migrated the
> eyeball documentation to here:
>
> http://jena.apache.org/documentation/tools/eyeball-getting-started.html
>
> I notice from this svn commit that you're still updating the
> now-obsolete eyeball internal documentation.
Sorry, I meant to stop doing that.
Do I remember you saying that the html was generated from some
markup source or is that merely a dream?
Chris
--
"It does not need to take events in their correct order." /Hexwood/
Epimorphics Ltd, http://www.epimorphics.com
Registered address: Court Lodge, 105 High Street, Portishead, Bristol BS20 6PT
Epimorphics Ltd. is a limited company registered in England (number 7016688)
Eyeball documentation
Posted by Ian Dickinson <ia...@epimorphics.com>.
Hi Chris,
When we migrated the project to Apache, we agreed to remove the
documentation from svn and use the web site instead. I migrated the
eyeball documentation to here:
http://jena.apache.org/documentation/tools/eyeball-getting-started.html
I notice from this svn commit that you're still updating the
now-obsolete eyeball internal documentation.
Ian
On 26/11/12 09:14, chrisdollin@apache.org wrote:
> Author: chrisdollin
> Date: Mon Nov 26 09:14:36 2012
> New Revision: 1413521
>
> URL: http://svn.apache.org/viewvc?rev=1413521&view=rev
> Log:
> Alled reportAll for properties and classes. Don't need file: on .rdf files that are being parsed.
>
> Modified:
> jena/Scratch/Eyeball/trunk/doc/eyeball-2.4-full-template.html
> Modified: jena/Scratch/Eyeball/trunk/doc/eyeball-2.4-full-template.html
> URL: http://svn.apache.org/viewvc/jena/Scratch/Eyeball/trunk/doc/eyeball-2.4-full-template.html?rev=1413521&r1=1413520&r2=1413521&view=diff
> ==============================================================================
> --- jena/Scratch/Eyeball/trunk/doc/eyeball-2.4-full-template.html (original)
> +++ jena/Scratch/Eyeball/trunk/doc/eyeball-2.4-full-template.html Mon Nov 26 09:14:36 2012
> @@ -100,6 +100,7 @@
> java [java options eg classpath and proxy] -jar eyeball-2.4-exec.jar
> (-check | -sign | -accept) specialURL+
> [-assume Reference*]
> + [-language (OWL | RDFS | profileURI)]
> [-config fileOrURL*]
> [-set Setting*]
> [-root rootURI]
> @@ -108,6 +109,7 @@ java [java options eg classpath and prox
> [-exclude shortName*]
> [-analyse | -repair]
> [-remark] [-version]
> + [-merge [true|false]]
> </pre>
>
> <p>
> @@ -291,6 +293,22 @@ $eyeball -check myConfig.ttl -sign >s
> to Eyeball so that it can interpret this as a literal.
> </p>
>
> +<h3>merged RDF/XML parsing errors</h3>
> +
> +<pre>
> +-merge
> +-merge true
> +-merge false
> +</pre>
> +
> +<p>
> + If the file being checked has a <code>.rdf</code>
> + suffix, and -merge is absent, has no arguments, or
> + has final argument true, then all RDF/XML parsing
> + errors are merged into the Eyeball reports for this
> + model. Otherwise those errors are reported on stderr.
> +</p>
> +
> <h3>-include/-exclude shortNames</h3>
>
> <p>
> @@ -330,6 +348,21 @@ $eyeball -check myConfig.ttl -sign >s
> -assume owl my-ontology.owl
> </pre>
>
> + <p>Independantly, the Jena language profile for the assumptions
> + can be set with the <code>-language</code> option. The default
> + is the RDFS profile. RDFS and OWL can be referred to by those
> + names; other profiles (as per Jena's ProfileRegistry) must be
> + specified by their full URI. The primary use of -language is
> + to ensure, by using <code>-language OWL</code>, that only
> + OWL classes are recognised by the ClassInspector.
> + </p>
> +
> +<pre>
> +-language RDFS
> +-language OWL
> +-language profileURI
> +</pre>
> +
> <h3>-sign and -accept (experimental)</h3>
>
> <p>If <i>-sign</i> is specified, Eyeball first does a
>
> Modified: jena/Scratch/Eyeball/trunk/src/main/java/com/hp/hpl/jena/extras/tools/query/ModelQuery.java
> URL: http://svn.apache.org/viewvc/jena/Scratch/Eyeball/trunk/src/main/java/com/hp/hpl/jena/extras/tools/query/ModelQuery.java?rev=1413521&r1=1413520&r2=1413521&view=diff